Paper/CraftBukkit-Patches/0143-Add-damager-to-the-unhandled-error.patch
Zach Brown cab333b217 Rebase (Update) from upstream SpigotMC
Don't send requests of every player was found in the global api cache SpigotMC/Spigot@841270ff1e
Correctly set the response code for the cached lookups and return the ... SpigotMC/Spigot@f170b7899c
Don't try and re-set the global api cache on reload SpigotMC/Spigot@b410a00a66
Use a compile time sneaky throw hack. SpigotMC/Spigot@508462b96b
Fix a missed rename in WorldGenGroundBush SpigotMC/Spigot@0614d8fae9
2014-11-28 14:19:07 -06:00

50 lines
3.1 KiB
Diff

From 24e4d0079e6a7c6761cd2177da4808c123443542 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
index 029652d..d452df7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -207,7 +207,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
}
return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack);
}
@@ -484,7 +484,7 @@ public class CraftEventFactory {
if (source == DamageSource.CACTUS) {
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()) {
@@ -502,7 +502,7 @@ public class CraftEventFactory {
} else if (source == DamageSource.FALL) {
cause = DamageCause.FALL;
} 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()) {
@@ -540,7 +540,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) {
--
1.9.1