diff options
author | Wesley Wolfe <wesley.d.wolfe+git@gmail.com> | 2014-08-07 19:29:28 -0500 |
---|---|---|
committer | Wesley Wolfe <wesley.d.wolfe+git@gmail.com> | 2014-08-07 19:29:35 -0500 |
commit | 1f0c7914449b7a12690065dbbabbf1b5b32a2638 (patch) | |
tree | da7184376be77fcf9eb795a4351a7955adca4d7e /src/main/java/org/bukkit | |
parent | 87f6fa7bc94c3647a6e1651369f2a4787fbd9dab (diff) | |
download | craftbukkit-1f0c7914449b7a12690065dbbabbf1b5b32a2638.tar craftbukkit-1f0c7914449b7a12690065dbbabbf1b5b32a2638.tar.gz craftbukkit-1f0c7914449b7a12690065dbbabbf1b5b32a2638.tar.lz craftbukkit-1f0c7914449b7a12690065dbbabbf1b5b32a2638.tar.xz craftbukkit-1f0c7914449b7a12690065dbbabbf1b5b32a2638.zip |
Use sensible AssertionError instead of ambiguous RuntimeException
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index c6c7f23b..0fff227f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -190,7 +190,7 @@ public class CraftEventFactory { */ public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) { if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) { - throw new IllegalArgumentException(); + throw new AssertionError(String.format("%s performing %s with %s", who, action, itemstack)); } return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack); } @@ -462,7 +462,7 @@ public class CraftEventFactory { if (source == DamageSource.CACTUS) { cause = DamageCause.CONTACT; } else { - throw new RuntimeException("Unhandled entity damage"); + throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex)); } EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); if (!event.isCancelled()) { @@ -480,7 +480,7 @@ public class CraftEventFactory { } else if (source == DamageSource.FALL) { cause = DamageCause.FALL; } else { - throw new RuntimeException("Unhandled entity damage"); + throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); } EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions)); if (!event.isCancelled()) { @@ -518,7 +518,7 @@ public class CraftEventFactory { return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions); } - throw new RuntimeException("Unhandled entity damage"); + throw new AssertionError(String.format("Unhandled damage of %s from %s", entity, source.translationIndex)); } private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) { |