[Unsolved] Verify Command

Discussion in 'Plugin Development' started by MrSparkzz, Oct 14, 2013.

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


    So I've done this before, and the way I did it was make an ArrayList that contains a player.
    I also had it set to a cooldown so after a certain amount of time, you would have to enter the command again to restart the cooldown and get a chance to continue the command.

    Basically what I'm trying to do is this:

    Player enters command "/command"
    Server returns "Are you sure you want to perform this command?"
    Player enters command "/command yes" or "/command no"
    Server runs code

    I just feel that it's a wast of an ArrayList as well as RAM for just one player.
  2. Offline


    MrSparkzz Take a look at the Conversation API. I've never personally used it, so I probably can't help you with anything more specific.

    On an unrelated note, I don't understand the purpose of your signature.
  3. Offline


    it's a boolean, which sets isMrSparkzzRight to true then it checks to see if for whatever reason I'm not right, then it sets me to right. So basically, even when I'm wrong, I'm right.
  4. Offline


    So then instead of returning true, wouldn't you want to put isMrSparkzzRight = true
  5. Offline


    You're thinking too hard about it D: But yeah, I'll change it ;p I just wanted it to be super simple and short
  6. Offline


    Store a HashMap with the player's name as the key, and Integer as the value
    1. HashMap<String, Integer> PlayersNeedingConfirmation = new HashMap<String, Integer>();

    In onCommand, check if there is a value by the player's name. If there isn't, add the player's name with the value of the timeout you'd like. If there is, remove the player's name from the HashMap and execute.

    In your onEnable, have a repeating task that counts down all values in the HashMap. If the value is zero, remove the player's name.
  7. Offline


    I might sound really stupid but y don't you give the player a temp perm that he gets when typing the command and then remove the perm when using the other command?
  8. Offline


    add the player to a set list and when the player types /command yes - leave him on that list and do whatever but when the player types /command no - remove him from the list...
    I'm not 100% sure this will work though.
Thread Status:
Not open for further replies.

Share This Page