Skip to content

Commit

Permalink
check account state before getPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
CheerAmi committed Jun 6, 2024
1 parent 76fd5b2 commit 5e4b98b
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public void handle(GameSession session, byte[] header, byte[] payload) throws Ex
// 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 !!!
Expand Down Expand Up @@ -93,15 +102,6 @@ public void handle(GameSession session, byte[] header, byte[] payload) throws Ex
// 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();

Expand Down

0 comments on commit 5e4b98b

Please sign in to comment.