From 7770fa028460f0b38d96cd1ce6b4a543ec78ba3f Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 26 Oct 2015 07:09:01 -0400 Subject: [PATCH] - Added system to ensure banned players are removed from the network --- .../src/mineplex/core/punish/Punish.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 9336697f3..32ace7538 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.punish.Command.PunishCommand; import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishmentToken; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.serverdata.commands.ServerCommandManager; import org.bukkit.Bukkit; @@ -107,6 +109,33 @@ public class Punish extends MiniPlugin event.setCancelled(true); } } + + @EventHandler + public void banRefresh(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Player check : UtilServer.getPlayers()) + { + PunishClient client = GetClient(check.getName()); + if (client != null && client.IsBanned()) + { + Punishment punishment = client.GetPunishment(PunishmentSentence.Ban); + String time = UtilTime.convertString(punishment.GetRemaining(), 0, TimeUnit.FIT); + + if (punishment.GetHours() == -1) + time = "Permanent"; + + String reason = C.cRed + C.Bold + "You are banned for " + time + + "\n" + C.cWhite + punishment.GetReason() + + "\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals" + ; + + check.kickPlayer(reason); + } + } + } public void Help(Player caller) {