API Methods and Events
Methods
The main class for the API is InteractionsAPI
. You can use this class whenever you want in your plugin.
// Returns the conversation the player is currently in
PlayerConversation c = InteractionsAPI.getPlayerConversation(Player player)
// Method to start a conversation from its file name (without .yml)
boolean startConversation = InteractionsAPI.startConversation(Player player,String conversationName)
// Ends the current conversation the player is currently in
InterationsAPI.endConversation(Player player, ConversationEndReason reason)
Events
//Event called when a player is about to start a conversation. You can cancel
//cancel the event if you need to.
@EventHandler
public void conversationStart(ConversationStartEvent event){
Player player = event.getPlayer();
PlayerConversation c = event.getPlayerConversation();
}
//Event called when a player has finished a conversation.
@EventHandler
public void conversationEnd(ConversationEndEvent event){
Player player = event.getPlayer();
PlayerConversation c = event.getPlayerConversation();
}
//Event called when a player selects an option on a conversation. You can
//cancel the event if you need to.
@EventHandler
public void optionSelect(OptionSelectEvent event){
Player player = event.getPlayer();
PlayerConversation playerConversation = event.getPlayerConversation();
Conversation c = event.getConversation();
Option o = event.getOption();
}
Last updated