Fonctionnalités de base du grade Ghost

This commit is contained in:
Marc Baloup 2015-03-29 00:20:42 -04:00
parent 6196c3e2fd
commit 093a1f619a
8 changed files with 117 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc> <jardesc>
<jar path="PandacraftUtils/jar_export/PandacraftUtils-4.0.jar"/> <jar path="PandacraftUtils/jar_export/PandacraftUtils-4.1.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/> <options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/> <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/> <selectedProjects/>

View File

@ -1,6 +1,6 @@
name: PandacraftUtils name: PandacraftUtils
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
version: 4.0 version: 4.1

View File

@ -13,11 +13,12 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.listener.XAuthListener;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.AutoMessagesManager; 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.CalculatorManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.CommandAliasManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.CommandAliasManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.LoginLogoutMessageManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.VanillaMessageManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.PacketOutServerInfoListener; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.PacketOutServerInfoListener;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.SpawnTimeManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.SpawnTimeManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.TPSAnalysisManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.TPSAnalysisManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.WESelectionDisplayManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.WESelectionDisplayManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.fun.GhostManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.fun.HeartThrowManager; 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.AfkManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control.ChatAnalysisManager; import net.mc_pandacraft.java.plugin.pandacraftutils.modules.player_control.ChatAnalysisManager;
@ -80,7 +81,7 @@ public class PandacraftUtils extends JavaPlugin {
public ChatAnalysisManager chatAnalysisManager; public ChatAnalysisManager chatAnalysisManager;
public CreativCheatManager creativCheatManager; public CreativCheatManager creativCheatManager;
public NoPvpProtectManager noPvpProtectManager; public NoPvpProtectManager noPvpProtectManager;
public LoginLogoutMessageManager loginLogoutMessageManager; public VanillaMessageManager vanillaMessageManager;
public CalculatorManager calculatorManager; public CalculatorManager calculatorManager;
public SurvivalCuboManager survivalCuboManager; public SurvivalCuboManager survivalCuboManager;
public StaffQueueManager staffQueueManager; public StaffQueueManager staffQueueManager;
@ -91,6 +92,7 @@ public class PandacraftUtils extends JavaPlugin {
public WorldBorderManager worldBorderManager; public WorldBorderManager worldBorderManager;
public HeartThrowManager heartThrowManager; public HeartThrowManager heartThrowManager;
public JailsManager jailsManager; public JailsManager jailsManager;
public GhostManager ghostManager;
@ -130,7 +132,7 @@ public class PandacraftUtils extends JavaPlugin {
chatAnalysisManager = new ChatAnalysisManager(); chatAnalysisManager = new ChatAnalysisManager();
creativCheatManager = new CreativCheatManager(); creativCheatManager = new CreativCheatManager();
noPvpProtectManager = new NoPvpProtectManager(); noPvpProtectManager = new NoPvpProtectManager();
loginLogoutMessageManager = new LoginLogoutMessageManager(); vanillaMessageManager = new VanillaMessageManager();
calculatorManager = new CalculatorManager(); calculatorManager = new CalculatorManager();
survivalCuboManager = new SurvivalCuboManager(); survivalCuboManager = new SurvivalCuboManager();
staffQueueManager = new StaffQueueManager(); staffQueueManager = new StaffQueueManager();
@ -141,6 +143,7 @@ public class PandacraftUtils extends JavaPlugin {
worldBorderManager = new WorldBorderManager(); worldBorderManager = new WorldBorderManager();
heartThrowManager = new HeartThrowManager(); heartThrowManager = new HeartThrowManager();
jailsManager = new JailsManager(); jailsManager = new JailsManager();
ghostManager = new GhostManager();
// chargement des écouteurs d'évènement // chargement des écouteurs d'évènement

View File

@ -6,7 +6,9 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerAchievementAwardedEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
@ -45,10 +47,15 @@ public class PlayerListener implements Listener {
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
plugin.loginLogoutMessageManager.onPlayerJoin(event); plugin.vanillaMessageManager.onPlayerJoin(event);
plugin.staffQueueManager.onPlayerJoin(event); plugin.staffQueueManager.onPlayerJoin(event);
} }
@EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST)
public void onPlayerJoin_Highest(PlayerJoinEvent event) {
plugin.ghostManager.onPlayerJoin(event);
}
@ -61,7 +68,7 @@ public class PlayerListener implements Listener {
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
plugin.loginLogoutMessageManager.onPlayerQuit(event); plugin.vanillaMessageManager.onPlayerQuit(event);
plugin.staffQueueManager.onPlayerQuit(event); plugin.staffQueueManager.onPlayerQuit(event);
} }
@EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST) @EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST)
@ -126,8 +133,40 @@ public class PlayerListener implements Listener {
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onPlayerMove (PlayerMoveEvent event) public void onPlayerDeath(PlayerDeathEvent event) {
{ plugin.vanillaMessageManager.onPlayerDeath(event);
}
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onPlayerAchievementAwarded(PlayerAchievementAwardedEvent event) {
plugin.vanillaMessageManager.onPlayerAchievementAwarded(event);
}
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onPlayerMove(PlayerMoveEvent event) {
plugin.afkManager.onPlayerMove(event); plugin.afkManager.onPlayerMove(event);
plugin.creativCheatManager.onPlayerMove(event); plugin.creativCheatManager.onPlayerMove(event);
} }

View File

@ -29,7 +29,7 @@ public class XAuthListener implements Listener {
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
public void onxAuthLogin(xAuthLoginEvent event) { public void onxAuthLogin(xAuthLoginEvent event) {
plugin.loginLogoutMessageManager.onxAuthLogin(event); plugin.vanillaMessageManager.onxAuthLogin(event);
} }

View File

@ -2,15 +2,16 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.modules;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerAchievementAwardedEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import de.luricos.bukkit.xAuth.events.xAuthLoginEvent; import de.luricos.bukkit.xAuth.events.xAuthLoginEvent;
public class LoginLogoutMessageManager { public class VanillaMessageManager {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
@ -23,7 +24,7 @@ public class LoginLogoutMessageManager {
public void onxAuthLogin(xAuthLoginEvent event) { public void onxAuthLogin(xAuthLoginEvent event) {
if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; if (OnlinePlayerManager.get(event.getPlayer()).isVanished()) return;
plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter"); plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter");
} }
@ -36,11 +37,30 @@ public class LoginLogoutMessageManager {
return; return;
// on affiche le message que si le joueur n'est pas vanish // on affiche le message que si le joueur n'est pas vanish
if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; if (OnlinePlayerManager.get(event.getPlayer()).isVanished()) return;
plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu"); plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" a quitté le jeu");
} }
public void onPlayerDeath(PlayerDeathEvent event) {
if (OnlinePlayerManager.get(event.getEntity()).isVanished()) {
event.setDeathMessage(null);
}
}
public void onPlayerAchievementAwarded(PlayerAchievementAwardedEvent event) {
if (OnlinePlayerManager.get(event.getPlayer()).isVanished()) {
event.setCancelled(true);
}
}
} }

View File

@ -0,0 +1,37 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.modules.fun;
import org.bukkit.event.player.PlayerJoinEvent;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
public class GhostManager {
@SuppressWarnings("unused")
private PandacraftUtils plugin = PandacraftUtils.getInstance();
public void onPlayerJoin(PlayerJoinEvent event) {
if (!event.getPlayer().hasPermission("pandacraft.ghost")) return;
OnlinePlayerManager.get(event.getPlayer()).getEssentialsUser().setVanished(true);
}
}

View File

@ -82,7 +82,10 @@ public class OffPlayer {
public User getEssentialsUser() { public User getEssentialsUser() {
return EssentialsInterface.getPlugin().getOfflineUser(playerName); User u = EssentialsInterface.getPlugin().getOfflineUser(playerName);
if (isOnline())
u.setBase(getBukkitOnlinePlayer());
return u;
} }