diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index b42ced55c..b99063cb6 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer { public Account getAccountByName(String username) { Optional 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);