Fonctionnalités de base du grade Ghost
This commit is contained in:
@@ -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.CalculatorManager;
|
||||
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.SpawnTimeManager;
|
||||
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.fun.GhostManager;
|
||||
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;
|
||||
@@ -80,7 +81,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
public ChatAnalysisManager chatAnalysisManager;
|
||||
public CreativCheatManager creativCheatManager;
|
||||
public NoPvpProtectManager noPvpProtectManager;
|
||||
public LoginLogoutMessageManager loginLogoutMessageManager;
|
||||
public VanillaMessageManager vanillaMessageManager;
|
||||
public CalculatorManager calculatorManager;
|
||||
public SurvivalCuboManager survivalCuboManager;
|
||||
public StaffQueueManager staffQueueManager;
|
||||
@@ -91,6 +92,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
public WorldBorderManager worldBorderManager;
|
||||
public HeartThrowManager heartThrowManager;
|
||||
public JailsManager jailsManager;
|
||||
public GhostManager ghostManager;
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +132,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
chatAnalysisManager = new ChatAnalysisManager();
|
||||
creativCheatManager = new CreativCheatManager();
|
||||
noPvpProtectManager = new NoPvpProtectManager();
|
||||
loginLogoutMessageManager = new LoginLogoutMessageManager();
|
||||
vanillaMessageManager = new VanillaMessageManager();
|
||||
calculatorManager = new CalculatorManager();
|
||||
survivalCuboManager = new SurvivalCuboManager();
|
||||
staffQueueManager = new StaffQueueManager();
|
||||
@@ -141,6 +143,7 @@ public class PandacraftUtils extends JavaPlugin {
|
||||
worldBorderManager = new WorldBorderManager();
|
||||
heartThrowManager = new HeartThrowManager();
|
||||
jailsManager = new JailsManager();
|
||||
ghostManager = new GhostManager();
|
||||
|
||||
|
||||
// chargement des écouteurs d'évènement
|
||||
|
@@ -6,7 +6,9 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerAchievementAwardedEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@@ -45,10 +47,15 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
plugin.loginLogoutMessageManager.onPlayerJoin(event);
|
||||
plugin.vanillaMessageManager.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)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
plugin.loginLogoutMessageManager.onPlayerQuit(event);
|
||||
plugin.vanillaMessageManager.onPlayerQuit(event);
|
||||
plugin.staffQueueManager.onPlayerQuit(event);
|
||||
}
|
||||
@EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST)
|
||||
@@ -122,12 +129,44 @@ public class PlayerListener implements Listener {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
|
||||
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)
|
||||
{
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
plugin.afkManager.onPlayerMove(event);
|
||||
plugin.creativCheatManager.onPlayerMove(event);
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ public class XAuthListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL)
|
||||
public void onxAuthLogin(xAuthLoginEvent event) {
|
||||
plugin.loginLogoutMessageManager.onxAuthLogin(event);
|
||||
plugin.vanillaMessageManager.onxAuthLogin(event);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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.players.OnlinePlayerManager;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface;
|
||||
|
||||
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.PlayerQuitEvent;
|
||||
|
||||
import de.luricos.bukkit.xAuth.events.xAuthLoginEvent;
|
||||
|
||||
public class LoginLogoutMessageManager {
|
||||
public class VanillaMessageManager {
|
||||
|
||||
private PandacraftUtils plugin = PandacraftUtils.getInstance();
|
||||
|
||||
@@ -23,7 +24,7 @@ public class LoginLogoutMessageManager {
|
||||
|
||||
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");
|
||||
}
|
||||
@@ -36,11 +37,30 @@ public class LoginLogoutMessageManager {
|
||||
return;
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@@ -82,7 +82,10 @@ public class OffPlayer {
|
||||
|
||||
|
||||
public User getEssentialsUser() {
|
||||
return EssentialsInterface.getPlugin().getOfflineUser(playerName);
|
||||
User u = EssentialsInterface.getPlugin().getOfflineUser(playerName);
|
||||
if (isOnline())
|
||||
u.setBase(getBukkitOnlinePlayer());
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user