All this information is obsolete
API Documentation:
This is the API documentation of the plugin, soon you will find more information on the github wiki.
To avoid problems you must first add it as a dependency to the
plugin.yml of your program.
Code (YAML):
softdepend
:
[CharacterDialogue
]
Requesting the API:
To get the api you simply call the main class of the plugin.
Code (Java):
CharacterDialogueAPI api
= CharacterDialoguePlugin.
getInstance
(
).
getApi
(
)
;
There you will find some useful methods used by the plugin, one of them is the one that is in charge of starting the dialogs.
Code (Java):
CharacterDialogueAPI#executeDialog
(List
<String
>, Player, ClickType,
int,
String
)
;
CharacterDialogueAPI#executeDialog
(List
<String
>, Player,
String
)
;
Code (Text):
List<String> = The lines of the dialog to be executed.
Player = The player responsible for the interaction.
ClickType = The type of click you executed.
int = The npc id.
String = The npc display name.
Why does it ask so much? It's simple, there is an event made by the plugin that is simply called when a method is executed, things like
ClickType and
Npc ID are optional.
Creating a Method:
To create a method you only have to make a new class that extends
DialogMethod.
Code (Java):
import
org.bukkit.entity.Player
;
import
me.iatog.characterdialogue.dialogs.DialogMethod
;
import
me.iatog.characterdialogue.session.DialogSession
;
public
class ExampleMethod
extends DialogMethod
{
public ExampleMethod
(
)
{
super
(
"example"
)
;
}
@Override
public
void execute
(Player player,
String arg, DialogSession session
)
{
player.
sendMessage
(
"§aHello world, "
+ player.
getName
(
)
)
;
}
}
Once we have it, we must register it, for that we call the main class and use the method called "
registerMethods".
Code (Java):
CharacterDialoguePlugin characterDialogue
= CharacterDialoguePlugin.
getInstance
(
)
;
characterDialogue.
registerMethods
(
new ExampleMethod
(
)
)
;
And that's it! you've got it.