mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
Fix totems negating incorrect item (#11776)
This commit is contained in:
parent
f8bf600375
commit
188124bcc3
1 changed files with 12 additions and 9 deletions
|
@ -668,22 +668,25 @@
|
||||||
if (deathProtection != null) {
|
if (deathProtection != null) {
|
||||||
+ hand = interactionHand; // CraftBukkit
|
+ hand = interactionHand; // CraftBukkit
|
||||||
itemStack = itemInHand.copy();
|
itemStack = itemInHand.copy();
|
||||||
- itemInHand.shrink(1);
|
|
||||||
+ // itemInHand.shrink(1); // CraftBukkit
|
+ // itemInHand.shrink(1); // CraftBukkit
|
||||||
break;
|
+ break;
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
- if (itemStack != null) {
|
|
||||||
- if (this instanceof ServerPlayer serverPlayer) {
|
|
||||||
+ org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
+ org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
||||||
+ EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
|
+ EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
|
||||||
+ event.setCancelled(itemStack == null);
|
+ event.setCancelled(itemStack == null);
|
||||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||||
+
|
+
|
||||||
+ if (!event.isCancelled()) {
|
+ if (!event.isCancelled()) {
|
||||||
+ if (!itemStack.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
|
+ if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
|
||||||
+ itemStack.shrink(1);
|
itemInHand.shrink(1);
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (itemStack != null) {
|
||||||
|
- if (this instanceof ServerPlayer serverPlayer) {
|
||||||
+ }
|
+ }
|
||||||
+ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
|
+ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
|
||||||
+ // restore the previous behavior in that case by defaulting to vanillas totem of undying efect
|
+ // restore the previous behavior in that case by defaulting to vanillas totem of undying efect
|
||||||
|
|
Loading…
Reference in a new issue