org.bukkit.conversations.Conversation Java Examples

The following examples show how to use org.bukkit.conversations.Conversation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UHPluginListener.java    From KTP with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler
public void onInventoryClick(InventoryClickEvent ev) {
	if (ev.getInventory().getName().equals("- Teams -")) {
		Player pl = (Player) ev.getWhoClicked();
		ev.setCancelled(true);
		if (ev.getCurrentItem().getType() == Material.DIAMOND) {
			pl.closeInventory();
			p.getConversationFactory("teamPrompt").buildConversation(pl).begin();
		} else if (ev.getCurrentItem().getType() == Material.BEACON) {
			pl.closeInventory();
			Conversation c = p.getConversationFactory("playerPrompt").buildConversation(pl);
			c.getContext().setSessionData("nomTeam", ChatColor.stripColor(ev.getCurrentItem().getItemMeta().getDisplayName()));
			c.getContext().setSessionData("color", p.getTeam(ChatColor.stripColor(ev.getCurrentItem().getItemMeta().getDisplayName())).getChatColor());
			c.begin();
		}
	}
}
 
Example #2
Source File: SSHDConversationTracker.java    From Bukkit-SSHD with Apache License 2.0 6 votes vote down vote up
synchronized void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    if (!this.conversationQueue.isEmpty()) {
        if (this.conversationQueue.getFirst() == conversation) {
            conversation.abandon(details);
        }

        if (this.conversationQueue.contains(conversation)) {
            this.conversationQueue.remove(conversation);
        }

        if (!this.conversationQueue.isEmpty()) {
            this.conversationQueue.getFirst().outputNextPrompt();
        }
    }

}
 
Example #3
Source File: SSHDConversationTracker.java    From Bukkit-SSHD with Apache License 2.0 5 votes vote down vote up
synchronized void acceptConversationInput(String input) {
    if (this.isConversing()) {
        Conversation conversation = this.conversationQueue.getFirst();

        try {
            conversation.acceptInput(input);
        } catch (Throwable var4) {
            conversation.getContext().getPlugin().getLogger().log(Level.WARNING, String.format("Plugin %s generated an exception whilst handling conversation input", conversation.getContext().getPlugin().getDescription().getFullName()), var4);
        }
    }

}
 
Example #4
Source File: ConversationTracker.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public synchronized boolean beginConversation(Conversation conversation) {
    if (!conversationQueue.contains(conversation)) {
        conversationQueue.addLast(conversation);
        if (conversationQueue.getFirst() == conversation) {
            conversation.begin();
            conversation.outputNextPrompt();
            return true;
        }
    }
    return true;
}
 
Example #5
Source File: ConversationTracker.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public synchronized void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    if (!conversationQueue.isEmpty()) {
        if (conversationQueue.getFirst() == conversation) {
            conversation.abandon(details);
        }
        if (conversationQueue.contains(conversation)) {
            conversationQueue.remove(conversation);
        }
        if (!conversationQueue.isEmpty()) {
            conversationQueue.getFirst().outputNextPrompt();
        }
    }
}
 
Example #6
Source File: ConversationTracker.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public synchronized void abandonAllConversations() {

        LinkedList<Conversation> oldQueue = conversationQueue;
        conversationQueue = new LinkedList<Conversation>();
        for(Conversation conversation : oldQueue) {
            try {
            conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
            } catch (Throwable t) {
                Bukkit.getLogger().log(Level.SEVERE, "Unexpected exception while abandoning a conversation", t);
            }
        }
    }
 
Example #7
Source File: SSHDConversationTracker.java    From Bukkit-SSHD with Apache License 2.0 5 votes vote down vote up
synchronized boolean beginConversation(Conversation conversation) {
    if (!this.conversationQueue.contains(conversation)) {
        this.conversationQueue.addLast(conversation);
        if (this.conversationQueue.getFirst() == conversation) {
            conversation.begin();
            conversation.outputNextPrompt();
            return true;
        }
    }

    return true;
}
 
Example #8
Source File: ConversationTracker.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public synchronized void acceptConversationInput(String input) {
    if (isConversing()) {
        Conversation conversation = conversationQueue.getFirst();
        try {
            conversation.acceptInput(input);
        } catch (Throwable t) {
            conversation.getContext().getPlugin().getLogger().log(Level.WARNING,
                    String.format("Plugin %s generated an exception whilst handling conversation input",
                            conversation.getContext().getPlugin().getDescription().getFullName()
                    ), t);
        }
    }
}
 
Example #9
Source File: ConversationTracker.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public synchronized void abandonAllConversations() {

        LinkedList<Conversation> oldQueue = conversationQueue;
        conversationQueue = new LinkedList<Conversation>();
        for (Conversation conversation : oldQueue) {
            try {
                conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
            } catch (Throwable t) {
                Bukkit.getLogger().log(Level.SEVERE, "Unexpected exception while abandoning a conversation", t);
            }
        }
    }
 
Example #10
Source File: ConversationTracker.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public synchronized void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    if (!conversationQueue.isEmpty()) {
        if (conversationQueue.getFirst() == conversation) {
            conversation.abandon(details);
        }
        if (conversationQueue.contains(conversation)) {
            conversationQueue.remove(conversation);
        }
        if (!conversationQueue.isEmpty()) {
            conversationQueue.getFirst().outputNextPrompt();
        }
    }
}
 
Example #11
Source File: ConversationTracker.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public synchronized boolean beginConversation(Conversation conversation) {
    if (!conversationQueue.contains(conversation)) {
        conversationQueue.addLast(conversation);
        if (conversationQueue.getFirst() == conversation) {
            conversation.begin();
            conversation.outputNextPrompt();
            return true;
        }
    }
    return true;
}
 
Example #12
Source File: SSHDConversationTracker.java    From Bukkit-SSHD with Apache License 2.0 5 votes vote down vote up
public synchronized void abandonAllConversations() {
    LinkedList<Conversation> oldQueue = this.conversationQueue;
    this.conversationQueue = new LinkedList<>();

    for (Conversation conversation : oldQueue) {
        try {
            conversation.abandon(new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
        } catch (Throwable var5) {
            Bukkit.getLogger().log(Level.SEVERE, "Unexpected exception while abandoning a conversation", var5);
        }
    }

}
 
Example #13
Source File: SSHDCommandSender.java    From Bukkit-SSHD with Apache License 2.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    this.conversationTracker.abandonConversation(conversation, details);
}
 
Example #14
Source File: SSHDCommandSender.java    From Bukkit-SSHD with Apache License 2.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation) {
    this.conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}
 
Example #15
Source File: SSHDCommandSender.java    From Bukkit-SSHD with Apache License 2.0 4 votes vote down vote up
public boolean beginConversation(Conversation conversation) {
    return this.conversationTracker.beginConversation(conversation);
}
 
Example #16
Source File: CraftConsoleCommandSender.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    conversationTracker.abandonConversation(conversation, details);
}
 
Example #17
Source File: CraftConsoleCommandSender.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation) {
    conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}
 
Example #18
Source File: CraftConsoleCommandSender.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public boolean beginConversation(Conversation conversation) {
    return conversationTracker.beginConversation(conversation);
}
 
Example #19
Source File: CraftPlayer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public boolean beginConversation(Conversation conversation) {
    return conversationTracker.beginConversation(conversation);
}
 
Example #20
Source File: CraftPlayer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    conversationTracker.abandonConversation(conversation, details);
}
 
Example #21
Source File: CraftPlayer.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation) {
    conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}
 
Example #22
Source File: CraftPlayer.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean beginConversation(Conversation conversation) {
    return conversationTracker.beginConversation(conversation);
}
 
Example #23
Source File: SingleCommandSender.java    From DiscordSRV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean beginConversation(Conversation arg0) {
    return sender.beginConversation(arg0);
}
 
Example #24
Source File: SingleCommandSender.java    From DiscordSRV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void abandonConversation(Conversation arg0, ConversationAbandonedEvent arg1) {
    sender.abandonConversation(arg0, arg1);
}
 
Example #25
Source File: SingleCommandSender.java    From DiscordSRV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void abandonConversation(Conversation arg0) {
    sender.abandonConversation(arg0);
}
 
Example #26
Source File: CraftConsoleCommandSender.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    conversationTracker.abandonConversation(conversation, details);
}
 
Example #27
Source File: CraftConsoleCommandSender.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public void abandonConversation(Conversation conversation) {
    conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}
 
Example #28
Source File: CraftConsoleCommandSender.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public boolean beginConversation(Conversation conversation) {
    return conversationTracker.beginConversation(conversation);
}
 
Example #29
Source File: CraftPlayer.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
    conversationTracker.abandonConversation(conversation, details);
}
 
Example #30
Source File: CraftPlayer.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void abandonConversation(Conversation conversation) {
    conversationTracker.abandonConversation(conversation, new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
}