Play a bit less greedy with events

This commit is contained in:
KHobbits 2012-06-10 18:33:07 +01:00
parent 024aff0af5
commit 9068c13e39
3 changed files with 9 additions and 9 deletions

View File

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

View File

@ -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

View File

@ -36,10 +36,10 @@ public class Commanditemdb extends EssentialsCommand
}
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)));