diff --git a/src/com/hypixel/hytale/server/core/entity/InteractionManager.java b/src/com/hypixel/hytale/server/core/entity/InteractionManager.java index 7339e6dc..6eccc449 100644 --- a/src/com/hypixel/hytale/server/core/entity/InteractionManager.java +++ b/src/com/hypixel/hytale/server/core/entity/InteractionManager.java @@ -128,7 +128,7 @@ public class InteractionManager implements Component { assert this.commandBuffer != null; Player playerComponent = this.commandBuffer.getComponent(ref, Player.getComponentType()); - return playerComponent != null ? playerComponent.isWaitingForClientReady() : false; + return playerComponent != null && playerComponent.isWaitingForClientReady(); } @Deprecated(forRemoval = true) @@ -1250,33 +1250,35 @@ public class InteractionManager implements Component { this.tryRunHeldInteraction(ref, commandBuffer, type, (short) -1); } - public void tryRunHeldInteraction( - @Nonnull Ref ref, @Nonnull CommandBuffer commandBuffer, @Nonnull InteractionType type, short equipSlot - ) { + public void tryRunHeldInteraction(@Nonnull Ref ref, @Nonnull CommandBuffer commandBuffer, @Nonnull InteractionType type, short equipSlot) { Inventory inventory = this.entity.getInventory(); ItemStack itemStack; - - itemStack = switch (type) { - case Held -> inventory.getItemInHand(); - case HeldOffhand -> inventory.getUtilityItem(); - case Equipped -> { + switch (type) { + case Held: + itemStack = inventory.getItemInHand(); + break; + case HeldOffhand: + itemStack = inventory.getUtilityItem(); + break; + case Equipped: if (equipSlot == -1) { throw new IllegalArgumentException(); } - yield inventory.getArmor().getItemStack(equipSlot); - } - default -> throw new IllegalArgumentException(); - }; + + itemStack = inventory.getArmor().getItemStack(equipSlot); + break; + default: + throw new IllegalArgumentException(); + } if (itemStack != null && !itemStack.isEmpty()) { - String rootId = itemStack.getItem().getInteractions().get(type); - if (rootId == null) { - return; - } - RootInteraction root = RootInteraction.getAssetMap().getAsset(rootId); - if (root != null && this.canRun(type, equipSlot, root)) { - InteractionContext context = InteractionContext.forInteraction(this, ref, type, equipSlot, commandBuffer); - this.startChain(ref, commandBuffer, type, context, root); + String rootId = (String) itemStack.getItem().getInteractions().get(type); + if (rootId != null) { + RootInteraction root = (RootInteraction) RootInteraction.getAssetMap().getAsset(rootId); + if (root != null && this.canRun(type, equipSlot, root)) { + InteractionContext context = InteractionContext.forInteraction(this, ref, type, equipSlot, commandBuffer); + this.startChain(ref, commandBuffer, type, context, root); + } } } }