diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index e7c001d495..7bfea1927b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -724,15 +724,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void sendEquipmentChange(LivingEntity entity, EquipmentSlot slot, ItemStack item) { + this.sendEquipmentChange(entity, Map.of(slot, item)); + } + + @Override + public void sendEquipmentChange(LivingEntity entity, Map items) { Preconditions.checkArgument(entity != null, "entity must not be null"); - Preconditions.checkArgument(slot != null, "slot must not be null"); - Preconditions.checkArgument(item != null, "item must not be null"); + Preconditions.checkArgument(items != null, "items must not be null"); - if (getHandle().connection == null) return; + if (getHandle().connection == null) { + return; + } - List> equipment = Arrays.asList( - new Pair<>(CraftEquipmentSlot.getNMS(slot), CraftItemStack.asNMSCopy(item)) - ); + List> equipment = new ArrayList<>(items.size()); + for (Map.Entry entry : items.entrySet()) { + EquipmentSlot slot = entry.getKey(); + Preconditions.checkArgument(slot != null, "Cannot set null EquipmentSlot"); + + equipment.add(new Pair<>(CraftEquipmentSlot.getNMS(slot), CraftItemStack.asNMSCopy(entry.getValue()))); + } getHandle().connection.send(new PacketPlayOutEntityEquipment(entity.getEntityId(), equipment)); }