From 5ee2d1030876feffa6a67b2f466dfeafc51f96f3 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 13:04:31 +0100 Subject: [PATCH] Fixing BannedUserIp Delete --- src/de/steamwar/bungeecore/listeners/BanListener.java | 9 --------- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 6 +++++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index bc56de3..c9aadb7 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -47,15 +47,6 @@ public class BanListener extends BasicListener { List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); if(!ips.isEmpty()){ - if(ips.stream().anyMatch(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId())) { - ips.forEach(bannedUserIPs -> { - if(bannedUserIPs.getUserID() == user.getId()) - bannedUserIPs.remove(); - }); - ips.removeIf(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId()); - if(ips.isEmpty()) - return; - } StringBuilder potentialBan = new StringBuilder(); potentialBan.append(BungeeCore.CHAT_PREFIX); potentialBan.append("§cMögliche Bannumgehung durch §r"); diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index b1e723f..8fc30fe 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -151,7 +151,11 @@ public class SteamwarUser { public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; - return isCurrent(punishments.get(Punishment.PunishmentType.Ban)); + if(!isCurrent(punishments.get(Punishment.PunishmentType.Ban))) { + SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id); + return false; + } + return true; } public boolean isMuted(){