Class InventoryActiveSlotRequestEvent

java.lang.Object
com.hypixel.hytale.component.system.EcsEvent
com.hypixel.hytale.component.system.CancellableEcsEvent
com.hypixel.hytale.server.core.event.events.ecs.InventoryActiveSlotRequestEvent
All Implemented Interfaces:
ICancellableEcsEvent

public class InventoryActiveSlotRequestEvent extends CancellableEcsEvent
A cancellable event that is fired when an entity requests a change to their active inventory slot. If cancelled, the slot switch will not occur.

This event is fired before the change is applied. To react after the slot has changed, listen for InventorySetActiveSlotEvent instead.

See Also:
  • Constructor Details

    • InventoryActiveSlotRequestEvent

      public InventoryActiveSlotRequestEvent(int inventorySectionId, int previousSlot, byte newSlot, boolean serverRequest)
      Default Constructor for a InventoryActiveSlotRequestEvent instance.
      Parameters:
      inventorySectionId - The inventory section ID where the slot switch is occurring.
      previousSlot - The index of the previously active slot.
      newSlot - The index of the new active slot.
      serverRequest - Whether the slot switch was requested by the server.
  • Method Details

    • getPreviousSlot

      public int getPreviousSlot()
      Returns:
      the index of the previously active slot.
    • getNewSlot

      public byte getNewSlot()
      Returns:
      the index of the new active slot.
    • setNewSlot

      public void setNewSlot(byte newSlot)
      Parameters:
      newSlot - The index of the new active slot to set.
    • isServerRequest

      public boolean isServerRequest()
      Returns:
      true if the slot switch was requested by the server, false otherwise.
    • isClientRequest

      public boolean isClientRequest()
      Returns:
      true if the slot switch was requested by the client, false otherwise.
    • getInventorySectionId

      public int getInventorySectionId()
      Returns:
      the inventory section ID where the slot switch is occurring.