mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-01-09 17:27:38 +01:00
Don't check block items for armor swapping
This commit is contained in:
parent
0bb940e42d
commit
4971eeab6a
@ -39,12 +39,16 @@ public final class ArmorToggleListener extends ViaBukkitListener {
|
|||||||
public void itemUse(final PlayerInteractEvent event) {
|
public void itemUse(final PlayerInteractEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final ItemStack item = event.getItem();
|
final ItemStack item = event.getItem();
|
||||||
if (item == null || event.getHand() == null || !isOnPipe(player)) {
|
if (item == null || event.getHand() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final EquipmentSlot armorItemSlot = item.getType().getEquipmentSlot();
|
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 PlayerInventory inventory = player.getInventory();
|
||||||
final ItemStack armor = inventory.getItem(armorItemSlot);
|
final ItemStack armor = inventory.getItem(armorItemSlot);
|
||||||
// If two pieces of armor are equal, the client will do nothing.
|
// If two pieces of armor are equal, the client will do nothing.
|
||||||
|
Loading…
Reference in New Issue
Block a user