Sync with L2jServer HighFive Mar 25th 2015.

This commit is contained in:
MobiusDev
2015-03-25 06:48:51 +00:00
parent e0c66b1412
commit 82606870c0
194 changed files with 2619 additions and 2869 deletions

View File

@@ -25,8 +25,11 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -109,7 +112,7 @@ public class L2Clan implements IIdentifiable, INamable
private String _name;
private int _clanId;
private L2ClanMember _leader;
private final Map<Integer, L2ClanMember> _members = new HashMap<>();
private final Map<Integer, L2ClanMember> _members = new ConcurrentHashMap<>();
private String _allyName;
private int _allyId;
@@ -130,16 +133,16 @@ public class L2Clan implements IIdentifiable, INamable
private int _bloodOathCount;
private final ItemContainer _warehouse = new ClanWarehouse(this);
private final List<Integer> _atWarWith = new ArrayList<>();
private final List<Integer> _atWarAttackers = new ArrayList<>();
private final List<Integer> _atWarWith = new CopyOnWriteArrayList<>();
private final List<Integer> _atWarAttackers = new CopyOnWriteArrayList<>();
private Forum _forum;
/** HashMap(Integer, L2Skill) containing all skills of the L2Clan */
private final Map<Integer, Skill> _skills = new HashMap<>();
private final Map<Integer, RankPrivs> _privs = new HashMap<>();
private final Map<Integer, SubPledge> _subPledges = new HashMap<>();
private final Map<Integer, Skill> _subPledgeSkills = new HashMap<>();
/** Map(Integer, L2Skill) containing all skills of the L2Clan */
private final Map<Integer, Skill> _skills = new ConcurrentHashMap<>();
private final Map<Integer, RankPrivs> _privs = new ConcurrentHashMap<>();
private final Map<Integer, SubPledge> _subPledges = new ConcurrentHashMap<>();
private final Map<Integer, Skill> _subPledgeSkills = new ConcurrentHashMap<>();
private int _reputationScore = 0;
private int _rank = 0;
@@ -609,9 +612,9 @@ public class L2Clan implements IIdentifiable, INamable
* @param exclude the object Id to exclude from list.
* @return all online members excluding the one with object id {code exclude}.
*/
public ArrayList<L2PcInstance> getOnlineMembers(int exclude)
public List<L2PcInstance> getOnlineMembers(int exclude)
{
final ArrayList<L2PcInstance> onlineMembers = new ArrayList<>();
final List<L2PcInstance> onlineMembers = new ArrayList<>();
for (L2ClanMember temp : _members.values())
{
if ((temp != null) && temp.isOnline() && (temp.getObjectId() != exclude))
@@ -1596,59 +1599,32 @@ public class L2Clan implements IIdentifiable, INamable
public boolean isAtWarWith(Integer id)
{
if (!_atWarWith.isEmpty())
{
if (_atWarWith.contains(id))
{
return true;
}
}
return false;
return _atWarWith.contains(id);
}
public boolean isAtWarWith(L2Clan clan)
{
if (clan == null)
{
return false;
}
if (!_atWarWith.isEmpty())
{
if (_atWarWith.contains(clan.getId()))
{
return true;
}
}
return false;
return _atWarWith.contains(clan.getId());
}
public boolean isAtWarAttacker(Integer id)
public boolean isAtWarAttacker(int id)
{
if ((_atWarAttackers != null) && !_atWarAttackers.isEmpty())
{
if (_atWarAttackers.contains(id))
{
return true;
}
}
return false;
return _atWarAttackers.contains(id);
}
public void setEnemyClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarWith.add(id);
_atWarWith.add(clan.getId());
}
public void setEnemyClan(Integer clan)
public void setEnemyClan(int id)
{
_atWarWith.add(clan);
_atWarWith.add(id);
}
public void setAttackerClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarAttackers.add(id);
_atWarAttackers.add(clan.getId());
}
public void setAttackerClan(Integer clan)
@@ -1658,14 +1634,12 @@ public class L2Clan implements IIdentifiable, INamable
public void deleteEnemyClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarWith.remove(id);
_atWarWith.remove(clan.getId());
}
public void deleteAttackerClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarAttackers.remove(id);
_atWarAttackers.remove(clan.getId());
}
public int getHiredGuards()
@@ -1680,11 +1654,7 @@ public class L2Clan implements IIdentifiable, INamable
public boolean isAtWar()
{
if ((_atWarWith != null) && !_atWarWith.isEmpty())
{
return true;
}
return false;
return (_atWarWith != null) && !_atWarWith.isEmpty();
}
public List<Integer> getWarList()
@@ -1871,11 +1841,6 @@ public class L2Clan implements IIdentifiable, INamable
*/
public final SubPledge[] getAllSubPledges()
{
if (_subPledges == null)
{
return new SubPledge[0];
}
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
}
@@ -2036,11 +2001,9 @@ public class L2Clan implements IIdentifiable, INamable
public void initializePrivs()
{
RankPrivs privs;
for (int i = 1; i < 10; i++)
{
privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false));
_privs.put(i, privs);
_privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)));
}
}
@@ -2988,9 +2951,9 @@ public class L2Clan implements IIdentifiable, INamable
return false;
}
public SubPledgeSkill[] getAllSubSkills()
public List<SubPledgeSkill> getAllSubSkills()
{
final ArrayList<SubPledgeSkill> list = new ArrayList<>();
final List<SubPledgeSkill> list = new LinkedList<>();
for (Skill skill : _subPledgeSkills.values())
{
list.add(new SubPledgeSkill(0, skill.getId(), skill.getLevel()));
@@ -3002,7 +2965,7 @@ public class L2Clan implements IIdentifiable, INamable
list.add(new SubPledgeSkill(subunit.getId(), skill.getId(), skill.getLevel()));
}
}
return list.toArray(new SubPledgeSkill[list.size()]);
return list;
}
public void setNewLeaderId(int objectId, boolean storeInDb)