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

@@ -109,6 +109,7 @@ public class L2Attackable extends L2Npc
private final Map<Integer, AbsorberInfo> _absorbersList = new ConcurrentHashMap<>();
// Misc
private boolean _mustGiveExpSp;
protected int _onKillDelay = 5000;
/**
* Creates an attackable NPC.
@@ -347,7 +348,7 @@ public class L2Attackable extends L2Npc
if ((killer != null) && killer.isPlayable())
{
// Delayed notification
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableKill(killer.getActingPlayer(), this, killer.isSummon()), this);
EventDispatcher.getInstance().notifyEventAsyncDelayed(new OnAttackableKill(killer.getActingPlayer(), this, killer.isSummon()), this, _onKillDelay);
}
// Notify to minions if there are.
@@ -1547,6 +1548,20 @@ public class L2Attackable extends L2Npc
return _seeded;
}
/**
* Set delay for onKill() call, in ms Default: 5000 ms
* @param delay
*/
public final void setOnKillDelay(int delay)
{
_onKillDelay = delay;
}
public final int getOnKillDelay()
{
return _onKillDelay;
}
/**
* Check if the server allows Random Animation.
*/

View File

@@ -2715,7 +2715,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
if (_attackByList == null)
{
_attackByList = new HashSet<>();
_attackByList = ConcurrentHashMap.newKeySet();
}
}
}
@@ -3178,7 +3178,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
*/
public void resetCurrentAbnormalVisualEffects()
{
final Collection<BuffInfo> passives = getEffectList().hasPassives() ? new ArrayList<>(getEffectList().getPassives().values()) : null;
final Collection<BuffInfo> passives = getEffectList().hasPassives() ? new ArrayList<>(getEffectList().getPassives()) : null;
//@formatter:off
final Set<AbnormalVisualEffect> abnormalVisualEffects = Stream.concat(getEffectList().getEffects().stream(), passives != null ? passives.stream() : Stream.empty())
.filter(Objects::nonNull)
@@ -5530,7 +5530,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
int _skiprange = 0;
int _skipgeo = 0;
int _skippeace = 0;
List<L2Character> targetList = new ArrayList<>(targets.length);
final List<L2Object> targetList = new ArrayList<>();
for (L2Object target : targets)
{
if (target instanceof L2Character)
@@ -5564,7 +5564,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
}
}
targetList.add((L2Character) target);
targetList.add(target);
}
}
if (targetList.isEmpty())

View File

@@ -18,10 +18,9 @@
*/
package com.l2jserver.gameserver.model.actor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import com.l2jserver.Config;
@@ -53,7 +52,7 @@ import com.l2jserver.gameserver.util.Util;
public abstract class L2Vehicle extends L2Character
{
protected int _dockId = 0;
protected final ArrayList<L2PcInstance> _passengers = new ArrayList<>();
protected final List<L2PcInstance> _passengers = new CopyOnWriteArrayList<>();
protected Location _oustLoc = null;
private Runnable _engine = null;
@@ -231,19 +230,8 @@ public abstract class L2Vehicle extends L2Character
public void oustPlayers()
{
L2PcInstance player;
// Use iterator because oustPlayer will try to remove player from _passengers
final Iterator<L2PcInstance> iter = _passengers.iterator();
while (iter.hasNext())
{
player = iter.next();
iter.remove();
if (player != null)
{
oustPlayer(player);
}
}
_passengers.forEach(p -> oustPlayer(p));
_passengers.clear();
}
public void oustPlayer(L2PcInstance player)
@@ -509,6 +497,11 @@ public abstract class L2Vehicle extends L2Character
return false;
}
@Override
public void detachAI()
{
}
@Override
public boolean isVehicle()
{

View File

@@ -22,10 +22,10 @@ import static com.l2jserver.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.InstanceType;
@@ -46,7 +46,7 @@ public final class L2AuctioneerInstance extends L2Npc
private static final int COND_BUSY_BECAUSE_OF_SIEGE = 1;
private static final int COND_REGULAR = 3;
private final Map<Integer, Auction> _pendingAuctions = new HashMap<>();
private final Map<Integer, Auction> _pendingAuctions = new ConcurrentHashMap<>();
public L2AuctioneerInstance(L2NpcTemplate template)
{

View File

@@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model.actor.instance;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import com.l2jserver.gameserver.enums.InstanceType;
@@ -56,10 +56,6 @@ public class L2ControlTowerInstance extends L2Tower
{
for (L2Spawn spawn : _guards)
{
if (spawn == null)
{
continue;
}
try
{
spawn.stopRespawn();
@@ -89,7 +85,7 @@ public class L2ControlTowerInstance extends L2Tower
{
if (_guards == null)
{
_guards = new ArrayList<>();
_guards = new CopyOnWriteArrayList<>();
}
}
}

View File

@@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.actor.instance;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.logging.Level;
@@ -574,19 +575,16 @@ public class L2DoorInstance extends L2Character
return getTemplate().getNodeZ() + getTemplate().getHeight();
}
public Collection<L2DefenderInstance> getKnownDefenders()
public List<L2DefenderInstance> getKnownDefenders()
{
ArrayList<L2DefenderInstance> result = new ArrayList<>();
Collection<L2Object> objs = getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
final List<L2DefenderInstance> result = new ArrayList<>();
for (L2Object obj : getKnownList().getKnownObjects().values())
{
if (obj instanceof L2DefenderInstance)
{
result.add((L2DefenderInstance) obj);
}
}
return result;
}

View File

@@ -18,7 +18,7 @@
*/
package com.l2jserver.gameserver.model.actor.instance;
import java.util.ArrayList;
import java.util.List;
import com.l2jserver.Config;
import com.l2jserver.gameserver.ThreadPoolManager;
@@ -127,7 +127,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
L2Spawn spawn = getSpawn();
if ((spawn != null) && canTalk())
{
ArrayList<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(getFort().getResidenceId());
List<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(getFort().getResidenceId());
for (FortSiegeSpawn spawn2 : commanders)
{
if (spawn2.getId() == spawn.getId())

View File

@@ -478,7 +478,7 @@ public final class L2PcInstance extends L2Playable
private int _bookmarkslot = 0; // The Teleport Bookmark Slot
private final Map<Integer, TeleportBookmark> _tpbookmarks = new HashMap<>();
private final Map<Integer, TeleportBookmark> _tpbookmarks = new ConcurrentHashMap<>();
private boolean _canFeed;
private boolean _isInSiege;
@@ -519,11 +519,11 @@ public final class L2PcInstance extends L2Playable
private Transform _transformation;
/** The table containing all L2RecipeList of the L2PcInstance */
private final Map<Integer, L2RecipeList> _dwarvenRecipeBook = new HashMap<>();
private final Map<Integer, L2RecipeList> _commonRecipeBook = new HashMap<>();
private final Map<Integer, L2RecipeList> _dwarvenRecipeBook = new ConcurrentHashMap<>();
private final Map<Integer, L2RecipeList> _commonRecipeBook = new ConcurrentHashMap<>();
/** Premium Items */
private final Map<Integer, L2PremiumItem> _premiumItems = new HashMap<>();
private final Map<Integer, L2PremiumItem> _premiumItems = new ConcurrentHashMap<>();
/** True if the L2PcInstance is sitting */
private boolean _waitTypeSitting;
@@ -581,7 +581,7 @@ public final class L2PcInstance extends L2Playable
private int _questNpcObject = 0;
/** The table containing all Quests began by the L2PcInstance */
private final Map<String, QuestState> _quests = new HashMap<>();
private final Map<String, QuestState> _quests = new ConcurrentHashMap<>();
/** The list containing all shortCuts of this player. */
private final ShortCuts _shortCuts = new ShortCuts(this);
@@ -589,8 +589,8 @@ public final class L2PcInstance extends L2Playable
/** The list containing all macros of this player. */
private final MacroList _macros = new MacroList(this);
private final List<L2PcInstance> _snoopListener = new ArrayList<>();
private final List<L2PcInstance> _snoopedPlayer = new ArrayList<>();
private final Set<L2PcInstance> _snoopListener = ConcurrentHashMap.newKeySet(1);
private final Set<L2PcInstance> _snoopedPlayer = ConcurrentHashMap.newKeySet(1);
// hennas
private final L2Henna[] _henna = new L2Henna[3];
@@ -710,7 +710,7 @@ public final class L2PcInstance extends L2Playable
/** The fists L2Weapon of the L2PcInstance (used when no weapon is equipped) */
private L2Weapon _fistsWeaponItem;
private final Map<Integer, String> _chars = new HashMap<>();
private final Map<Integer, String> _chars = new LinkedHashMap<>();
// private byte _updateKnownCounter = 0;
@@ -733,9 +733,9 @@ public final class L2PcInstance extends L2Playable
protected boolean _inventoryDisable = false;
/** Player's cubics. */
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>();
private final Map<Integer, L2CubicInstance> _cubics = new ConcurrentSkipListMap<>(); // TODO(Zoey76): This should be sorted in insert order.
/** Active shots. */
protected Set<Integer> _activeSoulShots = ConcurrentHashMap.newKeySet();
protected Set<Integer> _activeSoulShots = ConcurrentHashMap.newKeySet(1);
public final ReentrantLock soulShotLock = new ReentrantLock();
@@ -1535,7 +1535,7 @@ public final class L2PcInstance extends L2Playable
{
if (_notifyQuestOfDeathList == null)
{
_notifyQuestOfDeathList = new ArrayList<>();
_notifyQuestOfDeathList = new CopyOnWriteArrayList<>();
}
}
}
@@ -5924,7 +5924,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tamedBeast == null)
{
_tamedBeast = new ArrayList<>();
_tamedBeast = new CopyOnWriteArrayList<>();
}
_tamedBeast.add(tamedBeast);
}
@@ -6875,8 +6875,7 @@ public final class L2PcInstance extends L2Playable
su.addAttribute(StatusUpdate.KARMA, getKarma());
sendPacket(su);
final Collection<L2PcInstance> plrs = getKnownList().getKnownPlayers().values();
for (L2PcInstance player : plrs)
for (L2PcInstance player : getKnownList().getKnownPlayers().values())
{
if ((player == null) || !isVisibleFor(player))
{
@@ -8537,7 +8536,7 @@ public final class L2PcInstance extends L2Playable
}
// is AutoAttackable if both players are in the same duel and the duel is still going on
if (attacker.isPlayer() && (getDuelState() == Duel.DUELSTATE_DUELLING) && (getDuelId() == ((L2PcInstance) attacker).getDuelId()))
if (attacker.isPlayable() && (getDuelState() == Duel.DUELSTATE_DUELLING) && (getDuelId() == attacker.getActingPlayer().getDuelId()))
{
return true;
}
@@ -10491,7 +10490,7 @@ public final class L2PcInstance extends L2Playable
{
if (_subClasses == null)
{
_subClasses = new HashMap<>();
_subClasses = new ConcurrentSkipListMap<>();
}
return _subClasses;
@@ -11229,10 +11228,7 @@ public final class L2PcInstance extends L2Playable
public void addSnooper(L2PcInstance pci)
{
if (!_snoopListener.contains(pci))
{
_snoopListener.add(pci);
}
}
public void removeSnooper(L2PcInstance pci)
@@ -11242,10 +11238,7 @@ public final class L2PcInstance extends L2Playable
public void addSnooped(L2PcInstance pci)
{
if (!_snoopedPlayer.contains(pci))
{
_snoopedPlayer.add(pci);
}
}
public void removeSnooped(L2PcInstance pci)
@@ -13569,9 +13562,7 @@ public final class L2PcInstance extends L2Playable
return (int) time;
}
/**
* list of character friends
*/
/** Friend list. */
private final HashMap<Integer, Friend> _friendList = new HashMap<>();
private final ArrayList<Integer> _updateMemos = new ArrayList<>();

View File

@@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Future;
import java.util.logging.Level;
@@ -1024,7 +1025,7 @@ public class L2PetInstance extends L2Summon
int buff_index = 0;
final List<Integer> storedSkills = new ArrayList<>();
final List<Integer> storedSkills = new LinkedList<>();
// Store all effect data along with calculated remaining
if (storeEffects)
@@ -1068,11 +1069,7 @@ public class L2PetInstance extends L2Summon
ps2.setInt(5, ++buff_index);
ps2.execute();
if (!SummonEffectsTable.getInstance().getPetEffects().containsKey(getControlObjectId()))
{
SummonEffectsTable.getInstance().getPetEffects().put(getControlObjectId(), new ArrayList<SummonEffect>());
}
SummonEffectsTable.getInstance().getPetEffects().putIfAbsent(getControlObjectId(), new ArrayList<>());
SummonEffectsTable.getInstance().getPetEffects().get(getControlObjectId()).add(SummonEffectsTable.getInstance().new SummonEffect(skill, info.getTime()));
}
}
@@ -1109,7 +1106,7 @@ public class L2PetInstance extends L2Summon
{
if (!SummonEffectsTable.getInstance().getPetEffects().containsKey(getControlObjectId()))
{
SummonEffectsTable.getInstance().getPetEffects().put(getControlObjectId(), new ArrayList<SummonEffect>());
SummonEffectsTable.getInstance().getPetEffects().put(getControlObjectId(), new ArrayList<>());
}
SummonEffectsTable.getInstance().getPetEffects().get(getControlObjectId()).add(SummonEffectsTable.getInstance().new SummonEffect(skill, effectCurTime));

View File

@@ -46,7 +46,6 @@ public class L2RaceManagerInstance extends L2Npc
public static final int LANES = 8;
public static final int WINDOW_START = 0;
// private static List<Race> _history;
private static List<L2RaceManagerInstance> _managers;
protected static int _raceNumber = 4;
@@ -104,7 +103,6 @@ public class L2RaceManagerInstance extends L2Npc
{
_notInitialized = false;
// _history = new ArrayList<>();
_managers = new ArrayList<>();
ThreadPoolManager s = ThreadPoolManager.getInstance();
@@ -128,7 +126,6 @@ public class L2RaceManagerInstance extends L2Npc
s.scheduleGeneralAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (58 * SECOND), 10 * MINUTE);
s.scheduleGeneralAtFixedRate(new Announcement(SystemMessageId.THE_RACE_WILL_BEGIN_IN_S1_SECOND_S), (8 * MINUTE) + (59 * SECOND), 10 * MINUTE);
s.scheduleGeneralAtFixedRate(new Announcement(SystemMessageId.THEY_RE_OFF), 9 * MINUTE, 10 * MINUTE);
// */
}
_managers.add(this);
}

View File

@@ -21,11 +21,12 @@ package com.l2jserver.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -292,7 +293,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
int buff_index = 0;
final List<Integer> storedSkills = new ArrayList<>();
final List<Integer> storedSkills = new LinkedList<>();
// Store all effect data along with calculated remaining
if (storeEffects)
@@ -351,7 +352,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
}
if (!SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).put(getReferenceSkill(), new ArrayList<SummonEffect>());
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).put(getReferenceSkill(), new CopyOnWriteArrayList<SummonEffect>());
}
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).get(getReferenceSkill()).add(SummonEffectsTable.getInstance().new SummonEffect(skill, info.getTime()));
@@ -407,7 +408,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
}
if (!SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).put(getReferenceSkill(), new ArrayList<SummonEffect>());
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).put(getReferenceSkill(), new CopyOnWriteArrayList<SummonEffect>());
}
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).get(getReferenceSkill()).add(SummonEffectsTable.getInstance().new SummonEffect(skill, effectCurTime));

View File

@@ -20,8 +20,8 @@ package com.l2jserver.gameserver.model.actor.instance;
import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import com.l2jserver.gameserver.ThreadPoolManager;
@@ -204,7 +204,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
{
if (_beastSkills == null)
{
_beastSkills = new ArrayList<>();
_beastSkills = new CopyOnWriteArrayList<>();
}
_beastSkills.add(skill);
}

View File

@@ -21,6 +21,7 @@ package com.l2jserver.gameserver.model.actor.knownlist;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -204,10 +205,9 @@ public class CharKnownList extends ObjectKnownList
return (L2Character) super.getActiveObject();
}
public Collection<L2Character> getKnownCharacters()
public List<L2Character> getKnownCharacters()
{
ArrayList<L2Character> result = new ArrayList<>();
List<L2Character> result = new LinkedList<>();
final Collection<L2Object> objs = getKnownObjects().values();
for (L2Object obj : objs)
{

View File

@@ -19,7 +19,7 @@
package com.l2jserver.gameserver.model.actor.status;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -42,7 +42,7 @@ public class CharStatus
private double _currentMp = 0; // Current MP of the L2Character
/** Array containing all clients that need to be notified about hp/mp updates of the L2Character */
private Set<L2Character> _StatusListener;
private Set<L2Character> _statusListener;
private Future<?> _regTask;
@@ -106,11 +106,11 @@ public class CharStatus
*/
public final Set<L2Character> getStatusListener()
{
if (_StatusListener == null)
if (_statusListener == null)
{
_StatusListener = new CopyOnWriteArraySet<>();
_statusListener = ConcurrentHashMap.newKeySet();
}
return _StatusListener;
return _statusListener;
}
// place holder, only PcStatus has CP

View File

@@ -100,7 +100,7 @@ public final class CubicAction implements Runnable
boolean useCubicCure = false;
if ((_cubic.getId() >= L2CubicInstance.SMART_CUBIC_EVATEMPLAR) && (_cubic.getId() <= L2CubicInstance.SMART_CUBIC_SPECTRALMASTER))
{
for (BuffInfo info : _cubic.getOwner().getEffectList().getDebuffs().values())
for (BuffInfo info : _cubic.getOwner().getEffectList().getDebuffs())
{
if (info.getSkill().canBeDispeled())
{