Class QueryEvent<T extends Writeable>

java.lang.Object
net.minestom.server.extras.query.event.QueryEvent<T>
Type Parameters:
T - the type of the response
All Implemented Interfaces:
Event, CancellableEvent
Direct Known Subclasses:
BasicQueryEvent, FullQueryEvent

public abstract class QueryEvent<T extends Writeable> extends Object implements CancellableEvent
An event called when a query is received and ready to be responded to.
  • Constructor Details

    • QueryEvent

      public QueryEvent(@NotNull @NotNull SocketAddress sender, int sessionID, @NotNull T response)
      Creates a new query event.
      Parameters:
      sender - the sender
      sessionID - the session ID of the query sender
      response - the initial response
  • Method Details

    • getQueryResponse

      public T getQueryResponse()
      Gets the query response that will be sent back to the sender. This can be mutated.
      Returns:
      the response
    • setQueryResponse

      public void setQueryResponse(@NotNull T response)
      Sets the query response that will be sent back to the sender.
      Parameters:
      response - the response
    • getSender

      @NotNull public @NotNull SocketAddress getSender()
      Gets the socket address of the initiator of the query.
      Returns:
      the initiator
    • getSessionID

      public int getSessionID()
      Gets the Session ID of the initiator of the query.
      Returns:
      the session ID
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: CancellableEvent
      Gets if the Event should be cancelled or not.
      Specified by:
      isCancelled in interface CancellableEvent
      Returns:
      true if the event should be cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: CancellableEvent
      Marks the Event as cancelled or not.
      Specified by:
      setCancelled in interface CancellableEvent
      Parameters:
      cancel - true if the event should be cancelled, false otherwise