Ajout de correctifs de /modo + Mise à jour des panneaux de la prison codé
This commit is contained in:
parent
4ebae9627a
commit
b1afb29471
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 (<pseudo> libéré le <date> à <heure>)
|
||||
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<blocks.length; i++) {
|
||||
|
||||
setWallSign(blocks[i],
|
||||
(raisonI<raisonLines.length)?raisonLines[raisonI]:"",
|
||||
(raisonI+1<raisonLines.length)?raisonLines[raisonI+1]:"",
|
||||
(raisonI+2<raisonLines.length)?raisonLines[raisonI+2]:"",
|
||||
(raisonI+3<raisonLines.length)?raisonLines[raisonI+3]:"",
|
||||
wallDir);
|
||||
|
||||
|
||||
raisonI+=4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO doooooooo
|
||||
|
||||
}
|
||||
|
||||
@ -272,7 +316,18 @@ public class JailsManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setWallSign(Block b, String l1, String l2, String l3, String l4, BlockFace wallDir) {
|
||||
b.setType(Material.WALL_SIGN);
|
||||
|
||||
org.bukkit.block.Sign s = (Sign) b.getState();
|
||||
org.bukkit.material.Sign matS = new org.bukkit.material.Sign(Material.WALL_SIGN);
|
||||
matS.setFacingDirection(wallDir.getOppositeFace());
|
||||
s.setData(matS);
|
||||
s.setLine(0, l1);
|
||||
s.setLine(1, l2);
|
||||
s.setLine(2, l3);
|
||||
s.setLine(3, l4);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user