Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check account state before getPlayerByAccountId() #2517

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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