3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Fix method name for Critical damage (#6813)

Dieser Commit ist enthalten in:
Pedro 2021-10-21 11:11:19 -03:00 committet von GitHub
Ursprung a1f49e4c60
Commit 9472d38f3c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -14,7 +14,7 @@ index 80d19af2ad423bd3de0e039c5bb8f97af536aaa9..57bf7dba266b4df7b36bab2d58a609a1
// CraftBukkit end // CraftBukkit end
+ // Paper start - add critical damage API + // Paper start - add critical damage API
+ private boolean critical; + private boolean critical;
+ public boolean isCritcal() { + public boolean isCritical() {
+ return this.critical; + return this.critical;
+ } + }
+ public DamageSource critical() { + public DamageSource critical() {
@ -113,7 +113,7 @@ index 2b2654ec04e8abca9db09d6257edf11099bb0d9b..771a00ae7f467660b0c39ffeee05281e
damageCause = DamageCause.ENTITY_EXPLOSION; damageCause = DamageCause.ENTITY_EXPLOSION;
} }
- event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions); - event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions);
+ event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, source.isCritcal()); // Paper - add critical damage API + event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API
} }
event.setCancelled(cancelled); event.setCancelled(cancelled);
@ -122,7 +122,7 @@ index 2b2654ec04e8abca9db09d6257edf11099bb0d9b..771a00ae7f467660b0c39ffeee05281e
} }
- return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled); - return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled);
+ return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritcal()); // Paper - add critical damage API + return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
} else if (source == DamageSource.OUT_OF_WORLD) { } else if (source == DamageSource.OUT_OF_WORLD) {
EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions); EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions);
event.setCancelled(cancelled); event.setCancelled(cancelled);
@ -131,7 +131,7 @@ index 2b2654ec04e8abca9db09d6257edf11099bb0d9b..771a00ae7f467660b0c39ffeee05281e
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId)); throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId));
} }
- EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions); - EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions);
+ EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, source.isCritcal()); // Paper - add critical damage API + EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API
event.setCancelled(cancelled); event.setCancelled(cancelled);
CraftEventFactory.callEvent(event); CraftEventFactory.callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@ -140,7 +140,7 @@ index 2b2654ec04e8abca9db09d6257edf11099bb0d9b..771a00ae7f467660b0c39ffeee05281e
if (cause != null) { if (cause != null) {
- return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled); - return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled);
+ return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritcal()); // Paper - add critical damage API + return CraftEventFactory.callEntityDamageEvent(null, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API
} }
throw new IllegalStateException(String.format("Unhandled damage of %s from %s", entity, source.msgId)); throw new IllegalStateException(String.format("Unhandled damage of %s from %s", entity, source.msgId));