Class DialogHandler
java.lang.Object
com.soulfiremc.server.api.Plugin
com.soulfiremc.server.api.InternalPlugin
com.soulfiremc.server.plugins.DialogHandler
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final MetadataKey<AtomicReference<net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog>>> Metadata key for storing the current dialog state per bot. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog> getCurrentDialog(BotConnection connection) Gets the current dialog for a bot connection.static voidstatic voidstatic voidsetCurrentDialog(BotConnection connection, @Nullable net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog> dialog) Sets the current dialog for a bot connection.Methods inherited from class Plugin
isAvailable, pluginInfo, register
-
Field Details
-
CURRENT_DIALOG
public static final MetadataKey<AtomicReference<net.minecraft.core.Holder<net.minecraft.server.dialog.Dialog>>> CURRENT_DIALOGMetadata key for storing the current dialog state per bot. The value is an AtomicReference to allow thread-safe updates. Contains the Holder
-
-
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 connectiondialog- The dialog holder to set, or null to clear
-
onShowDialogPacket
-
onClearDialogPacket
-