Class SwitchActiveSlotEvent

java.lang.Object
fr.hytale.loader.event.types.ecs.SwitchActiveSlotEvent
All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>

public class SwitchActiveSlotEvent extends Object implements com.hypixel.hytale.event.IEvent<Void>
Called when a player switches their active hotbar slot.

This event is fired when a player changes their selected slot in the hotbar. It provides access to the new slot index, the previous slot index, and other details. The event can be cancelled to prevent the slot switch.

Since:
1.0.2
Version:
1.0.4
Author:
HytaleLoader
  • Constructor Details

    • SwitchActiveSlotEvent

      public SwitchActiveSlotEvent(com.hypixel.hytale.server.core.event.events.ecs.SwitchActiveSlotEvent originalEvent, Player player)
      Constructs a new SwitchActiveSlotEvent.
      Parameters:
      originalEvent - the original Hytale ECS event
      player - the player who switched slots, or null if not a player
  • Method Details

    • getNewSlot

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

      public void setNewSlot(byte newSlot)
      Sets the new active slot index.
      Parameters:
      newSlot - the new slot index
    • getPreviousSlot

      public int getPreviousSlot()
      Gets the previous active slot index.
      Returns:
      the previous slot index
    • getInventorySectionId

      public int getInventorySectionId()
      Gets the inventory section ID.
      Returns:
      the inventory section ID
    • isServerRequest

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

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

      public boolean isCancelled()
      Checks if this event has been cancelled.
      Returns:
      true if cancelled, false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets the cancelled state of this event.
      Parameters:
      cancelled - true to cancel, false to allow
    • getPlayer

      public Player getPlayer()
      Gets the player who switched slots.
      Returns:
      the player, or null if the action was not performed by a player