05.01.2016, 20:47
@Su37Erich: You should not do this, because your subclasses are not in relation to your base class. You can create an instance variable that will allow you to access an instance of your Test class. Here is an example:
You can then somewhere else access it like this:
Dialogs can be used like this:
PHP код:
public class Test extends Plugin {
private static Test instance;
public static Test getInstance() {
return instance;
}
@Override
public void onEnable() {
instance = this;
}
}
PHP код:
Test.getInstance().getEventManager().register(...);
PHP код:
MsgboxDialog.create(player, eventManager)
.caption("This is my dialog caption")
.message("Do you like this server?")
.buttonOk("Yes")
.buttonCancel("No")
.onClickOk((dialog) -> {
player.sendMessage("That's nice to hear!");
})
.onClickCancel((dialog) -> {
player.sendMessage("That's a shame :(");
})
.build()
.show();