02.06.2015, 18:42
That's nice to hear 
It would be nice to see it when you finished it.
@dusk: Yes, there is a very easy way to interact with dialogs. Please take a look at shoebill-common.
Here is a simple example:

It would be nice to see it when you finished it.
@dusk: Yes, there is a very easy way to interact with dialogs. Please take a look at shoebill-common.
Here is a simple example:
Код:
@Command
public boolean house(Player player) {
ListDialog.create(player, eventManager)
.caption("Your house")
.buttonCancel("Back")
.buttonOk("Next")
.item("Change house title", item -> {
InputDialog.create(player, eventManager)
.caption(item.getCurrentDialog().getCaption() + " - Change title")
.message("Please enter the new house title:")
.buttonCancel("Back")
.buttonOk("Ok")
.parentDialog(item.getCurrentDialog()) //set the parent dialog to the "Your House"-Dialog
.onClickCancel(AbstractDialog::showParentDialog) //show parent dialog when he presses cancel
.onClickOk((dialog, text) -> {
if(text.length() > 0) {
//Update house and database etc.
dialog.showParentDialog(); //show the parent dialog when the text changed successfully
} else {
player.sendMessage(Color.RED, "* The name is not valid!");
dialog.show();
}
})
.build()
.show();
})
.item("Change rent price", item -> {
//Implement
})
.item("Sell house", item -> {
player.sendMessage(Color.RED, "* You can't sell your house because there are still people in it.");
item.getCurrentDialog().show(); //Reshow Dialog
})
.onClickCancel(dialog -> {
player.sendMessage(Color.GREEN, "* You canceled the house editing.");
})
.build()
.show();
return true;
}

