Sync with L2jServer Ertheia Mar 27th 2015.

This commit is contained in:
MobiusDev
2015-03-28 08:46:39 +00:00
parent a8a6d2153b
commit 855ced1dc5
23 changed files with 93 additions and 84 deletions

View File

@ -194,6 +194,7 @@ public final class Core extends AbstractNpcAI
npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SYSTEM_IS_BEING_SHUT_DOWN)); npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SYSTEM_IS_BEING_SHUT_DOWN));
npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.EMPTY)); npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.EMPTY));
_firstAttacked = false; _firstAttacked = false;
GrandBossManager.getInstance().setBossStatus(CORE, DEAD); GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
// Calculate Min and Max respawn times randomly. // Calculate Min and Max respawn times randomly.
long respawnTime = (Config.CORE_SPAWN_INTERVAL + getRandom(-Config.CORE_SPAWN_RANDOM, Config.CORE_SPAWN_RANDOM)) * 3600000; long respawnTime = (Config.CORE_SPAWN_INTERVAL + getRandom(-Config.CORE_SPAWN_RANDOM, Config.CORE_SPAWN_RANDOM)) * 3600000;

View File

@ -345,8 +345,8 @@ public class EnergySeeds extends AbstractNpcAI
private L2MonsterInstance spawnSupriseMob(L2Npc energy, int npcId) private L2MonsterInstance spawnSupriseMob(L2Npc energy, int npcId)
{ {
L2NpcTemplate surpriseMobTemplate = NpcData.getInstance().getTemplate(npcId); L2NpcTemplate surpriseMobTemplate = NpcData.getInstance().getTemplate(npcId);
L2MonsterInstance monster = new L2MonsterInstance(surpriseMobTemplate); L2MonsterInstance monster = new L2MonsterInstance(surpriseMobTemplate);
monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp()); monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp());
monster.setHeading(energy.getHeading()); monster.setHeading(energy.getHeading());
monster.setInstanceId(energy.getInstanceId()); monster.setInstanceId(energy.getInstanceId());

View File

@ -86,9 +86,9 @@ public class Lindvior extends AbstractNpcAI
} }
break; break;
case "start": case "start":
_lindviorCamera = SpawnTable.getInstance().getAnySpawn(LINDVIOR_CAMERA).getLastSpawn(); _lindviorCamera = SpawnTable.getInstance().findAny(LINDVIOR_CAMERA).getLastSpawn();
_tomaris = SpawnTable.getInstance().getAnySpawn(TOMARIS).getLastSpawn(); _tomaris = SpawnTable.getInstance().findAny(TOMARIS).getLastSpawn();
_artius = SpawnTable.getInstance().getAnySpawn(ARTIUS).getLastSpawn(); _artius = SpawnTable.getInstance().findAny(ARTIUS).getLastSpawn();
startQuestTimer("tomaris_shout1", 1000, _tomaris, null); startQuestTimer("tomaris_shout1", 1000, _tomaris, null);
startQuestTimer("artius_shout", 60000, _artius, null); startQuestTimer("artius_shout", 60000, _artius, null);

View File

@ -541,7 +541,6 @@ public class AdminTeleport implements IAdminCommandHandler
if ((obj instanceof L2Npc) && !((L2Npc) obj).isMinion() && !(obj instanceof L2RaidBossInstance) && !(obj instanceof L2GrandBossInstance)) if ((obj instanceof L2Npc) && !((L2Npc) obj).isMinion() && !(obj instanceof L2RaidBossInstance) && !(obj instanceof L2GrandBossInstance))
{ {
L2Npc target = (L2Npc) obj; L2Npc target = (L2Npc) obj;
L2Spawn spawn = target.getSpawn(); L2Spawn spawn = target.getSpawn();
if (spawn == null) if (spawn == null)
{ {

View File

@ -282,6 +282,6 @@ public final class Q00625_TheFinestIngredientsPart2 extends Quest
private static boolean isBumbalumpSpawned() private static boolean isBumbalumpSpawned()
{ {
return SpawnTable.getInstance().getAnySpawn(ICICLE_EMPEROR_BUMBALUMP) != null; return SpawnTable.getInstance().findAny(ICICLE_EMPEROR_BUMBALUMP) != null;
} }
} }

View File

@ -26,9 +26,9 @@ import com.l2jserver.gameserver.network.serverpackets.shuttle.ExShuttleMove;
*/ */
public class L2ShuttleAI extends L2VehicleAI public class L2ShuttleAI extends L2VehicleAI
{ {
public L2ShuttleAI(L2ShuttleInstance l2ShuttleInstance) public L2ShuttleAI(L2ShuttleInstance actor)
{ {
super(l2ShuttleInstance); super(actor);
} }
@Override @Override

View File

@ -389,11 +389,11 @@ public final class SpawnTable implements IXmlReader
} }
/** /**
* Gets a spawn for the given NPC ID. * Finds a spawn for the given NPC ID.
* @param npcId the NPC Id * @param npcId the NPC Id
* @return a spawn for the given NPC ID or {@code null} * @return a spawn for the given NPC ID or {@code null}
*/ */
public L2Spawn getAnySpawn(int npcId) public L2Spawn findAny(int npcId)
{ {
return getSpawns(npcId).stream().findFirst().orElse(null); return getSpawns(npcId).stream().findFirst().orElse(null);
} }

View File

@ -154,6 +154,7 @@ public final class AntiFeedManager
} }
final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode()); final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger()); final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger());
return connectionCount.getAndIncrement() < (max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, 0)); return connectionCount.getAndIncrement() < (max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, 0));

View File

@ -5587,7 +5587,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
abortCast(); abortCast();
return; return;
} }
mut.setTargets(targetList.toArray(new L2Character[targetList.size()])); mut.setTargets(targetList.toArray(new L2Object[targetList.size()]));
} }
// Ensure that a cast is in progress // Ensure that a cast is in progress

View File

@ -43,7 +43,12 @@ public class L2ShuttleInstance extends L2Vehicle
{ {
super(template); super(template);
setInstanceType(InstanceType.L2ShuttleInstance); setInstanceType(InstanceType.L2ShuttleInstance);
setAI(new L2ShuttleAI(this)); }
@Override
public L2ShuttleAI initAI()
{
return new L2ShuttleAI(this);
} }
public List<L2ShuttleStop> getStops() public List<L2ShuttleStop> getStops()

View File

@ -21,7 +21,7 @@ package com.l2jserver.gameserver.model.holders;
import java.time.DayOfWeek; import java.time.DayOfWeek;
/** /**
* Simple class for storing Reenter Data for Intances. * Simple class for storing Reenter Data for Instances.
* @author FallenAngel * @author FallenAngel
*/ */
public final class InstanceReenterTimeHolder public final class InstanceReenterTimeHolder

View File

@ -452,9 +452,11 @@ public final class Formulas
*/ */
public static final double calcCpRegen(L2PcInstance player) public static final double calcCpRegen(L2PcInstance player)
{ {
double cpRegenMultiplier = Config.CP_REGEN_MULTIPLIER;
// With CON bonus // With CON bonus
final double init = player.getActingPlayer().getTemplate().getBaseCpRegen(player.getLevel()) * player.getLevelMod() * BaseStats.CON.calcBonus(player); final double init = player.getActingPlayer().getTemplate().getBaseCpRegen(player.getLevel()) * player.getLevelMod() * BaseStats.CON.calcBonus(player);
double cpRegenMultiplier = Config.CP_REGEN_MULTIPLIER;
// Calculate Movement bonus
if (player.isSitting()) if (player.isSitting())
{ {
cpRegenMultiplier *= 1.5; // Sitting cpRegenMultiplier *= 1.5; // Sitting

View File

@ -99,6 +99,7 @@ public final class L2GamePacketHandler implements IPacketHandler<L2GameClient>,
{ {
return null; return null;
} }
int opcode = buf.get() & 0xFF; int opcode = buf.get() & 0xFF;
ReceivablePacket<L2GameClient> msg = null; ReceivablePacket<L2GameClient> msg = null;

View File

@ -21,6 +21,7 @@ package com.l2jserver.gameserver.network.clientpackets;
import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE; import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import com.l2jserver.Config; import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.impl.MultisellData; import com.l2jserver.gameserver.data.xml.impl.MultisellData;
@ -225,9 +226,10 @@ public class MultiSellChoose extends L2GameClientPacket
} }
} }
ArrayList<L2Augmentation> augmentation = new ArrayList<>(); List<L2Augmentation> augmentation = new ArrayList<>();
Elementals[] elemental = null; Elementals[] elemental = null;
/** All ok, remove items and add final product */ /** All ok, remove items and add final product */
for (Ingredient e : entry.getIngredients()) for (Ingredient e : entry.getIngredients())
{ {
if (e.getItemId() < 0) if (e.getItemId() < 0)

View File

@ -63,6 +63,7 @@ public final class RequestGiveItemToPet extends L2GameClientPacket
{ {
return; return;
} }
// Alt game - Karma punishment // Alt game - Karma punishment
if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0)) if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && (player.getKarma() > 0))
{ {

View File

@ -155,6 +155,7 @@ public final class RequestJoinParty extends L2GameClientPacket
private void addTargetToParty(L2PcInstance target, L2PcInstance requestor) private void addTargetToParty(L2PcInstance target, L2PcInstance requestor)
{ {
final L2Party party = requestor.getParty(); final L2Party party = requestor.getParty();
// summary of ppl already in party and ppl that get invitation // summary of ppl already in party and ppl that get invitation
if (!party.isLeader(requestor)) if (!party.isLeader(requestor))
{ {

View File

@ -53,7 +53,6 @@ public final class RequestRestart extends L2GameClientPacket
protected void runImpl() protected void runImpl()
{ {
final L2PcInstance player = getClient().getActiveChar(); final L2PcInstance player = getClient().getActiveChar();
if (player == null) if (player == null)
{ {
return; return;

View File

@ -153,6 +153,7 @@ public class CharSelectionInfo extends L2GameServerPacket
{ {
writeD(charInfoPackage.getPaperdollItemId(slot)); writeD(charInfoPackage.getPaperdollItemId(slot));
} }
for (int slot : getPaperdollOrderVisualId()) for (int slot : getPaperdollOrderVisualId())
{ {
writeD(charInfoPackage.getPaperdollItemVisualId(slot)); writeD(charInfoPackage.getPaperdollItemVisualId(slot));

View File

@ -76,7 +76,6 @@ public final class RelationChanged extends L2GameServerPacket
public RelationChanged() public RelationChanged()
{ {
_mask |= SEND_MULTI; _mask |= SEND_MULTI;
_multi = new ArrayList<>(); _multi = new ArrayList<>();
} }

View File

@ -418,14 +418,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createWeaponList(L2ItemInstance[] _items) private List<L2WarehouseItem> createWeaponList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if (item.isWeapon() || (item.getItem().getType2() == L2Item.TYPE2_WEAPON) || (item.isEtcItem() && (item.getItemType() == EtcItemType.ARROW)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if (item.isWeapon() || (item.getItem().getType2() == L2Item.TYPE2_WEAPON) || (item.isEtcItem() && (item.getItemType() == EtcItemType.ARROW)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -433,7 +433,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -443,14 +443,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createArmorList(L2ItemInstance[] _items) private List<L2WarehouseItem> createArmorList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if (item.isArmor() || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if (item.isArmor() || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -458,7 +458,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -468,14 +468,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createEtcItemList(L2ItemInstance[] _items) private List<L2WarehouseItem> createEtcItemList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if (item.isEtcItem() || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if (item.isEtcItem() || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -483,7 +483,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -493,14 +493,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createMatList(L2ItemInstance[] _items) private List<L2WarehouseItem> createMatList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.MATERIAL)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.MATERIAL)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -508,7 +508,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -518,14 +518,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createRecipeList(L2ItemInstance[] _items) private List<L2WarehouseItem> createRecipeList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.RECIPE)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.RECIPE)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -533,7 +533,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -543,14 +543,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createAmulettList(L2ItemInstance[] _items) private List<L2WarehouseItem> createAmulettList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getItemName().toUpperCase().startsWith("AMULET"))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getItemName().toUpperCase().startsWith("AMULET"))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -558,7 +558,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -568,14 +568,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createSpellbookList(L2ItemInstance[] _items) private List<L2WarehouseItem> createSpellbookList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (!item.getItemName().toUpperCase().startsWith("AMULET"))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (!item.getItemName().toUpperCase().startsWith("AMULET"))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -583,7 +583,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -593,14 +593,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createConsumableList(L2ItemInstance[] _items) private List<L2WarehouseItem> createConsumableList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && ((item.getEtcItem().getItemType() == EtcItemType.SCROLL) || (item.getEtcItem().getItemType() == EtcItemType.SHOT))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && ((item.getEtcItem().getItemType() == EtcItemType.SCROLL) || (item.getEtcItem().getItemType() == EtcItemType.SHOT))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -608,7 +608,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -618,14 +618,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createShotList(L2ItemInstance[] _items) private List<L2WarehouseItem> createShotList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SHOT)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SHOT)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -633,7 +633,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -643,14 +643,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createScrollList(L2ItemInstance[] _items) private List<L2WarehouseItem> createScrollList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SCROLL)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SCROLL)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -658,7 +658,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -668,14 +668,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createSeedList(L2ItemInstance[] _items) private List<L2WarehouseItem> createSeedList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SEED)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && (item.getEtcItem().getItemType() == EtcItemType.SEED)) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -683,7 +683,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -693,14 +693,14 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createOtherList(L2ItemInstance[] _items) private List<L2WarehouseItem> createOtherList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if ((item.isEtcItem() && ((item.getEtcItem().getItemType() != EtcItemType.MATERIAL) && (item.getEtcItem().getItemType() != EtcItemType.RECIPE) && (item.getEtcItem().getItemType() != EtcItemType.SCROLL) && (item.getEtcItem().getItemType() != EtcItemType.SHOT))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY)) if ((item.isEtcItem() && ((item.getEtcItem().getItemType() != EtcItemType.MATERIAL) && (item.getEtcItem().getItemType() != EtcItemType.RECIPE) && (item.getEtcItem().getItemType() != EtcItemType.SCROLL) && (item.getEtcItem().getItemType() != EtcItemType.SHOT))) || (item.getItem().getType2() == L2Item.TYPE2_MONEY))
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
@ -708,7 +708,7 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
} }
} }
} }
return _list; return list;
} }
/** /**
@ -718,19 +718,19 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
*/ */
private List<L2WarehouseItem> createAllList(L2ItemInstance[] _items) private List<L2WarehouseItem> createAllList(L2ItemInstance[] _items)
{ {
List<L2WarehouseItem> _list = new ArrayList<>(); List<L2WarehouseItem> list = new ArrayList<>();
for (L2ItemInstance item : _items) for (L2ItemInstance item : _items)
{ {
if (_list.size() < MAX_SORT_LIST_ITEMS) if (list.size() < MAX_SORT_LIST_ITEMS)
{ {
_list.add(new L2WarehouseItem(item)); list.add(new L2WarehouseItem(item));
} }
else else
{ {
continue; continue;
} }
} }
return _list; return list;
} }
@Override @Override

View File

@ -27,12 +27,12 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -60,8 +60,8 @@ public final class TaskManager
{ {
protected static final Logger _log = Logger.getLogger(TaskManager.class.getName()); protected static final Logger _log = Logger.getLogger(TaskManager.class.getName());
private final Map<Integer, Task> _tasks = new HashMap<>(); private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
protected final List<ExecutedTask> _currentTasks = new ArrayList<>(); protected final List<ExecutedTask> _currentTasks = new CopyOnWriteArrayList<>();
protected static final String[] SQL_STATEMENTS = protected static final String[] SQL_STATEMENTS =
{ {

View File

@ -301,17 +301,14 @@ public final class Util
/** /**
* (Based on implode() in PHP) * (Based on implode() in PHP)
* @param strArray - an array of strings to concatenate * @param strings an array of strings to concatenate
* @param strDelim - the delimiter to put between the strings * @param delimiter the delimiter to put between the strings
* @return a delimited string for a given array of string elements. * @return a delimited string for a given array of string elements.
*/ */
public static String implodeString(Iterable<String> strArray, String strDelim) public static String implodeString(Iterable<String> strings, String delimiter)
{ {
final StringJoiner sj = new StringJoiner(strDelim); final StringJoiner sj = new StringJoiner(delimiter);
for (String str : strArray) strings.forEach(sj::add);
{
sj.add(str);
}
return sj.toString(); return sj.toString();
} }

View File

@ -20,8 +20,8 @@ package com.l2jserver.loginserver;
import java.io.IOException; import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.Config; import com.l2jserver.Config;
@ -30,7 +30,7 @@ import com.l2jserver.Config;
*/ */
public class GameServerListener extends FloodProtectedListener public class GameServerListener extends FloodProtectedListener
{ {
private static List<GameServerThread> _gameServers = new ArrayList<>(); private static List<GameServerThread> _gameServers = new CopyOnWriteArrayList<>();
public GameServerListener() throws IOException public GameServerListener() throws IOException
{ {