diff --git a/.classpath b/.classpath index e6d2265..317536e 100644 --- a/.classpath +++ b/.classpath @@ -9,5 +9,6 @@ + diff --git a/lib/Essentials-Pre2.13.1.2.jar b/lib/Essentials-Pre2.13.1.2.jar new file mode 100644 index 0000000..def1d16 Binary files /dev/null and b/lib/Essentials-Pre2.13.1.2.jar differ diff --git a/make_jar.jardesc b/make_jar.jardesc index a1a00d0..be956c0 100644 --- a/make_jar.jardesc +++ b/make_jar.jardesc @@ -1,6 +1,6 @@ - + diff --git a/resources/plugin.yml b/resources/plugin.yml index d18d7d8..30525bc 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,6 +1,6 @@ name: PandacraftUtils main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils -version: 2.6 +version: 2.7 diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/afk/AfkPlayer.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/afk/AfkPlayer.java index 23ff9bd..bd9e0a1 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/afk/AfkPlayer.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/afk/AfkPlayer.java @@ -1,7 +1,11 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.afk; +import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; + import org.bukkit.entity.Player; +import com.earth2me.essentials.Essentials; + public class AfkPlayer { private Player player; private long timeLastAction; @@ -26,6 +30,11 @@ public class AfkPlayer { return; afk = a; String message; + + // on affiche pas le status AFK des joueurs vanish + if (EssentialsInterface.isPlayerVanished(player)) return; + + // affichage du message if (afk) message = player.getDisplayName()+"§r est désormais AFK."; else diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java index 17d2e75..b837dc7 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/login_message/LoginLogoutManager.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.List; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; +import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -37,8 +38,11 @@ public class LoginLogoutManager implements Listener { @EventHandler public void onxAuthLogin(xAuthLoginEvent event) { - plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter"); loggedInPlayer.add(event.getPlayer()); + + if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; + + plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter"); } @EventHandler @@ -47,11 +51,18 @@ public class LoginLogoutManager implements Listener { if (!isPlayerLoggedIn(event.getPlayer())) return; + loggedInPlayer.remove(event.getPlayer()); + + // on affiche le message que si le joueur n'est pas vanish + if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; + plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu"); } + + public List getLoggedInPlayers() { return loggedInPlayer; } public List getLoggedOutPlayers() { diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/player_count_list/PacketOutServerInfoListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/player_count_list/PacketOutServerInfoListener.java index 5e2276b..f772640 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/player_count_list/PacketOutServerInfoListener.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/player_count_list/PacketOutServerInfoListener.java @@ -15,6 +15,7 @@ import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.wrappers.WrappedGameProfile; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; +import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; public class PacketOutServerInfoListener { private PandacraftUtils plugin; @@ -38,6 +39,8 @@ public class PacketOutServerInfoListener { { Player[] pl_list = PacketOutServerInfoListener.this.plugin.getServer().getOnlinePlayers(); + int count_player = 0; + List plAdmin = new ArrayList(); List plModo = new ArrayList(); @@ -49,6 +52,9 @@ public class PacketOutServerInfoListener { { if (p != null && p.isOnline()) { + // on passe si le joueur est vanish + if(EssentialsInterface.isPlayerVanished(p)) continue; + if (p.hasPermission("pandacraft.grade.admins")) plAdmin.add(p); else if (p.hasPermission("pandacraft.grade.modos")) @@ -59,6 +65,8 @@ public class PacketOutServerInfoListener { plPlayerPremium.add(p); else plPlayer.add(p); + + count_player++; } } @@ -97,6 +105,7 @@ public class PacketOutServerInfoListener { event.getPacket().getServerPings().read(0).setPlayers(list); + event.getPacket().getServerPings().read(0).setPlayersOnline(count_player); } } ); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java new file mode 100644 index 0000000..98f8ecd --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/plugin_interface/EssentialsInterface.java @@ -0,0 +1,37 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.bukkit.entity.Player; + +import com.earth2me.essentials.Essentials; + +public class EssentialsInterface { + + + + public static boolean isPlayerVanished(Player p) { + try { + return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isVanished(); + } catch (Exception e) { } + return false; + } + + public static boolean canPlayerSeeVanishedPlayer(Player p, Player hiddenP) { + try { + Essentials ess = (Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials"); + + + + return ess.getUser(p).canSee(hiddenP); + } catch (Exception e) { } + return false; + } + + public static boolean isPlayerMuted(Player p) { + try { + return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isMuted(); + } catch (Exception e) { } + return false; + } +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/me/CommandMe.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/me/CommandMe.java index 7a2000e..bbcc16c 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/me/CommandMe.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/me/CommandMe.java @@ -1,6 +1,7 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.me; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; +import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; @@ -24,9 +25,15 @@ public class CommandMe implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (args.length == 0) return false; + String name; if (sender instanceof Player) + { + // pas de /me pour les mute + if (EssentialsInterface.isPlayerMuted((Player)sender)) return true; + name = ((Player)sender).getDisplayName()+ChatColor.RESET+" "+ChatColor.ITALIC; + } else if (sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender) name = ChatColor.ITALIC+"Le serveur ";