Waiting untill a specific word has been sent.

Discussion in 'Plugin Development' started by Staartvin, Sep 18, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Staartvin

    I'm developing a plugin which will allow players to register themselfs.
    I want it that when you issue /register, it send you some text and wait for your answer.

    Something like this:

    "You're about to register for ..." "Are you sure? Type yes or no"

    How can I make that the plugin waits until a player types yes/no?

    Thanks,
    Staartvin
     
  2. HashSet. When a player registers send him the messge ("Are you sure...") and add his name to the set. Then, in the PlayerChatEvent, check if the set contains the players name, if so check if the message contains yes or no and if so react on that.
    But don't forget to kick players out of the set after some time (scheduler) else it may grow and grow cause players decide to never reply to that question...
     
  3. Offline

    Staartvin

    Wait, so what happens is: (I'm not familiar with HashSets,) (I only know Hashmaps)

    When a player issues /register, it adds the player's name to a Hashset. (And return out of the onCommand?)
    Then when a says yes/no, it will check if the player's name is in the hashset, and it will delete it.
    Then it will continue to the next question. (If the answer was 'yes', of course) ("What is your e-mail adress") for example.
    It will put the name of the player in a hashmap and will check if the player says something.

    And so on and on.

    Is this right? Or am I misunderstanding something?
     
Thread Status:
Not open for further replies.

Share This Page