Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 13:00:06 +01:00
Use sensible AssertionError instead of ambiguous RuntimeException
Dieser Commit ist enthalten in:
Ursprung
87f6fa7bc9
Commit
1f0c791444
@ -190,7 +190,7 @@ public class CraftEventFactory {
|
|||||||
*/
|
*/
|
||||||
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
public static PlayerInteractEvent callPlayerInteractEvent(EntityHuman who, Action action, ItemStack itemstack) {
|
||||||
if (action != Action.LEFT_CLICK_AIR && action != Action.RIGHT_CLICK_AIR) {
|
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);
|
return callPlayerInteractEvent(who, action, 0, 256, 0, 0, itemstack);
|
||||||
}
|
}
|
||||||
@ -462,7 +462,7 @@ public class CraftEventFactory {
|
|||||||
if (source == DamageSource.CACTUS) {
|
if (source == DamageSource.CACTUS) {
|
||||||
cause = DamageCause.CONTACT;
|
cause = DamageCause.CONTACT;
|
||||||
} else {
|
} 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));
|
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
@ -480,7 +480,7 @@ public class CraftEventFactory {
|
|||||||
} else if (source == DamageSource.FALL) {
|
} else if (source == DamageSource.FALL) {
|
||||||
cause = DamageCause.FALL;
|
cause = DamageCause.FALL;
|
||||||
} else {
|
} 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));
|
EntityDamageEvent event = callEvent(new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions));
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
@ -518,7 +518,7 @@ public class CraftEventFactory {
|
|||||||
return callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions);
|
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) {
|
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren