From 8a5369d88854a401c6905dd370b5eb4798517910 Mon Sep 17 00:00:00 2001 From: destro174 <40720638+destro174@users.noreply.github.com> Date: Sat, 19 Feb 2022 20:14:19 +0100 Subject: [PATCH] remove smart ban --- .../GriefPrevention/GriefPrevention.java | 4 -- .../GriefPrevention/PlayerEventHandler.java | 65 ------------------- 2 files changed, 69 deletions(-) diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 1ac7217..08019cf 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -204,8 +204,6 @@ public class GriefPrevention extends JavaPlugin public boolean config_signNotifications; //whether sign content will broadcast to administrators in game public ArrayList config_eavesdrop_whisperCommands; //list of whisper commands to eavesdrop on - public boolean config_smartBan; //whether to ban accounts which very likely owned by a banned player - public boolean config_endermenMoveBlocks; //whether or not endermen may move blocks around public boolean config_claims_ravagersBreakBlocks; //whether or not ravagers may break blocks in claims public boolean config_silverfishBreakBlocks; //whether silverfish may break blocks @@ -631,7 +629,6 @@ public class GriefPrevention extends JavaPlugin String whisperCommandsToMonitor = config.getString("GriefPrevention.WhisperCommands", "/tell;/pm;/r;/whisper;/msg"); whisperCommandsToMonitor = config.getString("GriefPrevention.Spam.WhisperSlashCommands", whisperCommandsToMonitor); - this.config_smartBan = config.getBoolean("GriefPrevention.SmartBan", true); this.config_trollFilterEnabled = config.getBoolean("GriefPrevention.Mute New Players Using Banned Words", true); this.config_ipLimit = config.getInt("GriefPrevention.MaxPlayersPerIpAddress", 3); this.config_silenceBans = config.getBoolean("GriefPrevention.SilenceBans", true); @@ -805,7 +802,6 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.AdminsGetWhispers", this.config_whisperNotifications); outConfig.set("GriefPrevention.AdminsGetSignNotifications", this.config_signNotifications); - outConfig.set("GriefPrevention.SmartBan", this.config_smartBan); outConfig.set("GriefPrevention.Mute New Players Using Banned Words", this.config_trollFilterEnabled); outConfig.set("GriefPrevention.MaxPlayersPerIpAddress", this.config_ipLimit); outConfig.set("GriefPrevention.SilenceBans", this.config_silenceBans); diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 0ca3dd4..c79ed17 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -258,71 +258,6 @@ class PlayerEventHandler implements Listener event.setJoinMessage(null); } - //FEATURE: auto-ban accounts who use an IP address which was very recently used by another banned account - if (instance.config_smartBan && !player.hasPlayedBefore()) - { - //search temporarily banned IP addresses for this one - for (int i = 0; i < this.tempBannedIps.size(); i++) - { - IpBanInfo info = this.tempBannedIps.get(i); - String address = info.address.toString(); - - //eliminate any expired entries - if (now > info.expirationTimestamp) - { - this.tempBannedIps.remove(i--); - } - - //if we find a match - else if (address.equals(playerData.ipAddress.toString())) - { - //if the account associated with the IP ban has been pardoned, remove all ip bans for that ip and we're done - OfflinePlayer bannedPlayer = instance.getServer().getOfflinePlayer(info.bannedAccountName); - if (!bannedPlayer.isBanned()) - { - for (int j = 0; j < this.tempBannedIps.size(); j++) - { - IpBanInfo info2 = this.tempBannedIps.get(j); - if (info2.address.toString().equals(address)) - { - OfflinePlayer bannedAccount = instance.getServer().getOfflinePlayer(info2.bannedAccountName); - instance.getServer().getBanList(BanList.Type.NAME).pardon(bannedAccount.getName()); - this.tempBannedIps.remove(j--); - } - } - - break; - } - - //otherwise if that account is still banned, ban this account, too - else - { - GriefPrevention.AddLogEntry("Auto-banned new player " + player.getName() + " because that account is using an IP address very recently used by banned player " + info.bannedAccountName + " (" + info.address.toString() + ").", CustomLogEntryTypes.AdminActivity); - - //notify any online ops - @SuppressWarnings("unchecked") - Collection players = (Collection) instance.getServer().getOnlinePlayers(); - for (Player otherPlayer : players) - { - if (otherPlayer.isOp()) - { - GriefPrevention.sendMessage(otherPlayer, TextMode.Success, Messages.AutoBanNotify, player.getName(), info.bannedAccountName); - } - } - - //ban player - PlayerKickBanTask task = new PlayerKickBanTask(player, "", "GriefPrevention Smart Ban - Shared Login:" + info.bannedAccountName, true); - instance.getServer().getScheduler().scheduleSyncDelayedTask(instance, task, 10L); - - //silence join message - event.setJoinMessage(""); - - break; - } - } - } - } - //in case player has changed his name, on successful login, update UUID > Name mapping GriefPrevention.cacheUUIDNamePair(player.getUniqueId(), player.getName());