diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 764ffa8b9..ea10db00a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -201,7 +201,7 @@ public class AntiHack extends MiniPlugin runSync(() -> _banned.remove(uuid)); } - public void doBan(Player player, Class cause, boolean gep) + public void doBan(Player player, Class cause, boolean gep, int hoursBanned) { runSync(() -> { @@ -227,7 +227,7 @@ public class AntiHack extends MiniPlugin new GwenBanNotification(_thisServer, player.getName(), player.getUniqueId().toString(), coreClient.GetRank().name(), CheckManager.getCheckSimpleName(cause), id, gep).publish(); }); - _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, getHoursBanned(player, cause), true, after); + _punish.AddPunishment(coreClient.getName(), Category.Hacking, finalMessage, AntiHack.NAME, 3, true, hoursBanned, true, after); }; if (coreClient.GetRank().has(Rank.TWITCH)) @@ -266,7 +266,7 @@ public class AntiHack extends MiniPlugin Consumer> doPunish = after -> { - _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getHoursBanned(player, CheckManager.getCheckBySimpleName(info.getHackType())), true, after); + _punish.AddPunishment(coreClient.getName(), Category.Hacking, info.getMessage(), AntiHack.NAME, 3, true, getHoursBanned(player), true, after); }; if (coreClient.GetRank().has(Rank.TWITCH)) @@ -346,6 +346,11 @@ public class AntiHack extends MiniPlugin { PunishClient punishClient = require(Punish.class).GetClient(player.getName()); + if (punishClient == null) + { + return -1; + } + int totalPunishments = 0; if (punishClient.GetPunishments().containsKey(Category.Hacking)) @@ -362,7 +367,7 @@ public class AntiHack extends MiniPlugin return totalPunishments; } - public int getHoursBanned(Player player, Class check) + public int getHoursBanned(Player player) { switch (getPunishments(player)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java index 6840ec600..1deaf4a35 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/BanwaveAction.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilServer; public class BanwaveAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); private static final int BAN_DELAY_MINIMUM_MINUTES = 30; private static final int BAN_DELAY_MAXIMUM_MINUTES = (int) TimeUnit.MINUTES.convert(2, TimeUnit.HOURS); @@ -25,7 +26,7 @@ public class BanwaveAction extends AntiHackAction { if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); return; } if (event.getViolations() >= this.getMinVl()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java index 0fbaa3377..6c109e68c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/GEPBanAction.java @@ -7,6 +7,8 @@ import mineplex.core.antihack.AntiHack; public class GEPBanAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); + public GEPBanAction(int vl) { super(vl); @@ -17,7 +19,7 @@ public class GEPBanAction extends AntiHackAction { if (event.getViolations() >= this.getMinVl() && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); } } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java index 1016ba9c5..2f86d524d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/actions/ImmediateBanAction.java @@ -7,6 +7,8 @@ import mineplex.core.antihack.AntiHack; public class ImmediateBanAction extends AntiHackAction { + private final AntiHack _antiHack = Managers.require(AntiHack.class); + public ImmediateBanAction(int vl) { super(vl); @@ -17,12 +19,12 @@ public class ImmediateBanAction extends AntiHackAction { if (event.getViolations() >= (Math.floor(getMinVl() * .9)) && event.getPlayer().getMetadata("GWENEXTREMEPREJUDICE").get(0).asBoolean()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), true); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), true, _antiHack.getHoursBanned(event.getPlayer())); return; } if (event.getViolations() >= this.getMinVl()) { - Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getCheckClass(), false); + _antiHack.doBan(event.getPlayer(), event.getCheckClass(), false, _antiHack.getHoursBanned(event.getPlayer())); } } }