Paper/CraftBukkit-Patches/0110-Add-damager-to-the-unhandled-error.patch

50 lines
3.2 KiB
Diff
Raw Normal View History

2016-03-01 00:27:36 +00:00
From 0bbc7f4798cc4ff7c9329671144e8c4081650185 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thinkofdeath@spigotmc.org>
Date: Thu, 26 Jun 2014 23:42:52 +0100
Subject: [PATCH] Add damager to the unhandled error
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2016-03-01 00:27:36 +00:00
index abeab03..beee3a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
2016-02-29 21:33:06 +00:00
@@ -170,7 +170,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 AssertionError(String.format("%s performing %s with %s", who, action, itemstack));
+ throw new IllegalArgumentException(String.format("%s performing %s with %s", who, action, itemstack)); // Spigot
}
2014-11-28 01:17:45 +00:00
return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack);
}
2016-02-29 21:33:06 +00:00
@@ -468,7 +468,7 @@ public class CraftEventFactory {
2016-03-01 00:27:36 +00:00
if (source == DamageSource.CACTUS || source == DamageSource.j) { // PAIL: rename
cause = DamageCause.CONTACT;
} else {
- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex)); // Spigot
}
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
if (!event.isCancelled()) {
2016-02-29 21:33:06 +00:00
@@ -488,7 +488,7 @@ public class CraftEventFactory {
} else if (source == DamageSource.DRAGON_BREATH) {
cause = DamageCause.DRAGON_BREATH;
} else {
- throw new AssertionError(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); // Spigot
}
EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
if (!event.isCancelled()) {
2016-02-29 21:33:06 +00:00
@@ -526,7 +526,7 @@ public class CraftEventFactory {
return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions);
}
- throw new AssertionError(String.format("Unhandled damage of %s from %s", entity, source.translationIndex));
+ throw new RuntimeException(String.format("Unhandled damage of %s from %s", entity, source.translationIndex)); // Spigot
}
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) {
--
2016-02-29 21:33:06 +00:00
2.5.0