Currently the only idea I have of creating a queue system is by using java's Queue (java.util.Queue) and creating a runnable that goes every second and checks if the size is >= to 2 and then pairing the first 2 players together that way. Just curious if anyone has any better ideas of how to do this. (also there's 3 separate queues, 1v1, 3v3 and 6v6)
A follow up to that, with 3v3 and 6v6 queues, before a player gets added to a queue, they get a prompt to select ? players to join them in the fight and I want to send a request to a player saying "BlahBlah123 has invited you to join them in battle" "[Accept] [Decline]" I already know how to do the requests bit as I've done requests before, but how would I stop players from being added to the queue until all requests have been accepted
@WolfMage1 Make a new list for those. Or use a hashmap<uuid, boolean>, uuid is player, boolean is accepted
@WolfMage1 For the request issue, I would recommend doing the following: Create a new class called "PlayerRequest". This will store who sent the request, who the request is for, and an int which represents what should happen (waiting, accepted, declined). Automatically, set this int to 0. In the main class (or wherever you handle the requests), create a hashmap. The keys will be UUIDs, the values will be the PlayerRequests. When a request is sent, create a new entry in the Hashmap with all the data you need. When a player needs to accept/decline, check if the player is in the map. If they are, get the playerrequest and set the int equal to a value (1 being accepted, 2 being declined) Then, in your runnable, loop through all the entries in the map. If an entries int is equal to 0, continue. If it is 1 or 2, either accept or decline the request (send the message and do what you need) and then remove the value.
What about for 3v3 and 6v6, where I need to send the request to 3 or 6 people. And you said the key will be UUID's, but who's uuid will it be, sender of the request I'm guessing? EDIT: nevermind, I'm just being a dumbass, instead of storing individual requests I just store a list and iterate over it.