2016-03-04 05:26:28 +01:00
|
|
|
From 5c3328985bd5f3963514df632ad65dc08dcdd704 Mon Sep 17 00:00:00 2001
|
2014-07-21 22:46:54 +02:00
|
|
|
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-04 05:26:28 +01:00
|
|
|
index 131792b..5083875 100644
|
2014-07-21 22:46:54 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2016-03-04 05:26:28 +01:00
|
|
|
@@ -185,7 +185,7 @@ public class CraftEventFactory {
|
2014-08-09 00:15:42 +02:00
|
|
|
*/
|
2016-03-04 05:26:28 +01:00
|
|
|
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack, EnumHand hand) {
|
2014-08-09 00:15:42 +02:00
|
|
|
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
|
|
|
|
}
|
2016-03-04 05:26:28 +01:00
|
|
|
return callPlayerInteractEvent(who, action, new BlockPosition(0, 256, 0), EnumDirection.SOUTH, itemstack, hand);
|
2014-08-09 00:15:42 +02:00
|
|
|
}
|
2016-03-04 05:26:28 +01:00
|
|
|
@@ -483,7 +483,7 @@ public class CraftEventFactory {
|
2016-03-01 07:36:41 +01:00
|
|
|
if (source == DamageSource.CACTUS) {
|
2014-08-09 00:15:42 +02:00
|
|
|
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-03-04 05:26:28 +01:00
|
|
|
@@ -503,7 +503,7 @@ public class CraftEventFactory {
|
2016-02-29 22:33:06 +01:00
|
|
|
} else if (source == DamageSource.DRAGON_BREATH) {
|
|
|
|
cause = DamageCause.DRAGON_BREATH;
|
2014-07-21 22:46:54 +02:00
|
|
|
} else {
|
2014-08-09 00:15:42 +02:00
|
|
|
- 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
|
2014-07-21 22:46:54 +02:00
|
|
|
}
|
|
|
|
EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
|
|
|
|
if (!event.isCancelled()) {
|
2016-03-04 05:26:28 +01:00
|
|
|
@@ -543,7 +543,7 @@ public class CraftEventFactory {
|
2014-08-09 00:15:42 +02:00
|
|
|
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) {
|
2014-07-21 22:46:54 +02:00
|
|
|
--
|
2016-02-29 22:33:06 +01:00
|
|
|
2.5.0
|
2014-07-21 22:46:54 +02:00
|
|
|
|