:
check account state before getPlayer
This commit is contained in:
issueMel 2024-06-06 10:18:24 +08:00 committed by CheerAmi
parent 76fd5b2e9c
commit 85001441a2

View File

@ -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();