use of org.bukkit.conversations.StringPrompt in project CitizensAPI by CitizensDev.
the class ModalMenuInput method captureInput.
public static void captureInput(Player player, InventoryMenu menu, Consumer<String> input) {
menu.close(player);
// TODO: this unregisters events incorrectly currently
player.beginConversation(new ConversationFactory(CitizensAPI.getPlugin()).addConversationAbandonedListener((evt) -> {
menu.present(player);
}).withLocalEcho(false).withEscapeSequence("exit").withModality(false).withTimeout(60).withFirstPrompt(new StringPrompt() {
@Override
public Prompt acceptInput(ConversationContext ctx, String text) {
input.accept(text);
menu.present(player);
return null;
}
@Override
public String getPromptText(ConversationContext ctx) {
return "";
}
}).buildConversation(player));
}
Aggregations