Commit de0a14a5 authored by iTruth's avatar iTruth
Browse files

Fix playerOpt is always throw an exception when it's null

parent 7fc587e7
......@@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer {
public Account getAccountByName(String username) {
Optional<GenshinPlayer> playerOpt = getPlayers().values().stream().filter(player -> player.getAccount().getUsername().equals(username)).findFirst();
if (playerOpt.get() != null) {
if (playerOpt.isPresent()) {
return playerOpt.get().getAccount();
}
return DatabaseHelper.getAccountByName(username);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment