Currently I am writing a chat channel for my game. Players can create chat channels and others can join it. This is what I have so far but i do not know how to return the collection of players. MultiHashMap is deprecated and it told me to use MultiValueMap instead on the commons.apache docs.
private static MultiMap<Channel, Client> channels;
now in my constructor it creates channels
public Channel(Client owner) {
this.owner = owner;
channels = new MultiValueMap<>();
}
What i'm trying to do is return the collection of players. This does not work...
public static boolean create(Client player) {
Channel channel = new Channel(player);
channels.get(channel).get(player).bla();
return true;
}
Help is appreciated. I tried using a MultiKeyMap but the problem with that is that I cannot create Channels unless they take 2 parameters for the key and 1 for the value which is not what I need. If theres a better alternative please let me know.