diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java index 456f3d6..efa511c 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java @@ -8,7 +8,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.data_model.SQLManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.AutoMessagesManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.CalculatorManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.CommandAliasManager; -import net.mc_pandacraft.java.plugin.pandacraftutils.modules.JailsManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.LoginLogoutMessageManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.PacketOutServerInfoListener; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.SpawnTimeManager; @@ -17,6 +16,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.modules.WESelectionDisplayM import net.mc_pandacraft.java.plugin.pandacraftutils.modules.fun.HeartThrowManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control.AfkManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control.ChatAnalysisManager; +import net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control.JailsManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.protection.CreativCheatManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.protection.EntitySpamManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.protection.NoPvpProtectManager; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandModo.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandModo.java index f1621e4..d510f52 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandModo.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandModo.java @@ -437,6 +437,11 @@ public class CommandModo extends AbstractCommandExecutor { // application de la sanction plugin.getServer().getBanList(Type.NAME).addBan(player, message, expire, sender.getName()); + u.setBanned(true); + u.setBanReason(message); + u.setBanTimeout(expire.getTime()); + if (u.isOnline()) + u.kickPlayer(message); // enregistrement de l'action ModoHistoryElement historyEl = new ModoHistoryElement(sender.getName(), ActionType.BAN, player, message); @@ -472,6 +477,13 @@ public class CommandModo extends AbstractCommandExecutor { // application du retrait de sanction plugin.getServer().getBanList(Type.NAME).pardon(player); + + User u = EssentialsInterface.getPlugin().getOfflineUser(player); + if (u != null) { + u.setBanned(false); + u.setBanReason(""); + u.setBanTimeout(0); + } // enregistrement de l'action ModoHistoryElement historyEl = new ModoHistoryElement(sender.getName(), ActionType.UNBAN, player, message); @@ -633,6 +645,8 @@ public class CommandModo extends AbstractCommandExecutor { return; } + + // enregistrement de l'action ModoHistoryElement historyEl = new ModoHistoryElement(sender.getName(), ActionType.JAIL, player, message); historyEl.setValue(duration); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/JailsManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java similarity index 79% rename from src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/JailsManager.java rename to src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java index 78c7f83..4c05df5 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/JailsManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java @@ -1,4 +1,4 @@ -package net.mc_pandacraft.java.plugin.pandacraftutils.modules; +package net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control; import java.sql.Date; import java.text.DateFormat; @@ -17,6 +17,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Sign; import com.earth2me.essentials.User; import com.earth2me.essentials.UserMap; @@ -131,6 +132,14 @@ public class JailsManager { player.setJail(jail); player.setJailTimeout(System.currentTimeMillis()+duree*1000); + if (player.isOnline()) { + try { + player.teleport(EssentialsInterface.getPlugin().getJails().getJail(jail)); + } catch (Exception e) { + e.printStackTrace(); + } + } + jailedPlayers.put(jail, new JailedPlayer(player.getName(), jail, raison, System.currentTimeMillis()+duree*1000)); @@ -246,7 +255,8 @@ public class JailsManager { player = (player.length() > 15) ? player.substring(0, 15) : player; String raison = jp.reason; - raison = WordUtils.wrap(raison, 15, "\n", true); + if (raison != null) + raison = WordUtils.wrap(raison, 15, "\n", true); Date d = new Date(jp.timeout); DateFormat date = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.FRANCE); @@ -254,8 +264,42 @@ public class JailsManager { String affDate = date.format(d) + " à " + hour.format(d); affDate = WordUtils.wrap(affDate, 15, "\n", true); + String[] affDateLines = affDate.split("\n"); + + // premier panneau ( libéré le à ) + if (blocks.length >= 1) { + String l1 = player; + String l2 = "libéré(e) le"; + String l3 = (affDateLines.length>0)?affDateLines[0]:""; + String l4 = (affDateLines.length>1)?affDateLines[1]:""; + setWallSign(blocks[0], l1, l2, l3, l4, wallDir); + } + + if (raison != null) { + // on ne met à jour que si la raison est précisé (effacé après redémarrage, mais + // il ne faut pas l'effacer des pannaux si le joueur est toujours en prison) + String[] raisonLines = raison.split("\n"); + + int raisonI = 0; + + for (int i=1; i