More chat listeners

Discussion in 'Spigot Plugin Development' started by zozidalom, May 17, 2016.

  1. So I would like to make a plugin that gives you questions and you have to answer it. But how can i do that if he has answered the first question only then shold he get the secound so there is a AsyncPlayerChatEvent and if the answer is good than give an other question and if the answer is again good give him reward... Please help me. How to creare more events that depend on eachother...
     
  2. There are many ways to do this; what have you tried so far?
     
  3. Hashmap with Player and Integer to know at what question he is currently at for example.
     
  4. You need to save that information. When the player gets a correct answer you could save that answer as being done and insert it as a Metadata value. After that, if they have the first question done: move on to the next one, etc. If the answer isn't "acceptable" you simply don't give them the metadata and they'll keep doing the question until it meets the requirements.
     
  5. I have a weird idea u can do a question and if the answer is equal to the answer it supposed to have you add him in a list and thats way u contineue the answers and if player is already in the list do the other question
     
  6. Conversation API?
     
    • Winner Winner x 1
  7. Or you could have an Map<UUID, Enum> and create an api yourself that deals with the player, have a method that is like runPlayerNext(String message, Player player); be the only one public so it would be easy, if the player doesn't exist in the map, add him, if he does exist in the map go to the next enum value etc etc, then when he's done the questions remove him. Maybe add a method startQuestioning(Player player); and stopQuestioning(Player player)
    Pretty simple idea, I might make an API to handle this and upload it publicly. IDK it seems like an interesting subject to handle with a simple 1 class API.
     
  8. 1 class, ConversationFactory