Unification de tout les EventHandler

This commit is contained in:
Marc Baloup 2015-03-26 16:12:01 -04:00
parent 1cdd516011
commit b02dbe4d4d
21 changed files with 533 additions and 123 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-3.15.jar"/> <jar path="PandacraftUtils/jar_export/PandacraftUtils-4.0.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: 3.15 version: 4.0

View File

@ -5,6 +5,11 @@ import java.sql.SQLException;
import net.mc_pandacraft.java.plugin.pandacraftutils.commands.PandacraftUtilsCommandsManager; 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.config.ConfigManager;
import net.mc_pandacraft.java.plugin.pandacraftutils.data_model.SQLManager; 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.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;
@ -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.plugin.pandacraftutils.players.PlayerDataCleaner;
import net.mc_pandacraft.java.util.mysql.DBConnection; import net.mc_pandacraft.java.util.mysql.DBConnection;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -49,7 +55,10 @@ public class PandacraftUtils extends JavaPlugin {
private static ServerState serverState = ServerState.STOPPED; private static ServerState serverState = ServerState.STOPPED;
public static ServerState getServerState() { return serverState; } 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{ public enum ServerState{
STOPPED, STOPPED,
@ -134,6 +143,16 @@ public class PandacraftUtils extends JavaPlugin {
jailsManager = new JailsManager(); jailsManager = new JailsManager();
// chargement des écouteurs d'évènement
new BlockListener();
new EntityListener();
new PlayerListener();
new VehicleListener();
new XAuthListener();
NetworkAPI.loadNewInstance(); NetworkAPI.loadNewInstance();
getServer().getScheduler().runTaskLater(this, new Runnable() { getServer().getScheduler().runTaskLater(this, new Runnable() {

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -9,25 +9,18 @@ import net.mc_pandacraft.java.util.JArithmeticInterpreter;
import net.mc_pandacraft.java.util.StringUtil; import net.mc_pandacraft.java.util.StringUtil;
import org.bukkit.ChatColor; 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.AsyncPlayerChatEvent;
public class CalculatorManager implements Listener { public class CalculatorManager {
@SuppressWarnings("unused")
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public CalculatorManager() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority=EventPriority.LOWEST)
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
{ {
String message = event.getMessage(); String message = event.getMessage();

View File

@ -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.OnlinePlayer;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; 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; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandAliasManager implements Listener { public class CommandAliasManager {
@SuppressWarnings("unused")
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public CommandAliasManager() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
{ {
OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer()); OnlinePlayer op = OnlinePlayerManager.get(event.getPlayer());

View File

@ -5,31 +5,22 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager
import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface; import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.EssentialsInterface;
import org.bukkit.ChatColor; 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.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 implements Listener { public class LoginLogoutMessageManager {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public LoginLogoutMessageManager() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
event.setJoinMessage(null); event.setJoinMessage(null);
} }
@EventHandler
public void onxAuthLogin(xAuthLoginEvent event) { public void onxAuthLogin(xAuthLoginEvent event) {
if (EssentialsInterface.isPlayerVanished(event.getPlayer())) return; 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"); plugin.getServer().broadcastMessage(ChatColor.YELLOW+event.getPlayer().getDisplayName()+ChatColor.YELLOW+" vient de se connecter");
} }
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
event.setQuitMessage(null); event.setQuitMessage(null);

View File

@ -10,8 +10,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; 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.block.Action;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; 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.event.player.PlayerToggleSprintEvent;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
public class AfkManager extends BukkitRunnable implements Listener { public class AfkManager extends BukkitRunnable {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public AfkManager() public AfkManager()
{ {
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 5*20L, 20L); 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 -------------- // -------------- Evènements --------------
// ---------------------------------------- // ----------------------------------------
@EventHandler
public void onPlayerMove (PlayerMoveEvent event) public void onPlayerMove (PlayerMoveEvent event)
{ {
Location from = event.getFrom(); Location from = event.getFrom();
@ -102,7 +95,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
} }
@EventHandler
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
{ {
if (event.getPlayer().hasPermission("pandacraft.afk.exempt.commandcheck")) if (event.getPlayer().hasPermission("pandacraft.afk.exempt.commandcheck"))
@ -131,7 +123,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
OnlinePlayerManager.get(event.getPlayer()).isDoingAction(); OnlinePlayerManager.get(event.getPlayer()).isDoingAction();
} }
@EventHandler
public void onPlayerInteract (PlayerInteractEvent event) public void onPlayerInteract (PlayerInteractEvent event)
{ {
/* /*
@ -146,7 +137,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerInteractEntity (PlayerInteractEntityEvent event) public void onPlayerInteractEntity (PlayerInteractEntityEvent event)
{ {
try try
@ -156,7 +146,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerTeleport (PlayerTeleportEvent event) public void onPlayerTeleport (PlayerTeleportEvent event)
{ {
try try
@ -171,7 +160,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerToggleSprint (PlayerToggleSprintEvent event) public void onPlayerToggleSprint (PlayerToggleSprintEvent event)
{ {
try try
@ -180,7 +168,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
} }
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerToggleFlight (PlayerToggleFlightEvent event) public void onPlayerToggleFlight (PlayerToggleFlightEvent event)
{ {
try try
@ -189,7 +176,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
} }
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerToggleSneak (PlayerToggleSneakEvent event) public void onPlayerToggleSneak (PlayerToggleSneakEvent event)
{ {
try try
@ -199,7 +185,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onAsyncPlayerChat (AsyncPlayerChatEvent event) public void onAsyncPlayerChat (AsyncPlayerChatEvent event)
{ {
try try
@ -209,7 +194,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerDropItem (PlayerDropItemEvent event) public void onPlayerDropItem (PlayerDropItemEvent event)
{ {
try try
@ -219,7 +203,6 @@ public class AfkManager extends BukkitRunnable implements Listener {
catch (NullPointerException e) { } catch (NullPointerException e) { }
} }
@EventHandler
public void onPlayerEggThrow (PlayerEggThrowEvent event) public void onPlayerEggThrow (PlayerEggThrowEvent event)
{ {
try try

View File

@ -6,8 +6,6 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager; import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -16,14 +14,12 @@ import org.bukkit.util.NumberConversions;
public class ChatAnalysisManager implements Listener { public class ChatAnalysisManager implements Listener {
@SuppressWarnings("unused")
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public ChatAnalysisManager()
{
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true)
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
{ {
try { try {
@ -71,7 +67,7 @@ public class ChatAnalysisManager implements Listener {
} catch (NullPointerException e) { } } catch (NullPointerException e) { }
} }
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
{ {
try { try {

View File

@ -44,7 +44,7 @@ public class JailsManager {
public void run() { public void run() {
updateDataFromEssentials(); updateDataFromEssentials();
} }
}, 50); }, 15);
} }

View File

@ -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.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.util.bukkit.EntityStackUtil; import net.mc_pandacraft.java.util.bukkit.EntityStackUtil;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
public class CreativCheatManager implements Listener { public class CreativCheatManager implements Listener {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public CreativCheatManager()
{
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPlayerMove (PlayerMoveEvent e) public void onPlayerMove (PlayerMoveEvent e)
{ {
if (e.getTo().getY() > -60.0) if (e.getTo().getY() > -60.0)

View File

@ -8,27 +8,21 @@ import org.bukkit.World;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.ThrownExpBottle; import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.entity.Vehicle; 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.entity.ExpBottleEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleCreateEvent;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager; import net.mc_pandacraft.java.plugin.pandacraftutils.config.ConfigManager;
public class EntitySpamManager implements Listener { public class EntitySpamManager {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public EntitySpamManager() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
/* /*
* Non pris en charge pour le moment * Non pris en charge pour le moment
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) { 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é * si le chunk dans lequel il se trouve dépasse le nombre d'entité autorisé
* @param event * @param event
*/ */
@EventHandler
public void onVehicleCreate(VehicleCreateEvent event) { public void onVehicleCreate(VehicleCreateEvent event) {
Vehicle v = event.getVehicle(); Vehicle v = event.getVehicle();
Location l = v.getLocation(); Location l = v.getLocation();
@ -63,7 +56,6 @@ public class EntitySpamManager implements Listener {
} }
@EventHandler
public void onExpBottle(ExpBottleEvent event) { public void onExpBottle(ExpBottleEvent event) {
ThrownExpBottle b = event.getEntity(); ThrownExpBottle b = event.getEntity();
if (!isInWorld(b.getLocation())) return; if (!isInWorld(b.getLocation())) return;

View File

@ -10,8 +10,6 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; 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.BlockBreakEvent;
import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent; 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.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
public class NoPvpProtectManager implements Listener { public class NoPvpProtectManager {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
@ -28,11 +26,6 @@ public class NoPvpProtectManager implements Listener {
private String last_logger_message = ""; 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) public void onBlockPlace(BlockPlaceEvent event)
{ {
if (event.getBlock().getWorld().getPVP()) if (event.getBlock().getWorld().getPVP())
@ -105,7 +97,7 @@ public class NoPvpProtectManager implements Listener {
} }
} }
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
if (event.getBlockClicked().getWorld().getPVP()) if (event.getBlockClicked().getWorld().getPVP())
return; return;
@ -144,7 +136,7 @@ public class NoPvpProtectManager implements Listener {
} }
} }
@EventHandler
public void onBlockIgnit(BlockIgniteEvent event) { public void onBlockIgnit(BlockIgniteEvent event) {
if (event.getPlayer() == null) if (event.getPlayer() == null)
return; return;
@ -186,7 +178,7 @@ public class NoPvpProtectManager implements Listener {
} }
} }
@EventHandler
public void onBlockBreak(BlockBreakEvent event) public void onBlockBreak(BlockBreakEvent event)
{ {
if (event.getBlock().getWorld().getPVP()) if (event.getBlock().getWorld().getPVP())
@ -228,7 +220,7 @@ public class NoPvpProtectManager implements Listener {
} }
@EventHandler
public void onBlockFromTo(BlockFromToEvent event) public void onBlockFromTo(BlockFromToEvent event)
{ {
if (event.getBlock().getWorld().getPVP()) if (event.getBlock().getWorld().getPVP())

View File

@ -10,27 +10,18 @@ import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.entity.Wolf; 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.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityTameEvent; import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEnterEvent;
public class TamedEntityProtectManager implements Listener { public class TamedEntityProtectManager {
@SuppressWarnings("unused")
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public TamedEntityProtectManager()
{
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onEntityTame(EntityTameEvent event) { public void onEntityTame(EntityTameEvent event) {
if (event.getEntity().getWorld().getPVP()) return; if (event.getEntity().getWorld().getPVP()) return;
@ -46,7 +37,6 @@ public class TamedEntityProtectManager implements Listener {
} }
@EventHandler
public void onVehicleEnter(VehicleEnterEvent event) { public void onVehicleEnter(VehicleEnterEvent event) {
if (event.getVehicle().getWorld().getPVP()) return; if (event.getVehicle().getWorld().getPVP()) return;
@ -64,7 +54,6 @@ public class TamedEntityProtectManager implements Listener {
} }
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) { public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getEntity().getWorld().getPVP()) return; if (event.getEntity().getWorld().getPVP()) return;
@ -82,7 +71,6 @@ public class TamedEntityProtectManager implements Listener {
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.getPlayer().getWorld().getPVP()) return; if (event.getPlayer().getWorld().getPVP()) return;

View File

@ -15,19 +15,17 @@ import net.mc_pandacraft.java.util.bukkit.protocol.ParticleEffect;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
public class WorldBorderManager extends BukkitRunnable implements Listener { public class WorldBorderManager extends BukkitRunnable {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
public WorldBorderManager() public WorldBorderManager()
{ {
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 2L, 20L); plugin.getServer().getScheduler().runTaskTimer(plugin, this, 2L, 40L);
plugin.getServer().getPluginManager().registerEvents(this, plugin);
} }

View File

@ -16,13 +16,11 @@ import org.bukkit.Location;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; 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.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
public class StaffQueueManager implements Listener { public class StaffQueueManager {
private PandacraftUtils plugin = PandacraftUtils.getInstance(); private PandacraftUtils plugin = PandacraftUtils.getInstance();
@ -32,9 +30,6 @@ public class StaffQueueManager implements Listener {
private Scoreboard scoreboardPlayerQueue = Bukkit.getScoreboardManager().getNewScoreboard(); private Scoreboard scoreboardPlayerQueue = Bukkit.getScoreboardManager().getNewScoreboard();
public StaffQueueManager() {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
// le joueur ajouté doit-être en ligne // le joueur ajouté doit-être en ligne
@ -189,7 +184,6 @@ public class StaffQueueManager implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player p = event.getPlayer(); Player p = event.getPlayer();
if (OnlinePlayerManager.get(p).isInStaff()) if (OnlinePlayerManager.get(p).isInStaff())
@ -200,7 +194,7 @@ public class StaffQueueManager implements Listener {
} }
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
// on vérifie si un membre du staff se déconnecte // on vérifie si un membre du staff se déconnecte

View File

@ -9,13 +9,10 @@ import java.util.Map;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import org.bukkit.entity.Player; 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.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
public final class OnlinePlayerManager implements Listener { public final class OnlinePlayerManager {
private static OnlinePlayerManager instance; private static OnlinePlayerManager instance;
@ -46,7 +43,6 @@ public final class OnlinePlayerManager implements Listener {
players.put(p, new OnlinePlayer(p)); 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 -------------- // -------------- Evènements --------------
// ---------------------------------------- // ----------------------------------------
@EventHandler(priority=EventPriority.LOWEST)
public void onPlayerJoin (PlayerJoinEvent event) public void onPlayerJoin (PlayerJoinEvent event)
{ {
players.put(event.getPlayer(), new OnlinePlayer(event.getPlayer())); players.put(event.getPlayer(), new OnlinePlayer(event.getPlayer()));
} }
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerQuit (PlayerQuitEvent event) public void onPlayerQuit (PlayerQuitEvent event)
{ {
players.remove(event.getPlayer()); players.remove(event.getPlayer());