Skip to main content
xyz.refineryteam.refinerycore.api.interaction provides two ways to capture free-text input from a player without them leaving the flow of your plugin: chat-based prompts and anvil-based prompts. (For a fixed yes/no choice instead of free text, see ConfirmationGUI.)

Chat prompts — ChatPrompt

Captures the player’s next chat message instead of letting it reach public chat — useful for ban reasons, custom amounts, search terms, and similar.
Call PromptRegistry.install(plugin) once during your plugin’s onEnable() before using ChatPrompt anywhere. This registers the shared chat/quit listener exactly once per JVM, even if multiple plugins depend on RefineryCore.
BanCommand.java
Builder methods: Only one prompt can be pending per player at a time — registering a new one cancels any previous pending prompt’s timeout task (without invoking its cancel callback). If the player disconnects while a prompt is pending, it’s silently discarded (no cancel callback fires, since there’s no one left to message).

Anvil prompts — AnvilPrompt

Captures single-line text via a real anvil GUI instead of chat — useful when you don’t want to leave the inventory UI (renaming an item, entering a numeric amount, naming a kit) or don’t want the answer flashing through public chat.
EconomyGiveCommand.java
Builder methods: Internally, AnvilPrompt:
  • Intercepts clicks on the anvil’s result slot (2) as “submit” rather than letting the player take an item
  • Blocks taking the input item out of slots 0/1 entirely, since this inventory only exists to capture text
  • Zeroes out the repair cost/result icon so it never visually resembles a real item combine
  • Treats closing without submitting as a cancel
AnvilPrompt registers itself as a Bukkit listener per-instance and unregisters on close/submit — you don’t need to manage its lifecycle manually, but avoid holding onto a single AnvilPrompt instance across multiple open() calls for different players.