Search in sources :

Example 1 with Conversable

use of org.bukkit.conversations.Conversable in project MagicPlugin by elBukkit.

the class CommandAction method runConversations.

private void runConversations(CastContext context, Queue<String> commands, boolean opPlayer) {
    CommandSender sender = context.getMage().getCommandSender();
    if (!(sender instanceof Conversable)) {
        return;
    }
    Conversable conversable = (Conversable) sender;
    ArgumentsPrompt argumentsPrompt = new ArgumentsPrompt(context, sender, commands, opPlayer);
    ConversationFactory factory = new ConversationFactory(context.getController().getPlugin());
    factory.withLocalEcho(localEcho).withModality(modal).withFirstPrompt(argumentsPrompt);
    if (timeout > 0) {
        factory.withTimeout(timeout);
    }
    if (!escapeSequence.isEmpty()) {
        factory.withEscapeSequence(escapeSequence);
    }
    conversable.beginConversation(factory.buildConversation(conversable));
}
Also used : ConversationFactory(org.bukkit.conversations.ConversationFactory) Conversable(org.bukkit.conversations.Conversable) CommandSender(org.bukkit.command.CommandSender)

Aggregations

CommandSender (org.bukkit.command.CommandSender)1 Conversable (org.bukkit.conversations.Conversable)1 ConversationFactory (org.bukkit.conversations.ConversationFactory)1