fix: do not try to equip "body" equipment to players

This commit is contained in:
mworzala 2024-12-16 14:22:46 -05:00
parent d707b0674f
commit 7b659f0fc3
No known key found for this signature in database
GPG Key ID: B148F922E64797C7

View File

@ -1,5 +1,6 @@
package net.minestom.server.listener;
import net.minestom.server.entity.EquipmentSlot;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.PlayerHand;
import net.minestom.server.event.EventDispatcher;
@ -88,7 +89,7 @@ public class UseItemListener {
// If the item was not usable, we can try to do an equipment swap with it.
final Equippable equippable = itemStack.get(ItemComponent.EQUIPPABLE);
if (equippable != null && equippable.swappable()) {
if (equippable != null && equippable.swappable() && equippable.slot() != EquipmentSlot.BODY) {
final ItemStack currentlyEquipped = player.getEquipment(equippable.slot());
player.setEquipment(equippable.slot(), itemStack);
player.setItemInHand(hand, currentlyEquipped);