Skip to content

Instantly share code, notes, and snippets.

@Hiroku
Last active November 26, 2017 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hiroku/7b3f8ad72b325cdc8dced9d5273cfc81 to your computer and use it in GitHub Desktop.
Save Hiroku/7b3f8ad72b325cdc8dced9d5273cfc81 to your computer and use it in GitHub Desktop.
Example Dialogue construction
ArrayList<Dialogue> dialogues = new ArrayList<Dialogue>();
dialogues.add(Dialogue.builder()
.setName("Gus")
.setText("Hello, friend")
.build());
dialogues.add(Dialogue.builder()
.setName("")
.setText("What will you say?")
.addChoice(Choice.builder()
.setText("Hello, Gus")
// These responses may easily have further choices for elaborate dialogue trees. There is no imposed limit.
.setHandle(e -> e.reply(Dialogue.builder()
.setName("Gus")
.setText("Enjoy your day!")
.build()))
.build())
.addChoice(Choice.builder()
.setText("Shut up, Gus.")
.setHandle(e -> e.reply(Dialogue.builder()
.setName("Gus")
.setText("Wow, ok then.")
.build()))
.build())
.build());
// Will open the dialogue GUI immediately.
Dialogue.setPlayerDialogueData(player, dialogues, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment