3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Don't check block items for armor swapping

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-06-22 11:03:11 +02:00
Ursprung 0bb940e42d
Commit 4971eeab6a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -39,12 +39,16 @@ public final class ArmorToggleListener extends ViaBukkitListener {
public void itemUse(final PlayerInteractEvent event) {
final Player player = event.getPlayer();
final ItemStack item = event.getItem();
if (item == null || event.getHand() == null || !isOnPipe(player)) {
if (item == null || event.getHand() == null) {
return;
}
final EquipmentSlot armorItemSlot = item.getType().getEquipmentSlot();
if (armorItemSlot != EquipmentSlot.HAND && armorItemSlot != EquipmentSlot.OFF_HAND) {
if (armorItemSlot == EquipmentSlot.HAND || armorItemSlot == EquipmentSlot.OFF_HAND || item.getType().isBlock()) {
return;
}
if (isOnPipe(player)) {
final PlayerInventory inventory = player.getInventory();
final ItemStack armor = inventory.getItem(armorItemSlot);
// If two pieces of armor are equal, the client will do nothing.