Auto Minigame start

Discussion in 'Plugin Development' started by jmmalcolm3, Jun 28, 2015.

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


    Hi bukkit, I'm having trouble trying to start an arena of a game automatically after at least 3 people join. I'm saving them to a hashmap with their arena #, could that be useful? If anyone has a method or anything that could help, that'd be great! Thanks!
    Last edited: Jun 28, 2015
  2. Offline


    If you are using a Map with Player as key and arena number as value, you'll need to create an additional Map with arena number as key and a Collection of Players as value or the number of Players that joined as value. If you have a Map with the arena numbers and the Collection of Players in the arena, you can easily check what arena the Player is in with your first Map or what Players are in an arena with the second.
  3. @jmmalcolm3

    Just have a task running every tick, checking the amount of players in the lobby. If it hits 3 people, cancel the task and start the game. If you are storing them in a hashmap, you can check how many values you have in the hashmap using

    hashmap.keySet().size() - Returns how many keys you have(the k in HashMap<K, V>)
    hashmap.values().size() - Returns how many values you have(the v in HashMap<K, V>)
  4. Offline


    Something has to be fired when a person joins the arena. In there check if there is 3 people and then start it like that.
Thread Status:
Not open for further replies.

Share This Page