Class DialogHandler


public final class DialogHandler extends InternalPlugin
Handles server-sent dialogs (Minecraft 1.21.6+). This plugin intercepts dialog packets and stores the current dialog state, making it available for the gRPC API to expose to clients.
  • Field Details

    • CURRENT_DIALOG

      public static final MetadataKey<AtomicReference<net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog>>> CURRENT_DIALOG
      Metadata key for storing the current dialog state per bot. The value is an AtomicReference to allow thread-safe updates. Contains the Holder from the packet.
  • Constructor Details

    • DialogHandler

      public DialogHandler()
  • Method Details

    • getCurrentDialog

      @Nullable public static @Nullable net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog> getCurrentDialog(BotConnection connection)
      Gets the current dialog for a bot connection.
      Parameters:
      connection - The bot connection
      Returns:
      The current dialog holder, or null if no dialog is displayed
    • setCurrentDialog

      public static void setCurrentDialog(BotConnection connection, @Nullable @Nullable net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog> dialog)
      Sets the current dialog for a bot connection.
      Parameters:
      connection - The bot connection
      dialog - The dialog holder to set, or null to clear
    • onShowDialogPacket

      public static void onShowDialogPacket(BotPacketPreReceiveEvent event)
    • onClearDialogPacket

      public static void onClearDialogPacket(BotPacketPreReceiveEvent event)