summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java74
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java45
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java50
-rw-r--r--Essentials/src/com/earth2me/essentials/TNTExplodeListener.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java25
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java25
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java12
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java25
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java6
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java5
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java5
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java3
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java3
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java2
-rw-r--r--EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java8
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java36
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java22
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java58
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java16
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java12
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java22
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java17
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java8
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java12
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java4
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java12
33 files changed, 320 insertions, 312 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 5287e299b..c0c72abca 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -24,7 +24,6 @@ import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.commands.NoChargeException;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
-import com.earth2me.essentials.craftbukkit.ItemDupeFix;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import com.earth2me.essentials.signs.SignBlockListener;
@@ -45,11 +44,10 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+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.PlayerListener;
-import org.bukkit.event.world.WorldListener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.InvalidDescriptionException;
@@ -63,7 +61,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
- public static final int BUKKIT_VERSION = 1713;
+ public static final int BUKKIT_VERSION = 1791;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@@ -181,14 +179,14 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.SEVERE, _("essentialsHelp1"));
}
LOGGER.log(Level.SEVERE, exception.toString());
- pm.registerEvent(Type.PLAYER_JOIN, new PlayerListener()
+ pm.registerEvents(new Listener()
{
- @Override
- public void onPlayerJoin(PlayerJoinEvent event)
+ @EventHandler(priority = EventPriority.LOW)
+ public void onPlayerJoin(final PlayerJoinEvent event)
{
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
}
- }, Priority.Low, this);
+ }, this);
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials failed to load, read the log file.");
@@ -200,61 +198,35 @@ public class Essentials extends JavaPlugin implements IEssentials
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
- pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
- pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
+ pm.registerEvents(serverListener, this);
confList.add(serverListener);
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
- pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
- pm.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
- pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Lowest, this);
- pm.registerEvent(Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this);
- pm.registerEvent(Type.PLAYER_MOVE, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_LOGIN, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
- pm.registerEvent(Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Normal, this);
- pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Monitor, this);
- pm.registerEvent(Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Low, this);
- pm.registerEvent(Type.PLAYER_TELEPORT, new ItemDupeFix(), Priority.Monitor, this);
+ pm.registerEvents(playerListener, this);
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
- pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
+ pm.registerEvents(blockListener, this);
final SignBlockListener signBlockListener = new SignBlockListener(this);
- pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Highest, this);
- pm.registerEvent(Type.BLOCK_PLACE, signBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Highest, this);
- pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_PISTON_EXTEND, signBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_PISTON_RETRACT, signBlockListener, Priority.Low, this);
+ pm.registerEvents(signBlockListener, this);
final SignPlayerListener signPlayerListener = new SignPlayerListener(this);
- pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this);
+ pm.registerEvents(signPlayerListener, this);
final SignEntityListener signEntityListener = new SignEntityListener(this);
- pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this);
- pm.registerEvent(Type.ENDERMAN_PICKUP, signEntityListener, Priority.Low, this);
+ pm.registerEvents(signEntityListener, this);
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
- pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
- pm.registerEvent(Type.ENTITY_COMBUST, entityListener, Priority.Lowest, this);
- pm.registerEvent(Type.ENTITY_DEATH, entityListener, Priority.Lowest, this);
- pm.registerEvent(Type.ENTITY_REGAIN_HEALTH, entityListener, Priority.Lowest, this);
- pm.registerEvent(Type.FOOD_LEVEL_CHANGE, entityListener, Priority.Lowest, this);
+ pm.registerEvents(entityListener, this);
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
- pm.registerEvent(Type.WORLD_LOAD, worldListener, Priority.Monitor, this);
- pm.registerEvent(Type.WORLD_UNLOAD, worldListener, Priority.Monitor, this);
+ pm.registerEvents(worldListener, this);
//TODO: Check if this should be here, and not above before reload()
jails = new Jails(this);
confList.add(jails);
- pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
+ pm.registerEvents(tntListener, this);
final EssentialsTimer timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
@@ -602,17 +574,17 @@ public class Essentials extends JavaPlugin implements IEssentials
return i18n;
}
- private static class EssentialsWorldListener extends WorldListener implements Runnable {
+ private static class EssentialsWorldListener implements Listener, Runnable {
private transient final IEssentials ess;
- public EssentialsWorldListener(IEssentials ess)
+ public EssentialsWorldListener(final IEssentials ess)
{
this.ess = ess;
}
- @Override
- public void onWorldLoad(WorldLoadEvent event)
+ @EventHandler(priority = EventPriority.LOW)
+ public void onWorldLoad(final WorldLoadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();
@@ -624,8 +596,8 @@ public class Essentials extends JavaPlugin implements IEssentials
}
}
- @Override
- public void onWorldUnload(WorldUnloadEvent event)
+ @EventHandler(priority = EventPriority.LOW)
+ public void onWorldUnload(final WorldUnloadEvent event)
{
ess.getJails().onReload();
ess.getWarps().reloadConfig();
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
index ceda6a60c..648bfcef5 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
@@ -1,25 +1,24 @@
package com.earth2me.essentials;
-import java.util.logging.Logger;
import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.event.block.BlockListener;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-public class EssentialsBlockListener extends BlockListener
+public class EssentialsBlockListener implements Listener
{
- private final IEssentials ess;
- private static final Logger logger = Logger.getLogger("Minecraft");
+ private final transient IEssentials ess;
- public EssentialsBlockListener(IEssentials ess)
+ public EssentialsBlockListener(final IEssentials ess)
{
this.ess = ess;
}
- @Override
- public void onBlockPlace(BlockPlaceEvent event)
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
{
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index 214fc8c01..e4879186d 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -2,19 +2,20 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.List;
-import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.*;
import org.bukkit.inventory.ItemStack;
-public class EssentialsEntityListener extends EntityListener
+public class EssentialsEntityListener implements Listener
{
- private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final IEssentials ess;
public EssentialsEntityListener(IEssentials ess)
@@ -22,7 +23,7 @@ public class EssentialsEntityListener extends EntityListener
this.ess = ess;
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent event)
{
if (event instanceof EntityDamageByEntityEvent)
@@ -55,7 +56,8 @@ public class EssentialsEntityListener extends EntityListener
{
User player = ess.getUser(eAttack);
ItemStack hand = player.getItemInHand();
- if (hand != null && hand.getType() == Material.MILK_BUCKET) {
+ if (hand != null && hand.getType() == Material.MILK_BUCKET)
+ {
((Animals)eDefend).setAge(-24000);
hand.setType(Material.BUCKET);
player.setItemInHand(hand);
@@ -73,7 +75,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onEntityCombust(EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -82,7 +84,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onEntityDeath(final EntityDeathEvent event)
{
if (event instanceof PlayerDeathEvent)
@@ -101,7 +103,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onFoodLevelChange(FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -110,7 +112,7 @@ public class EssentialsEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onEntityRegainHealth(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index b6cb728d2..8e151c3e9 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -1,7 +1,6 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.craftbukkit.SetBed;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
@@ -17,15 +16,17 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.*;
-import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
-public class EssentialsPlayerListener extends PlayerListener
+public class EssentialsPlayerListener implements Listener
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient Server server;
@@ -37,7 +38,7 @@ public class EssentialsPlayerListener extends PlayerListener
this.server = parent.getServer();
}
- @Override
+ @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -48,7 +49,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -74,7 +75,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerMove(final PlayerMoveEvent event)
{
if (event.isCancelled())
@@ -108,7 +109,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -125,7 +126,7 @@ public class EssentialsPlayerListener extends PlayerListener
user.dispose();
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
ess.getBackup().onPlayerJoin();
@@ -178,7 +179,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerLogin(final PlayerLoginEvent event)
{
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
@@ -224,8 +225,8 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
- public void onPlayerTeleport(PlayerTeleportEvent event)
+ @EventHandler(priority = EventPriority.HIGH)
+ public void onPlayerTeleport(final PlayerTeleportEvent event)
{
if (event.isCancelled())
{
@@ -246,19 +247,19 @@ public class EssentialsPlayerListener extends PlayerListener
updateCompass(user);
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerEggThrow(final PlayerEggThrowEvent event)
{
final User user = ess.getUser(event.getPlayer());
- final ItemStack is = new ItemStack(Material.EGG, 1);
- if (user.hasUnlimited(is))
+ final ItemStack stack = new ItemStack(Material.EGG, 1);
+ if (user.hasUnlimited(stack))
{
- user.getInventory().addItem(is);
+ user.getInventory().addItem(stack);
user.updateInventory();
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -276,7 +277,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerAnimation(final PlayerAnimationEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -321,7 +322,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
{
if (event.isCancelled())
@@ -348,7 +349,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
{
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
@@ -361,7 +362,7 @@ public class EssentialsPlayerListener extends PlayerListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled())
@@ -375,11 +376,11 @@ public class EssentialsPlayerListener extends PlayerListener
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
{
- SetBed.setBed(event.getPlayer(), event.getClickedBlock());
+ event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onPlayerPickupItem(PlayerPickupItemEvent event)
{
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
index b0ee0b543..11f42e701 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
@@ -1,34 +1,34 @@
package com.earth2me.essentials;
import java.util.logging.Level;
-import java.util.logging.Logger;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
-import org.bukkit.event.server.ServerListener;
-public class EssentialsPluginListener extends ServerListener implements IConf
+public class EssentialsPluginListener implements Listener, IConf
{
private final transient IEssentials ess;
- private static final Logger LOGGER = Logger.getLogger("Minecraft");
-
+
public EssentialsPluginListener(final IEssentials ess)
{
this.ess = ess;
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(final PluginEnableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin());
if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager()))
{
- LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
+ ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")");
}
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPluginDisable(final PluginDisableEvent event)
{
ess.getPermissionsHandler().checkPermissions();
@@ -37,7 +37,7 @@ public class EssentialsPluginListener extends ServerListener implements IConf
if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin()))
{
ess.getPaymentMethod().reset();
- LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
+ ess.getLogger().log(Level.INFO, "Payment method was disabled. No longer accepting payments.");
}
}
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 19c105300..69b4b0d48 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -149,9 +149,9 @@ public interface ISettings extends IConf
boolean registerBackInListener();
- public boolean getDisableItemPickupWhileAfk();
+ boolean getDisableItemPickupWhileAfk();
- public Priority getRespawnPriority();
+ Priority getRespawnPriority();
long getTpaAcceptCancellation();
}
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index 097c4c883..fa0be02c7 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -3,10 +3,7 @@ package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
+import java.util.*;
import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
@@ -740,12 +737,6 @@ public class OfflinePlayer implements Player
}
@Override
- public Location getBedSpawnLocation()
- {
- return OfflineBedLocation.getBedLocation(base.getName(), ess);
- }
-
- @Override
public boolean isSprinting()
{
throw new UnsupportedOperationException("Not supported yet.");
@@ -825,8 +816,45 @@ public class OfflinePlayer implements Player
void setName(final String name)
{
- if (!this.base.getName().equalsIgnoreCase(name)) {
+ if (!this.base.getName().equalsIgnoreCase(name))
+ {
this.base = ess.getServer().getOfflinePlayer(name);
}
}
+
+ @Override
+ public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Set<String> getListeningPluginChannels()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setAllowFlight(boolean bln)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean getAllowFlight()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setBedSpawnLocation(Location lctn)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void playEffect(EntityEffect ee)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
index 4ae259a32..54e49ad5f 100644
--- a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
+++ b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
@@ -2,11 +2,13 @@ package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.FakeExplosion;
import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityListener;
-public class TNTExplodeListener extends EntityListener implements Runnable
+public class TNTExplodeListener implements Listener, Runnable
{
private final transient IEssentials ess;
private transient boolean enabled = false;
@@ -33,7 +35,7 @@ public class TNTExplodeListener extends EntityListener implements Runnable
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
if (!enabled)
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
index bd4d09111..e78e508f7 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
@@ -1,7 +1,9 @@
package com.earth2me.essentials.craftbukkit;
import java.io.File;
+import java.util.Collection;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.bukkit.*;
import org.bukkit.block.Biome;
@@ -10,6 +12,7 @@ import org.bukkit.entity.*;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
@@ -521,4 +524,28 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public <T extends Entity> Collection<T> getEntitiesByClass(Class<T>... types)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public WorldType getWorldType()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Set<String> getListeningPluginChannels()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java
deleted file mode 100644
index 243049e0a..000000000
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/ItemDupeFix.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.earth2me.essentials.craftbukkit;
-
-import net.minecraft.server.EntityPlayer;
-import org.bukkit.craftbukkit.entity.CraftPlayer;
-import org.bukkit.event.player.PlayerListener;
-import org.bukkit.event.player.PlayerTeleportEvent;
-
-
-public class ItemDupeFix extends PlayerListener
-{
- @Override
- public void onPlayerTeleport(final PlayerTeleportEvent event)
- {
- if (event.isCancelled())
- {
- return;
- }
- final CraftPlayer player = (CraftPlayer)event.getPlayer();
- final EntityPlayer entity = player.getHandle();
- if (entity.activeContainer != entity.defaultContainer)
- {
- entity.closeInventory();
- }
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java
deleted file mode 100644
index 331d14139..000000000
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/SetBed.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.earth2me.essentials.craftbukkit;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.minecraft.server.ChunkCoordinates;
-import org.bukkit.block.Block;
-import org.bukkit.craftbukkit.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-
-public class SetBed
-{
- public static void setBed(final Player player, final Block block)
- {
- try
- {
- final CraftPlayer cplayer = (CraftPlayer)player;
- cplayer.getHandle().a(new ChunkCoordinates(block.getX(), block.getY(), block.getZ()));
- }
- catch (Throwable ex)
- {
- Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
- }
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index 2840df298..913de6358 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -8,10 +8,13 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
-public class SignBlockListener extends BlockListener
+public class SignBlockListener implements Listener
{
private final transient IEssentials ess;
private final static Logger LOGGER = Logger.getLogger("Minecraft");
@@ -21,7 +24,7 @@ public class SignBlockListener extends BlockListener
this.ess = ess;
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -73,7 +76,7 @@ public class SignBlockListener extends BlockListener
return false;
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onSignChange(final SignChangeEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -105,7 +108,7 @@ public class SignBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -139,7 +142,7 @@ public class SignBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockBurn(final BlockBurnEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -168,7 +171,7 @@ public class SignBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockIgnite(final BlockIgniteEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
@@ -197,7 +200,7 @@ public class SignBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockPistonExtend(final BlockPistonExtendEvent event)
{
for (Block block : event.getBlocks())
@@ -223,7 +226,7 @@ public class SignBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockPistonRetract(final BlockPistonRetractEvent event)
{
if (event.isSticky())
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
index 09bdbeea5..281afdc98 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
@@ -3,12 +3,14 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.entity.EndermanPickupEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityListener;
-public class SignEntityListener extends EntityListener
+public class SignEntityListener implements Listener
{
private final transient IEssentials ess;
@@ -17,7 +19,7 @@ public class SignEntityListener extends EntityListener
this.ess = ess;
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onEntityExplode(final EntityExplodeEvent event)
{
for (Block block : event.blockList())
@@ -42,8 +44,8 @@ public class SignEntityListener extends EntityListener
}
}
- @Override
- public void onEndermanPickup(EndermanPickupEvent event)
+ @EventHandler(priority = EventPriority.LOW)
+ public void onEndermanPickup(final EndermanPickupEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
index 5d7900508..f1ba79b0b 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
@@ -4,22 +4,24 @@ import com.earth2me.essentials.IEssentials;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerListener;
-public class SignPlayerListener extends PlayerListener
+public class SignPlayerListener implements Listener
{
private final transient IEssentials ess;
- public SignPlayerListener(IEssentials ess)
+ public SignPlayerListener(final IEssentials ess)
{
this.ess = ess;
}
- @Override
- public void onPlayerInteract(PlayerInteractEvent event)
+ @EventHandler(priority = EventPriority.LOW)
+ public void onPlayerInteract(final PlayerInteractEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 306f0d6a1..b5ecc1e08 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -19,6 +19,7 @@ import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager;
+import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scheduler.BukkitWorker;
@@ -549,6 +550,12 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public Location getBedSpawnLocation()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
};
}
@@ -623,4 +630,22 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public Messenger getMessenger()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void sendPluginMessage(Plugin plugin, String string, byte[] bytes)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Set<String> getListeningPluginChannels()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index de0d14421..a81525f83 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -41,9 +41,9 @@ public class EssentialsChat extends JavaPlugin
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener, chatStore);
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatListener, chatStore);
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatListener, chatStore);
- pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerLowest, Priority.Lowest, this);
- pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerNormal, Priority.Normal, this);
- pluginManager.registerEvent(Type.PLAYER_CHAT, playerListenerHighest, Priority.Highest, this);
+ pluginManager.registerEvents(playerListenerLowest, this);
+ pluginManager.registerEvents(playerListenerNormal, this);
+ pluginManager.registerEvents(playerListenerHighest, this);
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index 30abe9cf8..e19f0122f 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -10,13 +10,12 @@ import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
-import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
-import org.bukkit.event.player.PlayerListener;
//TODO: Translate the local/spy tags
-public abstract class EssentialsChatPlayer extends PlayerListener
+public abstract class EssentialsChatPlayer implements Listener
{
protected transient IEssentials ess;
protected final static Logger logger = Logger.getLogger("Minecraft");
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
index 35c140f6b..e8f785228 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerHighest.java
@@ -1,10 +1,10 @@
package com.earth2me.essentials.chat;
-import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.User;
import java.util.Map;
import org.bukkit.Server;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
@@ -18,6 +18,7 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
super(server, ess, listeners, chatStorage);
}
+ @EventHandler(priority = EventPriority.HIGHEST)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
index 32e60d75d..5a8cde62d 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -6,6 +6,8 @@ import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
@@ -19,6 +21,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
super(server, ess, listeners, chatStorage);
}
+ @EventHandler(priority = EventPriority.LOWEST)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
index 16ebe8e7e..0c1661ce5 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerNormal.java
@@ -6,6 +6,8 @@ import com.earth2me.essentials.User;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChatEvent;
@@ -19,6 +21,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
super(server, ess, listeners, chatStorage);
}
+ @EventHandler(priority = EventPriority.NORMAL)
@Override
public void onPlayerChat(final PlayerChatEvent event)
{
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
index e0ca6cd7c..5700a7472 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java
@@ -37,7 +37,7 @@ public class EssentialsGeoIP extends JavaPlugin
return;
}
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
- pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
+ pm.registerEvents(playerListener, this);
logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
index ee187c2aa..0018d09b4 100644
--- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
+++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java
@@ -17,11 +17,13 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;
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.PlayerListener;
-public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf
+public class EssentialsGeoIPPlayerListener implements Listener, IConf
{
LookupService ls = null;
private static final Logger logger = Logger.getLogger("Minecraft");
@@ -39,7 +41,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo
reloadConfig();
}
- @Override
+ @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
User u = ess.getUser(event.getPlayer());
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
deleted file mode 100644
index 479d2eda6..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockBurnEvent;
-import org.bukkit.event.block.BlockFromToEvent;
-import org.bukkit.event.block.BlockIgniteEvent;
-import org.bukkit.event.block.BlockListener;
-
-
-public class EmergencyBlockListener extends BlockListener
-{
-
- @Override
- public void onBlockBurn(final BlockBurnEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockIgnite(final BlockIgniteEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockFromTo(final BlockFromToEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockBreak(final BlockBreakEvent event)
- {
- event.setCancelled(true);
- }
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
deleted file mode 100644
index a220f07d5..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityListener;
-
-
-public class EmergencyEntityListener extends EntityListener
-{
-
- @Override
- public void onEntityExplode(final EntityExplodeEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onEntityDamage(final EntityDamageEvent event)
- {
- event.setCancelled(true);
- }
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java
new file mode 100644
index 000000000..5f9253c55
--- /dev/null
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java
@@ -0,0 +1,58 @@
+package com.earth2me.essentials.protect;
+
+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.BlockBurnEvent;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.BlockIgniteEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+
+
+public class EmergencyListener implements Listener
+{
+ @EventHandler(priority = EventPriority.LOW)
+ public void onBlockBurn(final BlockBurnEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onBlockIgnite(final BlockIgniteEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onBlockFromTo(final BlockFromToEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onBlockBreak(final BlockBreakEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onPlayerJoin(final PlayerJoinEvent event)
+ {
+ event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onEntityExplode(final EntityExplodeEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOW)
+ public void onEntityDamage(final EntityDamageEvent event)
+ {
+ event.setCancelled(true);
+ }
+}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
deleted file mode 100644
index e92325946..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
-
-
-public class EmergencyPlayerListener extends PlayerListener
-{
-
- @Override
- public void onPlayerJoin(PlayerJoinEvent event)
- {
- event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
- }
-
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index e313298cd..095296531 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -78,16 +78,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
private void enableEmergencyMode(final PluginManager pm)
{
- final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
- final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
- final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
- pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
- pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
+ final EmergencyListener emListener = new EmergencyListener();
+ pm.registerEvents(emListener, this);
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
index a1d16af25..c193561db 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java
@@ -9,10 +9,13 @@ import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
-public class EssentialsProtectBlockListener extends BlockListener
+public class EssentialsProtectBlockListener implements Listener
{
final private transient IProtect prot;
final private transient IEssentials ess;
@@ -23,7 +26,7 @@ public class EssentialsProtectBlockListener extends BlockListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(final BlockPlaceEvent event)
{
if (event.isCancelled())
@@ -93,7 +96,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockIgnite(BlockIgniteEvent event)
{
if (event.isCancelled())
@@ -144,7 +147,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockFromTo(final BlockFromToEvent event)
{
if (event.isCancelled())
@@ -185,7 +188,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBurn(final BlockBurnEvent event)
{
if (event.isCancelled())
@@ -221,7 +224,7 @@ public class EssentialsProtectBlockListener extends BlockListener
BlockFace.SELF
};
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(final BlockBreakEvent event)
{
if (event.isCancelled())
@@ -319,7 +322,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPistonExtend(BlockPistonExtendEvent event)
{
if (event.isCancelled())
@@ -372,7 +375,7 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPistonRetract(BlockPistonRetractEvent event)
{
if (event.isCancelled() || !event.isSticky())
@@ -460,7 +463,8 @@ public class EssentialsProtectBlockListener extends BlockListener
}
}
}
- if (prot.getSettingBool(ProtectConfig.protect_rails)) {
+ if (prot.getSettingBool(ProtectConfig.protect_rails))
+ {
if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
{
return prot.getStorage().isProtected(block, user.getName());
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 89167b2b9..40167ec41 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -8,12 +8,15 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.*;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
import org.bukkit.event.entity.*;
-public class EssentialsProtectEntityListener extends EntityListener
+public class EssentialsProtectEntityListener implements Listener
{
private final transient IProtect prot;
private final transient IEssentials ess;
@@ -24,7 +27,7 @@ public class EssentialsProtectEntityListener extends EntityListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.isCancelled())
@@ -189,7 +192,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onEntityExplode(final EntityExplodeEvent event)
{
if (event.isCancelled())
@@ -261,7 +264,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onCreatureSpawn(final CreatureSpawnEvent event)
{
if (event.getEntity() instanceof Player)
@@ -288,7 +291,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onEntityTarget(final EntityTargetEvent event)
{
if (event.isCancelled())
@@ -314,7 +317,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onExplosionPrime(ExplosionPrimeEvent event)
{
if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball)
@@ -324,7 +327,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onEndermanPickup(EndermanPickupEvent event)
{
if (event.isCancelled())
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
index ad7831a53..6b49e70d8 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java
@@ -5,13 +5,15 @@ import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
-public class EssentialsProtectPlayerListener extends PlayerListener
+public class EssentialsProtectPlayerListener implements Listener
{
private final transient IProtect prot;
private final transient IEssentials ess;
@@ -22,7 +24,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
this.ess = prot.getEssentialsConnect().getEssentials();
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(final PlayerInteractEvent event)
{
// Do not return if cancelled, because the interact event has 2 cancelled states.
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java
index e81efc72b..1b8dd19ff 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java
@@ -1,12 +1,14 @@
package com.earth2me.essentials.protect;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
-import org.bukkit.event.weather.WeatherListener;
-public class EssentialsProtectWeatherListener extends WeatherListener
+public class EssentialsProtectWeatherListener implements Listener
{
private final transient IProtect prot;
@@ -15,7 +17,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
this.prot = prot;
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onWeatherChange(final WeatherChangeEvent event)
{
if (!event.isCancelled()
@@ -27,7 +29,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onLightningStrike(final LightningStrikeEvent event)
{
if (!event.isCancelled()
@@ -37,7 +39,7 @@ public class EssentialsProtectWeatherListener extends WeatherListener
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onThunderChange(final ThunderChangeEvent event)
{
if (!event.isCancelled()
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
index bcbbfa17d..65925c00a 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java
@@ -47,9 +47,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
}
final EssentialsXMPPPlayerListener playerListener = new EssentialsXMPPPlayerListener(ess);
- pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
- pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Monitor, this);
- pluginManager.registerEvent(Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
+ pluginManager.registerEvents(playerListener, this);
users = new UserManager(this.getDataFolder());
xmpp = new XMPPManager(this);
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
index 47966aee0..1fa5a243c 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java
@@ -2,13 +2,15 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
-class EssentialsXMPPPlayerListener extends PlayerListener
+class EssentialsXMPPPlayerListener implements Listener
{
private final transient IEssentials ess;
@@ -18,21 +20,21 @@ class EssentialsXMPPPlayerListener extends PlayerListener
this.ess = ess;
}
- @Override
+ @EventHandler(priority= EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game");
}
- @Override
+ @EventHandler(priority= EventPriority.MONITOR)
public void onPlayerChat(final PlayerChatEvent event)
{
final User user = ess.getUser(event.getPlayer());
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
}
- @Override
+ @EventHandler(priority= EventPriority.MONITOR)
public void onPlayerQuit(final PlayerQuitEvent event)
{
final User user = ess.getUser(event.getPlayer());