diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index df927dbcc..ae80c5d25 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -51,7 +51,7 @@ public final class PlayerCommands { case 2: try { target = Integer.parseInt(args.get(0)); - if(Grasscutter.getGameServer().getPlayerByUid(target) == null) { + if(Grasscutter.getGameServer().getPlayerById(target) == null) { target = player.getId(); amount = Integer.parseInt(args.get(1)); item = Integer.parseInt(args.get(0)); } else { @@ -66,7 +66,7 @@ public final class PlayerCommands { case 3: try { target = Integer.parseInt(args.get(0)); - if(Grasscutter.getGameServer().getPlayerByUid(target) == null) { + if(Grasscutter.getGameServer().getPlayerById(target) == null) { CommandHandler.sendMessage(player, "Invalid player ID."); return; } @@ -80,7 +80,7 @@ public final class PlayerCommands { break; } - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerById(target); if(targetPlayer == null) { CommandHandler.sendMessage(player, "Player not found."); return; } @@ -107,7 +107,7 @@ public final class PlayerCommands { int item = Integer.parseInt(args.get(1)); int amount = 1; if(args.size() > 2) amount = Integer.parseInt(args.get(2)); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerById(target); if(targetPlayer == null) { CommandHandler.sendMessage(null, "Player not found."); return; } diff --git a/src/main/java/emu/grasscutter/commands/ServerCommands.java b/src/main/java/emu/grasscutter/commands/ServerCommands.java index 6ae0bb33c..3accd3ce8 100644 --- a/src/main/java/emu/grasscutter/commands/ServerCommands.java +++ b/src/main/java/emu/grasscutter/commands/ServerCommands.java @@ -43,7 +43,7 @@ public final class ServerCommands { int target = Integer.parseInt(args.get(0)); String message = String.join(" ", args.subList(1, args.size())); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerById(target); if(targetPlayer == null) { CommandHandler.sendMessage(null, "Player not found."); return; } @@ -65,7 +65,7 @@ public final class ServerCommands { int target = Integer.parseInt(args.get(0)); String message = String.join(" ", args.subList(1, args.size())); - GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerByUid(target); + GenshinPlayer targetPlayer = Grasscutter.getGameServer().getPlayerById(target); if(targetPlayer == null) { CommandHandler.sendMessage(player, "Player not found."); return; } diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index deb215f0d..87a76d400 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -110,12 +110,6 @@ public final class GameServer extends MihoyoKcpServer { return this.getPlayers().get(id); } - public GenshinPlayer getPlayerByUid(int uid) { - return this.getPlayers().values().stream() - .filter(player -> player.getAccount().getPlayerId() == uid) - .findFirst().orElse(this.getPlayerById(uid)); - } - public GenshinPlayer forceGetPlayerById(int id) { // Console check if (id == GenshinConstants.SERVER_CONSOLE_UID) {