Sync with L2jServer HighFive Mar 25th 2015.
This commit is contained in:
@ -18,8 +18,8 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.entity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@ -34,8 +34,8 @@ public class TvTEventTeam
|
||||
private int[] _coordinates = new int[3];
|
||||
/** The points of the team<br> */
|
||||
private short _points;
|
||||
/** Name and instance of all participated players in HashMap<br> */
|
||||
private Map<Integer, L2PcInstance> _participatedPlayers = new HashMap<>();
|
||||
/** Name and instance of all participated players in map. */
|
||||
private final Map<Integer, L2PcInstance> _participatedPlayers = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* C'tor initialize the team<br>
|
||||
@ -63,10 +63,7 @@ public class TvTEventTeam
|
||||
return false;
|
||||
}
|
||||
|
||||
synchronized (_participatedPlayers)
|
||||
{
|
||||
_participatedPlayers.put(playerInstance.getObjectId(), playerInstance);
|
||||
}
|
||||
_participatedPlayers.put(playerInstance.getObjectId(), playerInstance);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -77,10 +74,7 @@ public class TvTEventTeam
|
||||
*/
|
||||
public void removePlayer(int playerObjectId)
|
||||
{
|
||||
synchronized (_participatedPlayers)
|
||||
{
|
||||
_participatedPlayers.remove(playerObjectId);
|
||||
}
|
||||
_participatedPlayers.remove(playerObjectId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,7 +91,6 @@ public class TvTEventTeam
|
||||
public void cleanMe()
|
||||
{
|
||||
_participatedPlayers.clear();
|
||||
_participatedPlayers = new HashMap<>();
|
||||
_points = 0;
|
||||
}
|
||||
|
||||
@ -108,14 +101,7 @@ public class TvTEventTeam
|
||||
*/
|
||||
public boolean containsPlayer(int playerObjectId)
|
||||
{
|
||||
boolean containsPlayer;
|
||||
|
||||
synchronized (_participatedPlayers)
|
||||
{
|
||||
containsPlayer = _participatedPlayers.containsKey(playerObjectId);
|
||||
}
|
||||
|
||||
return containsPlayer;
|
||||
return _participatedPlayers.containsKey(playerObjectId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,20 +135,13 @@ public class TvTEventTeam
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns name and instance of all participated players in HashMap<br>
|
||||
* Returns name and instance of all participated players in FastMap<br>
|
||||
* <br>
|
||||
* @return Map<String, L2PcInstance>: map of players in this team<br>
|
||||
*/
|
||||
public Map<Integer, L2PcInstance> getParticipatedPlayers()
|
||||
{
|
||||
Map<Integer, L2PcInstance> participatedPlayers = null;
|
||||
|
||||
synchronized (_participatedPlayers)
|
||||
{
|
||||
participatedPlayers = _participatedPlayers;
|
||||
}
|
||||
|
||||
return participatedPlayers;
|
||||
return _participatedPlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,13 +151,6 @@ public class TvTEventTeam
|
||||
*/
|
||||
public int getParticipatedPlayerCount()
|
||||
{
|
||||
int participatedPlayerCount;
|
||||
|
||||
synchronized (_participatedPlayers)
|
||||
{
|
||||
participatedPlayerCount = _participatedPlayers.size();
|
||||
}
|
||||
|
||||
return participatedPlayerCount;
|
||||
return _participatedPlayers.size();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user