Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Fix removal of items from Item Frames. Fixes BUKKIT-5736
Dieser Commit ist enthalten in:
Ursprung
594d7cb8c9
Commit
971329c42b
@ -24,7 +24,7 @@ public class EntityItemFrame extends EntityHanging {
|
|||||||
} else if (this.getItem() != null) {
|
} else if (this.getItem() != null) {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start - fire EntityDamageEvent
|
// CraftBukkit start - fire EntityDamageEvent
|
||||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f) || this.dead) {
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.dead) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -564,8 +564,12 @@ public class CraftEventFactory {
|
|||||||
return handleEntityDamageEvent(damagee, source, modifiers, modifierFunctions);
|
return handleEntityDamageEvent(damagee, source, modifiers, modifierFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-Living Entities such as EntityEnderCrystal, EntityItemFrame, and EntityFireball need to call this
|
// Non-Living Entities such as EntityEnderCrystal and EntityFireball need to call this
|
||||||
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) {
|
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) {
|
||||||
|
return handleNonLivingEntityDamageEvent(entity, source, damage, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage, boolean cancelOnZeroDamage) {
|
||||||
if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) {
|
if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -580,7 +584,7 @@ public class CraftEventFactory {
|
|||||||
if (event == null) {
|
if (event == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return event.isCancelled() || event.getDamage() == 0;
|
return event.isCancelled() || (cancelOnZeroDamage && event.getDamage() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerLevelChangeEvent callPlayerLevelChangeEvent(Player player, int oldLevel, int newLevel) {
|
public static PlayerLevelChangeEvent callPlayerLevelChangeEvent(Player player, int oldLevel, int newLevel) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren