diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandGhost.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandGhost.java new file mode 100644 index 0000000..c63f28b --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandGhost.java @@ -0,0 +1,125 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.commands; + +import java.util.List; +import java.util.Random; + +import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager; +import net.mc_pandacraft.java.plugin.pandacraftutils.config.elements.WorldBorderConfigEntry; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class CommandGhost extends AbstractCommandExecutor { + + public CommandGhost() { + super("ghost"); + } + + + + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, + String[] args) { + + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED+"Vous devez être en ligne pour faire cette commande"); + return true; + } + + Player player = (Player) sender; + + if (args.length == 0) { + showHelp(player); + return true; + } + + if (args.length >= 1 && args[0].equalsIgnoreCase("thor")) { + onCommandThor(player); + return true; + } + + + + + + + + // on arrive ici si aucune des sous commandes correspond à celle tapée + sender.sendMessage(ChatColor.RED+"Mauvaise utilisation de la commande. Faites "+ChatColor.GRAY+"/ghost"+ChatColor.RED+" pour connaitre l'utilisation"); + + + return true; + } + + + + + private void showHelp(Player player) { + + + } + + + + + + + + + + private void onCommandThor(Player player) { + + List worlds = plugin.getServer().getWorlds(); + + Random r = new Random(); + + for (World w : worlds) { + + int nbStrike = r.nextInt(2)+1; + + for (int i=0; i "+ChatColor.ITALIC+"%2$s"); + } + + + + diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/NoPvpProtectManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/NoPvpProtectManager.java index f7f3561..79f156a 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/NoPvpProtectManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/NoPvpProtectManager.java @@ -77,7 +77,7 @@ public class NoPvpProtectManager { for (Player pl : pls) { // on ne compte pas le poseur (sinon, on y arrivera pas x) ) - if (pl == p || pl.getGameMode() == GameMode.CREATIVE) + if (pl == p || !pl.isOnline() || pl.getGameMode() == GameMode.CREATIVE) continue; if (OnlinePlayerManager.get(pl).isVanished()) @@ -119,7 +119,7 @@ public class NoPvpProtectManager { for (Player pl : pls) { // on ne compte pas le poseur (sinon, on y arrivera pas x) ) - if (pl == p || pl.getGameMode() == GameMode.CREATIVE) + if (pl == p || !pl.isOnline() || pl.getGameMode() == GameMode.CREATIVE) continue; if (OnlinePlayerManager.get(pl).isVanished()) @@ -164,7 +164,7 @@ public class NoPvpProtectManager { for (Player pl : pls) { // on ne compte pas le poseur (sinon, on y arrivera pas x) ) - if (pl == p || pl.getGameMode() == GameMode.CREATIVE) + if (pl == p || !pl.isOnline() || pl.getGameMode() == GameMode.CREATIVE) continue; if (OnlinePlayerManager.get(pl).isVanished()) @@ -204,7 +204,7 @@ public class NoPvpProtectManager { for (Player pl : pls) { // on ne compte pas le poseur (sinon, on y arrivera pas x) ) et on ignorent ceux qui fly - if (pl == p || pl.isFlying()) + if (pl == p || !pl.isOnline() || pl.isFlying()) continue; if (OnlinePlayerManager.get(pl).isVanished()) @@ -250,7 +250,7 @@ public class NoPvpProtectManager { for (Player pl : pls) { // on ignore ceux en créatif - if (pl.getGameMode() == GameMode.CREATIVE) + if (pl == null || !pl.isOnline() || pl.getGameMode() == GameMode.CREATIVE) continue; if (OnlinePlayerManager.get(pl).isVanished()) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OffPlayer.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OffPlayer.java index 4548a8f..8e4a86a 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OffPlayer.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OffPlayer.java @@ -94,10 +94,7 @@ public class OffPlayer { * @return l'instance xAuth du joueur, ou null si aucune donnée n'est présente à propos du joueur */ public xAuthPlayer getXAuthPlayer() { - xAuthPlayer xAP = xAuth.getPlugin().getPlayerManager().getPlayer(playerName); - if (xAP.getAccountId() == -1) - return null; - return xAP; + return xAuth.getPlugin().getPlayerManager().getPlayer(playerName); }