diff --git a/make_jar.jardesc b/make_jar.jardesc index 7aff601..0964a49 100644 --- a/make_jar.jardesc +++ b/make_jar.jardesc @@ -1,6 +1,6 @@ - + diff --git a/resources/plugin.yml b/resources/plugin.yml index 40ce909..ed5fcad 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,6 +1,6 @@ name: PandacraftUtils main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils -version: 3.15 +version: 4.0 diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java index c050b5e..58cfbb8 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java @@ -5,6 +5,11 @@ import java.sql.SQLException; import net.mc_pandacraft.java.plugin.pandacraftutils.commands.PandacraftUtilsCommandsManager; import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager; import net.mc_pandacraft.java.plugin.pandacraftutils.data_model.SQLManager; +import net.mc_pandacraft.java.plugin.pandacraftutils.listener.BlockListener; +import net.mc_pandacraft.java.plugin.pandacraftutils.listener.EntityListener; +import net.mc_pandacraft.java.plugin.pandacraftutils.listener.PlayerListener; +import net.mc_pandacraft.java.plugin.pandacraftutils.listener.VehicleListener; +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; @@ -30,6 +35,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager import net.mc_pandacraft.java.plugin.pandacraftutils.players.PlayerDataCleaner; import net.mc_pandacraft.java.util.mysql.DBConnection; +import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; @@ -49,7 +55,10 @@ public class PandacraftUtils extends JavaPlugin { private static ServerState serverState = ServerState.STOPPED; public static ServerState getServerState() { return serverState; } - public static void setServerState(ServerState s) { serverState = s; } + public static void setServerState(ServerState s) { + serverState = s; + Bukkit.getLogger().info("(ServerState) Set to "+s.toString()); + } public enum ServerState{ STOPPED, @@ -134,6 +143,16 @@ public class PandacraftUtils extends JavaPlugin { jailsManager = new JailsManager(); + // chargement des écouteurs d'évènement + new BlockListener(); + new EntityListener(); + new PlayerListener(); + new VehicleListener(); + new XAuthListener(); + + + + NetworkAPI.loadNewInstance(); getServer().getScheduler().runTaskLater(this, new Runnable() { diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/BlockListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/BlockListener.java new file mode 100644 index 0000000..f3ab073 --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/BlockListener.java @@ -0,0 +1,86 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.listener; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPlaceEvent; + +public class BlockListener implements Listener { + private PandacraftUtils plugin = PandacraftUtils.getInstance(); + + + + public BlockListener() + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onBlockPlace(BlockPlaceEvent event) { + plugin.noPvpProtectManager.onBlockPlace(event); + } + + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onBlockIgnit(BlockIgniteEvent event) { + plugin.noPvpProtectManager.onBlockIgnit(event); + } + + + + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onBlockBreak(BlockBreakEvent event) { + plugin.noPvpProtectManager.onBlockBreak(event); + } + + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onBlockFromTo(BlockFromToEvent event) { + plugin.noPvpProtectManager.onBlockFromTo(event); + } + + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/EntityListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/EntityListener.java new file mode 100644 index 0000000..663a3c7 --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/EntityListener.java @@ -0,0 +1,60 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.listener; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityTameEvent; +import org.bukkit.event.entity.ExpBottleEvent; + +public class EntityListener implements Listener { + private PandacraftUtils plugin = PandacraftUtils.getInstance(); + + + + public EntityListener() + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onExpBottle(ExpBottleEvent event) { + plugin.entitySpamManager.onExpBottle(event); + } + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onEntityTame(EntityTameEvent event) { + plugin.tamedEntityProtectManager.onEntityTame(event); + } + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onEntityDamage(EntityDamageByEntityEvent event) { + plugin.tamedEntityProtectManager.onEntityDamage(event); + } + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/PlayerListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/PlayerListener.java new file mode 100644 index 0000000..8a2984a --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/PlayerListener.java @@ -0,0 +1,253 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.listener; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; +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.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.event.player.PlayerToggleSprintEvent; + +public class PlayerListener implements Listener { + private PandacraftUtils plugin = PandacraftUtils.getInstance(); + + + + public PlayerListener() + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.LOWEST) + public void onPlayerJoin_Lowest(PlayerJoinEvent event) { + OnlinePlayerManager.getInstance().onPlayerJoin(event); + } + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerJoin(PlayerJoinEvent event) { + plugin.loginLogoutMessageManager.onPlayerJoin(event); + plugin.staffQueueManager.onPlayerJoin(event); + } + + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerQuit(PlayerQuitEvent event) { + plugin.loginLogoutMessageManager.onPlayerQuit(event); + plugin.staffQueueManager.onPlayerQuit(event); + } + @EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST) + public void onPlayerQuit_Highest(PlayerQuitEvent event) { + OnlinePlayerManager.getInstance().onPlayerQuit(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.LOWEST) + public void onAsyncPlayerChat_Lowest(AsyncPlayerChatEvent event) { + plugin.calculatorManager.onAsyncPlayerChat(event); + } + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { + plugin.afkManager.onAsyncPlayerChat(event); + } + + @EventHandler(ignoreCancelled=true,priority=EventPriority.HIGH) + public void onAsyncPlayerChat_High_IgnoreCancelled(AsyncPlayerChatEvent event) { + plugin.chatAnalysisManager.onAsyncPlayerChat(event); + } + + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { + plugin.afkManager.onPlayerCommandPreprocess(event); + } + + @EventHandler(ignoreCancelled=false,priority=EventPriority.HIGHEST) + public void onPlayerCommandPreprocess_Highest (PlayerCommandPreprocessEvent event) { + plugin.commandAliasManager.onPlayerCommandPreprocess(event); + } + + @EventHandler(ignoreCancelled=true,priority=EventPriority.HIGHEST) + public void onPlayerCommandPreprocess_Highest_IgnoreCancelled (PlayerCommandPreprocessEvent event) { + plugin.chatAnalysisManager.onPlayerCommandPreprocess(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerMove (PlayerMoveEvent event) + { + plugin.afkManager.onPlayerMove(event); + plugin.creativCheatManager.onPlayerMove(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerInteract (PlayerInteractEvent event) + { + plugin.afkManager.onPlayerInteract(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerInteractEntity (PlayerInteractEntityEvent event) { + plugin.afkManager.onPlayerInteractEntity(event); + plugin.tamedEntityProtectManager.onPlayerInteractEntity(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerTeleport (PlayerTeleportEvent event) { + plugin.afkManager.onPlayerTeleport(event); + plugin.worldBorderManager.onPlayerTeleport(event); + } + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerToggleSprint (PlayerToggleSprintEvent event) + { + plugin.afkManager.onPlayerToggleSprint(event); + } + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerToggleFlight (PlayerToggleFlightEvent event) + { + plugin.afkManager.onPlayerToggleFlight(event); + } + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerToggleSneak (PlayerToggleSneakEvent event) + { + plugin.afkManager.onPlayerToggleSneak(event); + } + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerDropItem (PlayerDropItemEvent event) + { + plugin.afkManager.onPlayerDropItem(event); + } + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerEggThrow (PlayerEggThrowEvent event) + { + plugin.afkManager.onPlayerEggThrow(event); + } + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { + plugin.noPvpProtectManager.onPlayerBucketEmpty(event); + } + + + + + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/VehicleListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/VehicleListener.java new file mode 100644 index 0000000..ff27e94 --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/VehicleListener.java @@ -0,0 +1,46 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.listener; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.vehicle.VehicleCreateEvent; +import org.bukkit.event.vehicle.VehicleEnterEvent; + +public class VehicleListener implements Listener { + private PandacraftUtils plugin = PandacraftUtils.getInstance(); + + + + public VehicleListener() + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onVehicleCreate(VehicleCreateEvent event) { + plugin.entitySpamManager.onVehicleCreate(event); + } + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onVehicleEnter(VehicleEnterEvent event) { + plugin.tamedEntityProtectManager.onVehicleEnter(event); + } + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/XAuthListener.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/XAuthListener.java new file mode 100644 index 0000000..fda964d --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/listener/XAuthListener.java @@ -0,0 +1,37 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.listener; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +import de.luricos.bukkit.xAuth.events.xAuthLoginEvent; + +public class XAuthListener implements Listener { + private PandacraftUtils plugin = PandacraftUtils.getInstance(); + + + + public XAuthListener() + { + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + + + + + + + + + + @EventHandler(ignoreCancelled=false,priority=EventPriority.NORMAL) + public void onxAuthLogin(xAuthLoginEvent event) { + plugin.loginLogoutMessageManager.onxAuthLogin(event); + } + + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java index ebf011a..81104e1 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CalculatorManager.java @@ -9,25 +9,18 @@ import net.mc_pandacraft.java.util.JArithmeticInterpreter; import net.mc_pandacraft.java.util.StringUtil; import org.bukkit.ChatColor; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; -public class CalculatorManager implements Listener { +public class CalculatorManager { + @SuppressWarnings("unused") private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public CalculatorManager() { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } - - @EventHandler(priority=EventPriority.LOWEST) public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { String message = event.getMessage(); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CommandAliasManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CommandAliasManager.java index 7da6488..257ff96 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CommandAliasManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/CommandAliasManager.java @@ -8,23 +8,16 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.config.elements.CommandAlia import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer; 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.player.PlayerCommandPreprocessEvent; -public class CommandAliasManager implements Listener { +public class CommandAliasManager { + @SuppressWarnings("unused") private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public CommandAliasManager() { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - - - - } - - @EventHandler(priority=EventPriority.HIGHEST) + + + public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer()); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java index 6faa809..9d72c80 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/LoginLogoutMessageManager.java @@ -5,31 +5,22 @@ 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.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import de.luricos.bukkit.xAuth.events.xAuthLoginEvent; -public class LoginLogoutMessageManager implements Listener { +public class LoginLogoutMessageManager { private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public LoginLogoutMessageManager() { - - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } - - @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { event.setJoinMessage(null); } - @EventHandler public void onxAuthLogin(xAuthLoginEvent event) { if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; @@ -37,7 +28,7 @@ public class LoginLogoutMessageManager implements Listener { plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter"); } - @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { event.setQuitMessage(null); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/AfkManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/AfkManager.java index 41ae172..0bca39b 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/AfkManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/AfkManager.java @@ -10,8 +10,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -26,18 +24,14 @@ import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.scheduler.BukkitRunnable; -public class AfkManager extends BukkitRunnable implements Listener { +public class AfkManager extends BukkitRunnable { private PandacraftUtils plugin = PandacraftUtils.getInstance(); public AfkManager() { - plugin.getServer().getScheduler().runTaskTimer(plugin, this, 5*20L, 20L); - plugin.getServer().getPluginManager().registerEvents(this, plugin); - - } @@ -89,7 +83,6 @@ public class AfkManager extends BukkitRunnable implements Listener { // -------------- Evènements -------------- // ---------------------------------------- - @EventHandler public void onPlayerMove (PlayerMoveEvent event) { Location from = event.getFrom(); @@ -102,7 +95,6 @@ public class AfkManager extends BukkitRunnable implements Listener { } - @EventHandler public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { if (event.getPlayer().hasPermission("pandacraft.afk.exempt.commandcheck")) @@ -131,7 +123,6 @@ public class AfkManager extends BukkitRunnable implements Listener { OnlinePlayerManager.get(event.getPlayer()).isDoingAction(); } - @EventHandler public void onPlayerInteract (PlayerInteractEvent event) { /* @@ -146,7 +137,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onPlayerInteractEntity (PlayerInteractEntityEvent event) { try @@ -156,7 +146,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onPlayerTeleport (PlayerTeleportEvent event) { try @@ -171,7 +160,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onPlayerToggleSprint (PlayerToggleSprintEvent event) { try @@ -180,7 +168,6 @@ public class AfkManager extends BukkitRunnable implements Listener { } catch (NullPointerException e) { } } - @EventHandler public void onPlayerToggleFlight (PlayerToggleFlightEvent event) { try @@ -189,7 +176,6 @@ public class AfkManager extends BukkitRunnable implements Listener { } catch (NullPointerException e) { } } - @EventHandler public void onPlayerToggleSneak (PlayerToggleSneakEvent event) { try @@ -199,7 +185,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onAsyncPlayerChat (AsyncPlayerChatEvent event) { try @@ -209,7 +194,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onPlayerDropItem (PlayerDropItemEvent event) { try @@ -219,7 +203,6 @@ public class AfkManager extends BukkitRunnable implements Listener { catch (NullPointerException e) { } } - @EventHandler public void onPlayerEggThrow (PlayerEggThrowEvent event) { try diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/ChatAnalysisManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/ChatAnalysisManager.java index ec0821b..3b4a3f0 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/ChatAnalysisManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/ChatAnalysisManager.java @@ -6,8 +6,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; import org.bukkit.ChatColor; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; @@ -16,14 +14,12 @@ import org.bukkit.util.NumberConversions; public class ChatAnalysisManager implements Listener { + @SuppressWarnings("unused") private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public ChatAnalysisManager() - { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } - @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) + + public void onAsyncPlayerChat(AsyncPlayerChatEvent event) { try { @@ -71,7 +67,7 @@ public class ChatAnalysisManager implements Listener { } catch (NullPointerException e) { } } - @EventHandler(priority=EventPriority.HIGHEST) + public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) { try { diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java index 3962b45..621c7b1 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/player_control/JailsManager.java @@ -44,7 +44,7 @@ public class JailsManager { public void run() { updateDataFromEssentials(); } - }, 50); + }, 15); } diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/CreativCheatManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/CreativCheatManager.java index 052867a..271d4fc 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/CreativCheatManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/CreativCheatManager.java @@ -3,19 +3,13 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.modules.protection; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.util.bukkit.EntityStackUtil; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; public class CreativCheatManager implements Listener { private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public CreativCheatManager() - { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } - @EventHandler public void onPlayerMove (PlayerMoveEvent e) { if (e.getTo().getY() > -60.0) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/EntitySpamManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/EntitySpamManager.java index 073af30..686a7ce 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/EntitySpamManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/EntitySpamManager.java @@ -8,27 +8,21 @@ import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.entity.Vehicle; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.entity.ExpBottleEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager; -public class EntitySpamManager implements Listener { +public class EntitySpamManager { private PandacraftUtils plugin = PandacraftUtils.getInstance(); - public EntitySpamManager() { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } /* * Non pris en charge pour le moment - @EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) { } @@ -40,7 +34,6 @@ public class EntitySpamManager implements Listener { * si le chunk dans lequel il se trouve dépasse le nombre d'entité autorisé * @param event */ - @EventHandler public void onVehicleCreate(VehicleCreateEvent event) { Vehicle v = event.getVehicle(); Location l = v.getLocation(); @@ -63,7 +56,6 @@ public class EntitySpamManager implements Listener { } - @EventHandler public void onExpBottle(ExpBottleEvent event) { ThrownExpBottle b = event.getEntity(); if (!isInWorld(b.getLocation())) return; 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 b9831f4..5412038 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 @@ -10,8 +10,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; @@ -19,7 +17,7 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.player.PlayerBucketEmptyEvent; -public class NoPvpProtectManager implements Listener { +public class NoPvpProtectManager { private PandacraftUtils plugin = PandacraftUtils.getInstance(); @@ -28,11 +26,6 @@ public class NoPvpProtectManager implements Listener { private String last_logger_message = ""; - - public NoPvpProtectManager() - { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } @@ -52,7 +45,6 @@ public class NoPvpProtectManager implements Listener { - @EventHandler public void onBlockPlace(BlockPlaceEvent event) { if (event.getBlock().getWorld().getPVP()) @@ -105,7 +97,7 @@ public class NoPvpProtectManager implements Listener { } } - @EventHandler + public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { if (event.getBlockClicked().getWorld().getPVP()) return; @@ -144,7 +136,7 @@ public class NoPvpProtectManager implements Listener { } } - @EventHandler + public void onBlockIgnit(BlockIgniteEvent event) { if (event.getPlayer() == null) return; @@ -186,7 +178,7 @@ public class NoPvpProtectManager implements Listener { } } - @EventHandler + public void onBlockBreak(BlockBreakEvent event) { if (event.getBlock().getWorld().getPVP()) @@ -228,7 +220,7 @@ public class NoPvpProtectManager implements Listener { } - @EventHandler + public void onBlockFromTo(BlockFromToEvent event) { if (event.getBlock().getWorld().getPVP()) diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/TamedEntityProtectManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/TamedEntityProtectManager.java index 4f1af9f..6c7a9d8 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/TamedEntityProtectManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/TamedEntityProtectManager.java @@ -10,27 +10,18 @@ import org.bukkit.entity.Ocelot; import org.bukkit.entity.Player; import org.bukkit.entity.Tameable; import org.bukkit.entity.Wolf; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityTameEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; -public class TamedEntityProtectManager implements Listener { +public class TamedEntityProtectManager { + @SuppressWarnings("unused") private PandacraftUtils plugin = PandacraftUtils.getInstance(); - - public TamedEntityProtectManager() - { - - plugin.getServer().getPluginManager().registerEvents(this, plugin); - - } - @EventHandler public void onEntityTame(EntityTameEvent event) { if (event.getEntity().getWorld().getPVP()) return; @@ -46,7 +37,6 @@ public class TamedEntityProtectManager implements Listener { } - @EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getVehicle().getWorld().getPVP()) return; @@ -64,7 +54,6 @@ public class TamedEntityProtectManager implements Listener { } - @EventHandler public void onEntityDamage(EntityDamageByEntityEvent event) { if (event.getEntity().getWorld().getPVP()) return; @@ -82,7 +71,6 @@ public class TamedEntityProtectManager implements Listener { - @EventHandler public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.getPlayer().getWorld().getPVP()) return; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/WorldBorderManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/WorldBorderManager.java index cc930ec..e616d58 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/WorldBorderManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/protection/WorldBorderManager.java @@ -15,19 +15,17 @@ import net.mc_pandacraft.java.util.bukkit.protocol.ParticleEffect; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.scheduler.BukkitRunnable; -public class WorldBorderManager extends BukkitRunnable implements Listener { +public class WorldBorderManager extends BukkitRunnable { private PandacraftUtils plugin = PandacraftUtils.getInstance(); public WorldBorderManager() { - plugin.getServer().getScheduler().runTaskTimer(plugin, this, 2L, 20L); - plugin.getServer().getPluginManager().registerEvents(this, plugin); + plugin.getServer().getScheduler().runTaskTimer(plugin, this, 2L, 40L); } diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/staff/StaffQueueManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/staff/StaffQueueManager.java index a6f276b..f0414bd 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/staff/StaffQueueManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/staff/StaffQueueManager.java @@ -16,13 +16,11 @@ import org.bukkit.Location; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scoreboard.Scoreboard; -public class StaffQueueManager implements Listener { +public class StaffQueueManager { private PandacraftUtils plugin = PandacraftUtils.getInstance(); @@ -32,9 +30,6 @@ public class StaffQueueManager implements Listener { private Scoreboard scoreboardPlayerQueue = Bukkit.getScoreboardManager().getNewScoreboard(); - public StaffQueueManager() { - plugin.getServer().getPluginManager().registerEvents(this, plugin); - } // le joueur ajouté doit-être en ligne @@ -189,7 +184,6 @@ public class StaffQueueManager implements Listener { - @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player p = event.getPlayer(); if (OnlinePlayerManager.get(p).isInStaff()) @@ -200,7 +194,7 @@ public class StaffQueueManager implements Listener { } - @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { // on vérifie si un membre du staff se déconnecte diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java index 0d65d00..ce80d16 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/players/OnlinePlayerManager.java @@ -9,13 +9,10 @@ import java.util.Map; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -public final class OnlinePlayerManager implements Listener { +public final class OnlinePlayerManager { private static OnlinePlayerManager instance; @@ -46,7 +43,6 @@ public final class OnlinePlayerManager implements Listener { players.put(p, new OnlinePlayer(p)); - PandacraftUtils.getInstance().getServer().getPluginManager().registerEvents(this, PandacraftUtils.getInstance()); } @@ -57,13 +53,12 @@ public final class OnlinePlayerManager implements Listener { // ---------------------------------------- // -------------- Evènements -------------- // ---------------------------------------- - @EventHandler(priority=EventPriority.LOWEST) public void onPlayerJoin (PlayerJoinEvent event) { players.put(event.getPlayer(), new OnlinePlayer(event.getPlayer())); } - @EventHandler(priority=EventPriority.HIGHEST) + public void onPlayerQuit (PlayerQuitEvent event) { players.remove(event.getPlayer());