Class Window

java.lang.Object
com.hypixel.hytale.server.core.entity.entities.player.windows.Window
Direct Known Subclasses:
AbilityBenchWindow, BlockWindow, ContainerWindow, FieldCraftingWindow, ItemStackContainerWindow, MemoriesWindow

public abstract class Window extends Object
Represents a single window that a player has open, such as a crafting bench or chest container
  • Field Details

    • CLIENT_REQUESTABLE_WINDOW_TYPES

      public static final Map<WindowType, Supplier<? extends Window>> CLIENT_REQUESTABLE_WINDOW_TYPES
      These are windows the client is able to request to open.
  • Constructor Details

    • Window

      public Window(@Nonnull WindowType windowType)
      Default Constructor for a Window instance
      Parameters:
      windowType - The type of window that this window is
  • Method Details

    • init

      public void init(@Nonnull PlayerRef playerRef, @Nonnull WindowManager manager)
      Called to initialize this window with the given player and window manager
      Parameters:
      playerRef - The player ref of the affiliated player
      manager - The affiliated window manager
    • getData

      @Nonnull public abstract com.google.gson.JsonObject getData()
      Returns:
      the JsonObject data affiliated with this window
    • handleAction

      public void handleAction(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull WindowAction action)
      Called to handle the given action for this window
      Parameters:
      ref - The entity ref of the affiliated entity
      store - The entity store for component access
      action - The window action to handle
    • getType

      @Nonnull public WindowType getType()
      Returns:
      the window type of this window
    • setId

      public void setId(int id)
      Called to set the unique ID of this window
      Parameters:
      id - The unique ID to set
    • getId

      public int getId()
      Returns:
      the unique ID of this window
    • getPlayerRef

      @Nullable public PlayerRef getPlayerRef()
      Returns:
      the player ref associated with this window
    • close

      public void close(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Called to close this window.
    • registerCloseEvent

      @Nonnull public EventRegistration registerCloseEvent(@Nonnull Consumer<Window.WindowCloseEvent> consumer)
      Called to register the given consumer as an event to trigger upon the windows closure
      Parameters:
      consumer - The consumer to register
      Returns:
      the event registration instance upon registration
    • registerCloseEvent

      @Nonnull public EventRegistration registerCloseEvent(short priority, @Nonnull Consumer<Window.WindowCloseEvent> consumer)
      Called to register the given consumer as an event to trigger upon the windows closure, with a set priority
      Parameters:
      priority - The priority of this callback
      consumer - The consumer to register
      Returns:
      the event registration instance upon registration
    • registerCloseEvent

      @Nonnull public EventRegistration registerCloseEvent(@Nonnull EventPriority priority, @Nonnull Consumer<Window.WindowCloseEvent> consumer)
      Called to register the given consumer as an event to trigger upon the windows closure, with a set priority
      Parameters:
      priority - The priority of this callback
      consumer - The consumer to register
      Returns:
      the event registration instance upon registration
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object