Skip to content

Commit

Permalink
Prevent banme packet from banning multiple times (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankParenthesis authored Sep 24, 2023
1 parent a509644 commit d312e1c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/space/pxls/server/PacketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ private void handleShadowBanMe(WebSocketChannel channel, User user, ClientShadow
}

private void handleBanMe(WebSocketChannel channel, User user, ClientBanMe obj) {
String app = obj.getReason();
App.getDatabase().insertAdminLog(user.getId(), String.format("permaban %s with reason: auto-ban via script; %s", user.getName(), app));
user.ban(0, String.format("auto-ban via script; %s", app), 0, user);
if (!user.isBanned() && !user.isShadowBanned()) {
String app = obj.getReason();
App.getDatabase().insertAdminLog(user.getId(), String.format("permaban %s with reason: auto-ban via script; %s", user.getName(), app));
user.ban(0, String.format("auto-ban via script; %s", app), 0, user);
}
}

private void handlePlacementOverrides(WebSocketChannel channel, User user, ClientAdminPlacementOverrides obj) {
Expand Down

0 comments on commit d312e1c

Please sign in to comment.