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) {