Atavism Version 2018.1AGIS API

atavism.server.plugins
Class VoicePlugin.VoiceConManager

java.lang.Object
  extended by atavism.server.plugins.VoicePlugin.VoiceConManager
Enclosing class:
VoicePlugin

public static class VoicePlugin.VoiceConManager
extends java.lang.Object

A class with locking to manage the Maps and Sets of connections. The data structure that holds the maps:

playerOid to VoiceConnection

playerOid to VoiceGroup

groupOid to VoiceGroup

instanceOid to set of groups with members in that instance


Field Summary
protected  java.util.concurrent.locks.Lock lock
           
 
Constructor Summary
VoicePlugin.VoiceConManager()
           
 
Method Summary
 void addGroup(OID groupOid, VoiceGroup group)
          Add a mapping from groupOid to group
 java.util.List<GroupMember> getAllPositionalGroupMembers()
          Get a list of all GroupMembers that are members of some PositionalVoiceGroup.
 VoiceGroup getGroup(OID groupOid)
          Get the group for the given groupOid.
 VoiceConnection getPlayerCon(OID playerOid)
          Get the VoiceConnection object for the player with the given oid.
 int getPlayerCount()
           
 VoiceGroup getPlayerGroup(OID playerOid)
          Get the group associated with the playerOid.
 PositionalGroupMember getPositionalMember(OID playerOid)
          If the player with the given oid is in a positional group, return its PositionalGroupMember; else return null.
 java.util.List<OID> groupPlayers(OID groupOid)
          Get a list of the players in a group.
 boolean maybeAddToGroupInstances(OID instanceOid, PositionalVoiceGroup group)
          If the group is not yet in the set of groups associated with the instanceOid, add it.
 java.util.Set<PositionalVoiceGroup> removeInstance(OID instanceOid)
          Remove the mapping from the instanceOid to the set of PositionalVoiceGroups, and return that set.
 void removePlayer(OID playerOid)
          Remove a player from all ConnecitonManager maps.
 void setPlayerCon(OID playerOid, VoiceConnection con)
          Create the mapping from playerOid to its VoiceConnection object.
 void setPlayerGroup(OID playerOid, VoiceGroup group)
          Create the mapping from the playerOid to the VoiceGroup that contains the player.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected transient java.util.concurrent.locks.Lock lock
Constructor Detail

VoicePlugin.VoiceConManager

public VoicePlugin.VoiceConManager()
Method Detail

addGroup

public void addGroup(OID groupOid,
                     VoiceGroup group)
Add a mapping from groupOid to group

Parameters:
groupOid - The oid of the group.
group - The group for which the mapping should be added.

groupPlayers

public java.util.List<OID> groupPlayers(OID groupOid)
Get a list of the players in a group.

Parameters:
groupOid - The oid of the group.
Returns:
A list of oids of the players in that group.

getGroup

public VoiceGroup getGroup(OID groupOid)
Get the group for the given groupOid.

Parameters:
groupOid - The oid of the group to be returned.
Returns:
The group with the given groupOid.

removePlayer

public void removePlayer(OID playerOid)
Remove a player from all ConnecitonManager maps.

Parameters:
playerOid - The oid of the player to be removed.

getPlayerCon

public VoiceConnection getPlayerCon(OID playerOid)
Get the VoiceConnection object for the player with the given oid.

Parameters:
playerOid - The oid of the player whose VoiceConnection should be returned.
Returns:
The VoiceConnection object corresponding to playerOid.

setPlayerCon

public void setPlayerCon(OID playerOid,
                         VoiceConnection con)
Create the mapping from playerOid to its VoiceConnection object.

Parameters:
playerOid - The oid of the player for which the mapping should be created.
con - The VoiceConnection to be associated with the playerOid.

setPlayerGroup

public void setPlayerGroup(OID playerOid,
                           VoiceGroup group)
Create the mapping from the playerOid to the VoiceGroup that contains the player.

Parameters:
playerOid - The oid of the player contained in the VoiceGroup.
group - The group to be associated with the playerOid.

getPlayerGroup

public VoiceGroup getPlayerGroup(OID playerOid)
Get the group associated with the playerOid.

Parameters:
playerOid - The oid of the player whose VoiceGroup should be returned.
Returns:
The VoiceGroup associated with the playerOid.

getPositionalMember

public PositionalGroupMember getPositionalMember(OID playerOid)
If the player with the given oid is in a positional group, return its PositionalGroupMember; else return null.

Parameters:
playerOid - The oid of the player whose member should be returned.
Returns:
The PositionalGroupMember associated with the playerOid, or null if there is none.

getAllPositionalGroupMembers

public java.util.List<GroupMember> getAllPositionalGroupMembers()
Get a list of all GroupMembers that are members of some PositionalVoiceGroup. Called by the update thread to get the positional group members, so it can iterate over them.

Returns:
The list of all GroupMembers of all PositionalVoiceGroups.

maybeAddToGroupInstances

public boolean maybeAddToGroupInstances(OID instanceOid,
                                        PositionalVoiceGroup group)
If the group is not yet in the set of groups associated with the instanceOid, add it.

Parameters:
instanceOid - The oid of the instance to which the group should be added.
group - The group to be added to the list of groups associated with this instanceOid.

removeInstance

public java.util.Set<PositionalVoiceGroup> removeInstance(OID instanceOid)
Remove the mapping from the instanceOid to the set of PositionalVoiceGroups, and return that set.

Parameters:
instanceOid - The oid of the instance whose mapping should be removed.
Returns:
the set of PositionalVoiceGroups formerly associated with the instanceOid.

getPlayerCount

public int getPlayerCount()


Copyright © 2018 Dragonsan Studios Sp. z o.o.