summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-06-10 18:33:07 +0100
committerKHobbits <rob@khobbits.co.uk>2012-06-10 18:33:07 +0100
commit9068c13e39ab64506af4cc1b2b04553dcd317f4e (patch)
treef3f47f3bda7c8b6f2b9b555efd2d294e255b84f7
parent024aff0af5a7b24dd540b0a3601d9d92a44c2687 (diff)
downloadEssentials-9068c13e39ab64506af4cc1b2b04553dcd317f4e.tar
Essentials-9068c13e39ab64506af4cc1b2b04553dcd317f4e.tar.gz
Essentials-9068c13e39ab64506af4cc1b2b04553dcd317f4e.tar.lz
Essentials-9068c13e39ab64506af4cc1b2b04553dcd317f4e.tar.xz
Essentials-9068c13e39ab64506af4cc1b2b04553dcd317f4e.zip
Play a bit less greedy with events
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java6
3 files changed, 9 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
index 3423da9d0..0c6bec0fe 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
@@ -17,7 +17,7 @@ public class EssentialsBlockListener implements Listener
this.ess = ess;
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBlockPlace(final BlockPlaceEvent event)
{
// Do not rely on getItemInHand();
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index 9b11f0a24..19cfde0f4 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -23,7 +23,7 @@ public class EssentialsEntityListener implements Listener
this.ess = ess;
}
- @EventHandler(priority = EventPriority.LOWEST)
+ @EventHandler(priority = EventPriority.LOW)
public void onEntityDamage(final EntityDamageByEntityEvent event)
{
final Entity eAttack = event.getDamager();
@@ -83,7 +83,7 @@ public class EssentialsEntityListener implements Listener
}
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityDamage(final EntityDamageEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -95,7 +95,7 @@ public class EssentialsEntityListener implements Listener
}
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityCombust(final EntityCombustEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -119,7 +119,7 @@ public class EssentialsEntityListener implements Listener
}
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onFoodLevelChange(final FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
@@ -128,7 +128,7 @@ public class EssentialsEntityListener implements Listener
}
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
index 728a419a9..a07c81e25 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java
@@ -35,11 +35,11 @@ public class Commanditemdb extends EssentialsCommand
itemStack = ess.getItemDb().get(args[0]);
}
sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData()));
-
- int maxuses = itemStack.getType().getMaxDurability();
- int durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
+
if (itemStack.getType() != Material.AIR)
{
+ int maxuses = itemStack.getType().getMaxDurability();
+ int durability = ((itemStack.getType().getMaxDurability() + 1) - itemStack.getDurability());
if (maxuses != 0)
{
sender.sendMessage(_("durability", Integer.toString(durability)));