Class UISurface.Batch

java.lang.Object
com.hypixel.hytale.server.core.modules.ui.UISurface.Batch
All Implemented Interfaces:
AutoCloseable
Enclosing class:
UISurface

public static final class UISurface.Batch extends Object implements AutoCloseable
Collects commands emitted by a surface and sends them as one packet when closed. A batch larger than the per-packet command cap is sent as several packets, in order. Obtain one via UISurface.beginBatch() and use it with try-with-resources. An empty batch sends nothing.
  • Method Details

    • add

      public void add(@Nonnull ServersideUICommand command)
    • addFirst

      public void addFirst(@Nonnull ServersideUICommand command)
      Inserts a command at the front of this batch. Used so InitServersideUICommand leads the packet when createDataContext emits updates while the batch is open.
    • clear

      public void clear()
      Drops every collected command without sending. Use when a lifecycle callback fails before the batch should reach the client.
    • flush

      public void flush()
      Sends the accumulated commands now and clears the batch, leaving it open to collect more.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable