BedrockMobEquipmentTranslator: Don't change item slot if already on that slot (#1353)

* BedrockMobEquipmentTranslator: Don't change item slot if already on that slot

* Update comment
This commit is contained in:
Camotoy 2020-10-08 20:07:50 -04:00 committed by GitHub
parent 45c5ef02cd
commit 59f72d0e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,8 @@ public class BedrockMobEquipmentTranslator extends PacketTranslator<MobEquipment
@Override @Override
public void translate(MobEquipmentPacket packet, GeyserSession session) { public void translate(MobEquipmentPacket packet, GeyserSession session) {
if (!session.isSpawned() || packet.getHotbarSlot() > 8 || if (!session.isSpawned() || packet.getHotbarSlot() > 8 ||
packet.getContainerId() != ContainerId.INVENTORY) { packet.getContainerId() != ContainerId.INVENTORY || session.getInventory().getHeldItemSlot() == packet.getHotbarSlot()) {
// For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention
return; return;
} }