mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-23 22:54:29 +00:00
Merge pull request #52 from iTruth/development
Fix playerOpt is always throw an exception when it's null
This commit is contained in:
commit
0811c52f75
@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer {
|
|||||||
|
|
||||||
public Account getAccountByName(String username) {
|
public Account getAccountByName(String username) {
|
||||||
Optional<GenshinPlayer> playerOpt = getPlayers().values().stream().filter(player -> player.getAccount().getUsername().equals(username)).findFirst();
|
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 playerOpt.get().getAccount();
|
||||||
}
|
}
|
||||||
return DatabaseHelper.getAccountByName(username);
|
return DatabaseHelper.getAccountByName(username);
|
||||||
|
Loading…
Reference in New Issue
Block a user