Fix method name for Critical damage (#6813)

This commit is contained in:
Pedro 2021-10-21 11:11:19 -03:00 committed by GitHub
parent a1f49e4c60
commit 9472d38f3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));