From 5e4b98bff12eb4d212406adbe65203030a88d714 Mon Sep 17 00:00:00 2001 From: CheerAmi Date: Thu, 6 Jun 2024 10:18:24 +0800 Subject: [PATCH] check account state before getPlayer --- .../packet/recv/HandlerGetPlayerTokenReq.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java index 3a54acc52..3d9527220 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java @@ -42,6 +42,15 @@ public class HandlerGetPlayerTokenReq extends PacketHandler { // Set account session.setAccount(account); + // Checks if the player is banned + if (session.getAccount().isBanned()) { + session.setState(SessionState.ACCOUNT_BANNED); + session.send( + new PacketGetPlayerTokenRsp( + session, 21, "FORBID_CHEATING_PLUGINS", session.getAccount().getBanEndTime())); + return; + } + // Check if player object exists in server // NOTE: CHECKING MUST SITUATED HERE (BEFORE getPlayerByUid)! because to save firstly ,to load // secondly !!! @@ -93,15 +102,6 @@ public class HandlerGetPlayerTokenReq extends PacketHandler { // Set player object for session session.setPlayer(player); - // Checks if the player is banned - if (session.getAccount().isBanned()) { - session.setState(SessionState.ACCOUNT_BANNED); - session.send( - new PacketGetPlayerTokenRsp( - session, 21, "FORBID_CHEATING_PLUGINS", session.getAccount().getBanEndTime())); - return; - } - // Load player from database player.loadFromDatabase();