Make use of Set when checking for contained objects.
This commit is contained in:
@ -278,7 +278,7 @@ public class Config
|
||||
public static boolean AUTO_LOOT_SLOT_LIMIT;
|
||||
public static int LOOT_RAIDS_PRIVILEGE_INTERVAL;
|
||||
public static int LOOT_RAIDS_PRIVILEGE_CC_SIZE;
|
||||
public static List<Integer> AUTO_LOOT_ITEM_IDS;
|
||||
public static Set<Integer> AUTO_LOOT_ITEM_IDS;
|
||||
public static boolean ENABLE_KEYBOARD_MOVEMENT;
|
||||
public static int UNSTUCK_INTERVAL;
|
||||
public static int TELEPORT_WATCHDOG_TIMEOUT;
|
||||
@ -454,7 +454,7 @@ public class Config
|
||||
public static boolean ALLOW_DISCARDITEM;
|
||||
public static int AUTODESTROY_ITEM_AFTER;
|
||||
public static int HERB_AUTO_DESTROY_TIME;
|
||||
public static List<Integer> LIST_PROTECTED_ITEMS;
|
||||
public static Set<Integer> LIST_PROTECTED_ITEMS;
|
||||
public static boolean DATABASE_CLEAN_UP;
|
||||
public static int CHAR_DATA_STORE_INTERVAL;
|
||||
public static int CLAN_VARIABLES_STORE_INTERVAL;
|
||||
@ -549,7 +549,7 @@ public class Config
|
||||
public static boolean ALT_OLY_LOG_FIGHTS;
|
||||
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
|
||||
public static boolean ALT_OLY_ANNOUNCE_GAMES;
|
||||
public static List<Integer> LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>();
|
||||
public static Set<Integer> LIST_OLY_RESTRICTED_ITEMS = new HashSet<>();
|
||||
public static int ALT_OLY_WEAPON_ENCHANT_LIMIT;
|
||||
public static int ALT_OLY_ARMOR_ENCHANT_LIMIT;
|
||||
public static int ALT_OLY_WAIT_TIME;
|
||||
@ -1195,9 +1195,9 @@ public class Config
|
||||
public static int AUTO_CP_PERCENTAGE;
|
||||
public static int AUTO_HP_PERCENTAGE;
|
||||
public static int AUTO_MP_PERCENTAGE;
|
||||
public static List<Integer> AUTO_CP_ITEM_IDS;
|
||||
public static List<Integer> AUTO_HP_ITEM_IDS;
|
||||
public static List<Integer> AUTO_MP_ITEM_IDS;
|
||||
public static Set<Integer> AUTO_CP_ITEM_IDS;
|
||||
public static Set<Integer> AUTO_HP_ITEM_IDS;
|
||||
public static Set<Integer> AUTO_MP_ITEM_IDS;
|
||||
public static boolean CUSTOM_STARTING_LOC;
|
||||
public static int CUSTOM_STARTING_LOC_X;
|
||||
public static int CUSTOM_STARTING_LOC_Y;
|
||||
@ -1207,7 +1207,7 @@ public class Config
|
||||
public static boolean ENABLE_RANDOM_MONSTER_SPAWNS;
|
||||
public static int MOB_MIN_SPAWN_RANGE;
|
||||
public static int MOB_MAX_SPAWN_RANGE;
|
||||
public static List<Integer> MOBS_LIST_NOT_RANDOM;
|
||||
public static Set<Integer> MOBS_LIST_NOT_RANDOM;
|
||||
public static boolean FREE_JUMPS_FOR_ALL;
|
||||
public static boolean CUSTOM_CB_ENABLED;
|
||||
public static int COMMUNITYBOARD_CURRENCY;
|
||||
@ -1226,7 +1226,7 @@ public class Config
|
||||
public static boolean COMMUNITY_PREMIUM_SYSTEM_ENABLED;
|
||||
public static int COMMUNITY_PREMIUM_COIN_ID;
|
||||
public static int COMMUNITY_PREMIUM_PRICE_PER_DAY;
|
||||
public static List<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
||||
public static Set<Integer> COMMUNITY_AVAILABLE_BUFFS;
|
||||
public static Map<String, Location> COMMUNITY_AVAILABLE_TELEPORTS;
|
||||
public static boolean CUSTOM_DEPOSITABLE_ENABLED;
|
||||
public static boolean CUSTOM_DEPOSITABLE_QUEST_ITEMS;
|
||||
@ -1868,7 +1868,7 @@ public class Config
|
||||
LOOT_RAIDS_PRIVILEGE_INTERVAL = characterConfig.getInt("RaidLootRightsInterval", 900) * 1000;
|
||||
LOOT_RAIDS_PRIVILEGE_CC_SIZE = characterConfig.getInt("RaidLootRightsCCSize", 45);
|
||||
final String[] autoLootItemIds = characterConfig.getString("AutoLootItemIds", "0").split(",");
|
||||
AUTO_LOOT_ITEM_IDS = new ArrayList<>(autoLootItemIds.length);
|
||||
AUTO_LOOT_ITEM_IDS = new HashSet<>(autoLootItemIds.length);
|
||||
for (String item : autoLootItemIds)
|
||||
{
|
||||
Integer itm = 0;
|
||||
@ -1988,7 +1988,7 @@ public class Config
|
||||
AUTODESTROY_ITEM_AFTER = generalConfig.getInt("AutoDestroyDroppedItemAfter", 600);
|
||||
HERB_AUTO_DESTROY_TIME = generalConfig.getInt("AutoDestroyHerbTime", 60) * 1000;
|
||||
final String[] split = generalConfig.getString("ListOfProtectedItems", "0").split(",");
|
||||
LIST_PROTECTED_ITEMS = new ArrayList<>(split.length);
|
||||
LIST_PROTECTED_ITEMS = new HashSet<>(split.length);
|
||||
for (String id : split)
|
||||
{
|
||||
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
|
||||
@ -2387,7 +2387,7 @@ public class Config
|
||||
if (!olyRestrictedItems.isEmpty())
|
||||
{
|
||||
final String[] olyRestrictedItemsSplit = olyRestrictedItems.split(",");
|
||||
LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>(olyRestrictedItemsSplit.length);
|
||||
LIST_OLY_RESTRICTED_ITEMS = new HashSet<>(olyRestrictedItemsSplit.length);
|
||||
for (String id : olyRestrictedItemsSplit)
|
||||
{
|
||||
LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
|
||||
@ -2532,17 +2532,17 @@ public class Config
|
||||
AUTO_CP_PERCENTAGE = autoPotionsConfig.getInt("AutoCpPercentage", 70);
|
||||
AUTO_HP_PERCENTAGE = autoPotionsConfig.getInt("AutoHpPercentage", 70);
|
||||
AUTO_MP_PERCENTAGE = autoPotionsConfig.getInt("AutoMpPercentage", 70);
|
||||
AUTO_CP_ITEM_IDS = new ArrayList<>();
|
||||
AUTO_CP_ITEM_IDS = new HashSet<>();
|
||||
for (String s : autoPotionsConfig.getString("AutoCpItemIds", "0").split(","))
|
||||
{
|
||||
AUTO_CP_ITEM_IDS.add(Integer.parseInt(s));
|
||||
}
|
||||
AUTO_HP_ITEM_IDS = new ArrayList<>();
|
||||
AUTO_HP_ITEM_IDS = new HashSet<>();
|
||||
for (String s : autoPotionsConfig.getString("AutoHpItemIds", "0").split(","))
|
||||
{
|
||||
AUTO_HP_ITEM_IDS.add(Integer.parseInt(s));
|
||||
}
|
||||
AUTO_MP_ITEM_IDS = new ArrayList<>();
|
||||
AUTO_MP_ITEM_IDS = new HashSet<>();
|
||||
for (String s : autoPotionsConfig.getString("AutoMpItemIds", "0").split(","))
|
||||
{
|
||||
AUTO_MP_ITEM_IDS.add(Integer.parseInt(s));
|
||||
@ -3153,7 +3153,7 @@ public class Config
|
||||
COMMUNITY_PREMIUM_COIN_ID = communityBoardConfig.getInt("CommunityPremiumBuyCoinId", 57);
|
||||
COMMUNITY_PREMIUM_PRICE_PER_DAY = communityBoardConfig.getInt("CommunityPremiumPricePerDay", 1000000);
|
||||
final String[] allowedBuffs = communityBoardConfig.getString("CommunityAvailableBuffs", "").split(",");
|
||||
COMMUNITY_AVAILABLE_BUFFS = new ArrayList<>(allowedBuffs.length);
|
||||
COMMUNITY_AVAILABLE_BUFFS = new HashSet<>(allowedBuffs.length);
|
||||
for (String s : allowedBuffs)
|
||||
{
|
||||
COMMUNITY_AVAILABLE_BUFFS.add(Integer.parseInt(s));
|
||||
@ -3459,7 +3459,7 @@ public class Config
|
||||
if (ENABLE_RANDOM_MONSTER_SPAWNS)
|
||||
{
|
||||
final String[] mobsIds = randomSpawnsConfig.getString("MobsSpawnNotRandom", "18812,18813,18814,22138").split(",");
|
||||
MOBS_LIST_NOT_RANDOM = new ArrayList<>(mobsIds.length);
|
||||
MOBS_LIST_NOT_RANDOM = new HashSet<>(mobsIds.length);
|
||||
for (String id : mobsIds)
|
||||
{
|
||||
MOBS_LIST_NOT_RANDOM.add(Integer.parseInt(id));
|
||||
|
@ -202,8 +202,7 @@ public class ClanHallData implements IXmlReader
|
||||
final Door door = DoorData.getInstance().getDoor(doorId);
|
||||
for (ClanHall ch : _clanHalls.values())
|
||||
{
|
||||
final List<Door> doors = ch.getDoors();
|
||||
if ((doors != null) && doors.contains(door))
|
||||
if (ch.getDoors().contains(door))
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
package org.l2jmobius.gameserver.data.xml;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
@ -42,7 +42,7 @@ public class FakePlayerData implements IXmlReader
|
||||
private final Map<Integer, FakePlayerHolder> _fakePlayerInfos = new HashMap<>();
|
||||
private final Map<String, String> _fakePlayerNames = new HashMap<>();
|
||||
private final Map<String, Integer> _fakePlayerIds = new HashMap<>();
|
||||
private final List<String> _talkableFakePlayerNames = new ArrayList<>();
|
||||
private final Set<String> _talkableFakePlayerNames = new HashSet<>();
|
||||
|
||||
protected FakePlayerData()
|
||||
{
|
||||
|
@ -18,7 +18,9 @@ package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
@ -49,7 +51,7 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public class SellBuffsManager implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
|
||||
private static final List<Integer> ALLOWED_BUFFS = new ArrayList<>();
|
||||
private static final Set<Integer> ALLOWED_BUFFS = new HashSet<>();
|
||||
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
|
||||
|
||||
protected SellBuffsManager()
|
||||
@ -76,11 +78,7 @@ public class SellBuffsManager implements IXmlReader
|
||||
{
|
||||
final Element elem = (Element) node.item(i);
|
||||
final int skillId = Integer.parseInt(elem.getAttribute("id"));
|
||||
|
||||
if (!ALLOWED_BUFFS.contains(skillId))
|
||||
{
|
||||
ALLOWED_BUFFS.add(skillId);
|
||||
}
|
||||
ALLOWED_BUFFS.add(skillId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,10 @@ package org.l2jmobius.gameserver.instancemanager;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
@ -67,7 +69,7 @@ public class WalkingManager implements IXmlReader
|
||||
public static final byte REPEAT_TELE_FIRST = 2;
|
||||
public static final byte REPEAT_RANDOM = 3;
|
||||
|
||||
private final List<Integer> _targetedNpcIds = new ArrayList<>();
|
||||
private final Set<Integer> _targetedNpcIds = new HashSet<>();
|
||||
private final Map<String, WalkRoute> _routes = new HashMap<>(); // all available routes
|
||||
private final Map<Integer, WalkInfo> _activeRoutes = new HashMap<>(); // each record represents NPC, moving by predefined route from _routes, and moving progress
|
||||
private final Map<Integer, NpcRoutesHolder> _routesToAttach = new HashMap<>(); // each record represents NPC and all available routes for it
|
||||
|
@ -19,9 +19,9 @@ package org.l2jmobius.gameserver.model;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -36,10 +36,11 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
public class BlockList
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(BlockList.class.getName());
|
||||
private static final Map<Integer, List<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||
|
||||
private static final Map<Integer, Set<Integer>> OFFLINE_LIST = new ConcurrentHashMap<>();
|
||||
|
||||
private final Player _owner;
|
||||
private List<Integer> _blockList;
|
||||
private Set<Integer> _blockList;
|
||||
|
||||
public BlockList(Player owner)
|
||||
{
|
||||
@ -68,9 +69,9 @@ public class BlockList
|
||||
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
|
||||
}
|
||||
|
||||
private static List<Integer> loadList(int objId)
|
||||
private static Set<Integer> loadList(int objId)
|
||||
{
|
||||
final List<Integer> list = new ArrayList<>();
|
||||
final Set<Integer> list = new HashSet<>();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
|
||||
{
|
||||
@ -158,7 +159,7 @@ public class BlockList
|
||||
_owner.setMessageRefusal(value);
|
||||
}
|
||||
|
||||
private List<Integer> getBlockList()
|
||||
private Set<Integer> getBlockList()
|
||||
{
|
||||
return _blockList;
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
@ -40,7 +42,7 @@ public class PetData
|
||||
private int _minLevel = Byte.MAX_VALUE;
|
||||
private int _maxLevel = 0;
|
||||
private boolean _syncLevel = false;
|
||||
private final List<Integer> _food = new ArrayList<>();
|
||||
private final Set<Integer> _food = new HashSet<>();
|
||||
|
||||
public PetData(int npcId, int itemId)
|
||||
{
|
||||
@ -133,7 +135,7 @@ public class PetData
|
||||
/**
|
||||
* @return the pet's food list.
|
||||
*/
|
||||
public List<Integer> getFood()
|
||||
public Set<Integer> getFood()
|
||||
{
|
||||
return _food;
|
||||
}
|
||||
|
@ -16,9 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
@ -40,12 +39,12 @@ public class SkillLearn
|
||||
private final int _getDualClassLevel;
|
||||
private final boolean _autoGet;
|
||||
private final long _levelUpSp;
|
||||
private final List<ItemHolder> _requiredItems = new ArrayList<>();
|
||||
private final List<Race> _races = new ArrayList<>();
|
||||
private final List<SkillHolder> _preReqSkills = new ArrayList<>();
|
||||
private final Set<ItemHolder> _requiredItems = new HashSet<>(1);
|
||||
private final Set<Race> _races = EnumSet.noneOf(Race.class);
|
||||
private final Set<SkillHolder> _preReqSkills = new HashSet<>(1);
|
||||
private SocialClass _socialClass;
|
||||
private final boolean _residenceSkill;
|
||||
private final List<Integer> _residenceIds = new ArrayList<>();
|
||||
private final Set<Integer> _residenceIds = new HashSet<>(1);
|
||||
private final boolean _learnedByNpc;
|
||||
private final boolean _learnedByFS;
|
||||
private final Set<Integer> _removeSkills = new HashSet<>(1);
|
||||
@ -133,9 +132,9 @@ public class SkillLearn
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list with the item holders required to acquire this skill.
|
||||
* @return the set with the item holders required to acquire this skill.
|
||||
*/
|
||||
public List<ItemHolder> getRequiredItems()
|
||||
public Set<ItemHolder> getRequiredItems()
|
||||
{
|
||||
return _requiredItems;
|
||||
}
|
||||
@ -150,9 +149,9 @@ public class SkillLearn
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list with the races that can acquire this skill.
|
||||
* @return a set with the races that can acquire this skill.
|
||||
*/
|
||||
public List<Race> getRaces()
|
||||
public Set<Race> getRaces()
|
||||
{
|
||||
return _races;
|
||||
}
|
||||
@ -167,9 +166,9 @@ public class SkillLearn
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of skill holders required to acquire this skill.
|
||||
* @return the set of skill holders required to acquire this skill.
|
||||
*/
|
||||
public List<SkillHolder> getPreReqSkills()
|
||||
public Set<SkillHolder> getPreReqSkills()
|
||||
{
|
||||
return _preReqSkills;
|
||||
}
|
||||
@ -212,9 +211,9 @@ public class SkillLearn
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a list with the Ids where this skill is available.
|
||||
* @return a set with the Ids where this skill is available.
|
||||
*/
|
||||
public List<Integer> getResidenceIds()
|
||||
public Set<Integer> getResidenceIds()
|
||||
{
|
||||
return _residenceIds;
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
@ -153,7 +152,7 @@ public class Pet extends Summon
|
||||
|
||||
broadcastStatusUpdate();
|
||||
|
||||
final List<Integer> foodIds = getPetData().getFood();
|
||||
final Set<Integer> foodIds = getPetData().getFood();
|
||||
if (foodIds.isEmpty())
|
||||
{
|
||||
if (isUncontrollable())
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -57,7 +57,7 @@ public class Trap extends Npc
|
||||
private boolean _isTriggered;
|
||||
private final int _lifeTime;
|
||||
private Player _owner;
|
||||
private final List<Integer> _playersWhoDetectedMe = new ArrayList<>();
|
||||
private final Set<Integer> _playersWhoDetectedMe = new HashSet<>();
|
||||
private final SkillHolder _skill;
|
||||
private int _remainingTime;
|
||||
// Tasks
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -69,11 +69,12 @@ public class PetFeedTask implements Runnable
|
||||
_player.sendPacket(SystemMessageId.YOU_ARE_OUT_OF_FEED_MOUNT_STATUS_CANCELED);
|
||||
}
|
||||
|
||||
final List<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
||||
final Set<Integer> foodIds = _player.getPetData(_player.getMountNpcId()).getFood();
|
||||
if (foodIds.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Item food = null;
|
||||
for (int id : foodIds)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@ -29,9 +29,9 @@ import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
*/
|
||||
public class ConditionPlayerInsideZoneId extends Condition
|
||||
{
|
||||
private final List<Integer> _zones;
|
||||
private final Set<Integer> _zones;
|
||||
|
||||
public ConditionPlayerInsideZoneId(List<Integer> zones)
|
||||
public ConditionPlayerInsideZoneId(Set<Integer> zones)
|
||||
{
|
||||
_zones = zones;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
@ -29,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
*/
|
||||
public class ConditionPlayerInstanceId extends Condition
|
||||
{
|
||||
private final List<Integer> _instanceIds;
|
||||
private final Set<Integer> _instanceIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player instance id.
|
||||
* @param instanceIds the instance ids
|
||||
*/
|
||||
public ConditionPlayerInstanceId(List<Integer> instanceIds)
|
||||
public ConditionPlayerInstanceId(Set<Integer> instanceIds)
|
||||
{
|
||||
_instanceIds = instanceIds;
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.Race;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
@ -28,13 +29,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
*/
|
||||
public class ConditionPlayerRace extends Condition
|
||||
{
|
||||
private final Race[] _races;
|
||||
private final Set<Race> _races;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition player race.
|
||||
* @param races the list containing the allowed races.
|
||||
*/
|
||||
public ConditionPlayerRace(Race[] races)
|
||||
public ConditionPlayerRace(Set<Race> races)
|
||||
{
|
||||
_races = races;
|
||||
}
|
||||
@ -46,6 +47,6 @@ public class ConditionPlayerRace extends Condition
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return CommonUtil.contains(_races, effector.getActingPlayer().getRace());
|
||||
return _races.contains(effector.getActingPlayer().getRace());
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
public class ConditionPlayerRangeFromNpc extends Condition
|
||||
{
|
||||
/** NPC Ids. */
|
||||
private final int[] _npcIds;
|
||||
private final Set<Integer> _npcIds;
|
||||
/** Radius to check. */
|
||||
private final int _radius;
|
||||
/** Expected value. */
|
||||
private final boolean _value;
|
||||
|
||||
public ConditionPlayerRangeFromNpc(int[] npcIds, int radius, boolean value)
|
||||
public ConditionPlayerRangeFromNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
_radius = radius;
|
||||
@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromNpc extends Condition
|
||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||
{
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||
{
|
||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()))
|
||||
if (_npcIds.contains(target.getId()))
|
||||
{
|
||||
existNpc = true;
|
||||
break;
|
||||
|
@ -16,7 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@ -30,13 +31,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||
{
|
||||
/** NPC Ids. */
|
||||
private final int[] _npcIds;
|
||||
private final Set<Integer> _npcIds;
|
||||
/** Radius to check. */
|
||||
private final int _radius;
|
||||
/** Expected value. */
|
||||
private final boolean _value;
|
||||
|
||||
public ConditionPlayerRangeFromSummonedNpc(int[] npcIds, int radius, boolean value)
|
||||
public ConditionPlayerRangeFromSummonedNpc(Set<Integer> npcIds, int radius, boolean value)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
_radius = radius;
|
||||
@ -47,11 +48,11 @@ public class ConditionPlayerRangeFromSummonedNpc extends Condition
|
||||
public boolean testImpl(Creature effector, Creature effected, Skill skill, ItemTemplate item)
|
||||
{
|
||||
boolean existNpc = false;
|
||||
if ((_npcIds != null) && (_npcIds.length > 0) && (_radius > 0))
|
||||
if (!_npcIds.isEmpty() && (_radius > 0))
|
||||
{
|
||||
for (Npc target : World.getInstance().getVisibleObjectsInRange(effector, Npc.class, _radius))
|
||||
{
|
||||
if (CommonUtil.contains(_npcIds, target.getId()) && (effector == target.getSummoner()))
|
||||
if (_npcIds.contains(target.getId()) && (effector == target.getSummoner()))
|
||||
{
|
||||
existNpc = true;
|
||||
break;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
*/
|
||||
public class ConditionTargetClassIdRestriction extends Condition
|
||||
{
|
||||
private final List<Integer> _classIds;
|
||||
private final Set<Integer> _classIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target class id restriction.
|
||||
* @param classId the class id
|
||||
*/
|
||||
public ConditionTargetClassIdRestriction(List<Integer> classId)
|
||||
public ConditionTargetClassIdRestriction(Set<Integer> classId)
|
||||
{
|
||||
_classIds = classId;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
@ -27,13 +27,13 @@ import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
*/
|
||||
public class ConditionTargetNpcId extends Condition
|
||||
{
|
||||
private final List<Integer> _npcIds;
|
||||
private final Set<Integer> _npcIds;
|
||||
|
||||
/**
|
||||
* Instantiates a new condition target npc id.
|
||||
* @param npcIds the npc ids
|
||||
*/
|
||||
public ConditionTargetNpcId(List<Integer> npcIds)
|
||||
public ConditionTargetNpcId(Set<Integer> npcIds)
|
||||
{
|
||||
_npcIds = npcIds;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.holders;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@ -25,9 +25,9 @@ public class EventDropHolder extends DropHolder
|
||||
{
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final Collection<Integer> _monsterIds;
|
||||
private final Set<Integer> _monsterIds;
|
||||
|
||||
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Collection<Integer> monsterIds)
|
||||
public EventDropHolder(int itemId, long min, long max, double chance, int minLevel, int maxLevel, Set<Integer> monsterIds)
|
||||
{
|
||||
super(null, itemId, min, max, chance);
|
||||
_minLevel = minLevel;
|
||||
@ -45,7 +45,7 @@ public class EventDropHolder extends DropHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public Collection<Integer> getMonsterIds()
|
||||
public Set<Integer> getMonsterIds()
|
||||
{
|
||||
return _monsterIds;
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ package org.l2jmobius.gameserver.model.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.ClassId;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
@ -42,7 +44,7 @@ public class Henna
|
||||
private final int _cancelCount;
|
||||
private final int _duration;
|
||||
private final List<Skill> _skills;
|
||||
private final List<ClassId> _wearClass;
|
||||
private final Set<ClassId> _wearClass;
|
||||
|
||||
public Henna(StatSet set)
|
||||
{
|
||||
@ -63,7 +65,7 @@ public class Henna
|
||||
_cancelCount = set.getInt("cancel_count");
|
||||
_duration = set.getInt("duration", -1);
|
||||
_skills = new ArrayList<>();
|
||||
_wearClass = new ArrayList<>();
|
||||
_wearClass = EnumSet.noneOf(ClassId.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +161,7 @@ public class Henna
|
||||
/**
|
||||
* @return the list with the allowed classes to wear this dye.
|
||||
*/
|
||||
public List<ClassId> getAllowedWearClass()
|
||||
public Set<ClassId> getAllowedWearClass()
|
||||
{
|
||||
return _wearClass;
|
||||
}
|
||||
|
@ -17,9 +17,10 @@
|
||||
package org.l2jmobius.gameserver.model.item.appearance;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.Race;
|
||||
@ -47,12 +48,12 @@ public class AppearanceStone
|
||||
private final ArmorType _armorType;
|
||||
private final AppearanceHandType _handType;
|
||||
private final AppearanceMagicType _magicType;
|
||||
private List<CrystalType> _crystalTypes;
|
||||
private List<AppearanceTargetType> _targetTypes;
|
||||
private List<Integer> _bodyParts;
|
||||
private List<Race> _races;
|
||||
private List<Race> _racesNot;
|
||||
private List<AppearanceHolder> _allVisualIds;
|
||||
private Set<CrystalType> _crystalTypes;
|
||||
private Set<AppearanceTargetType> _targetTypes;
|
||||
private Set<Integer> _bodyParts;
|
||||
private Set<Race> _races;
|
||||
private Set<Race> _racesNot;
|
||||
private Set<AppearanceHolder> _allVisualIds;
|
||||
|
||||
public AppearanceStone(StatSet set)
|
||||
{
|
||||
@ -172,35 +173,35 @@ public class AppearanceStone
|
||||
{
|
||||
if (_crystalTypes == null)
|
||||
{
|
||||
_crystalTypes = new ArrayList<>();
|
||||
_crystalTypes = EnumSet.noneOf(CrystalType.class);
|
||||
}
|
||||
_crystalTypes.add(type);
|
||||
}
|
||||
|
||||
public List<CrystalType> getCrystalTypes()
|
||||
public Set<CrystalType> getCrystalTypes()
|
||||
{
|
||||
return _crystalTypes != null ? _crystalTypes : Collections.emptyList();
|
||||
return _crystalTypes != null ? _crystalTypes : Collections.emptySet();
|
||||
}
|
||||
|
||||
public void addTargetType(AppearanceTargetType type)
|
||||
{
|
||||
if (_targetTypes == null)
|
||||
{
|
||||
_targetTypes = new ArrayList<>();
|
||||
_targetTypes = EnumSet.noneOf(AppearanceTargetType.class);
|
||||
}
|
||||
_targetTypes.add(type);
|
||||
}
|
||||
|
||||
public List<AppearanceTargetType> getTargetTypes()
|
||||
public Set<AppearanceTargetType> getTargetTypes()
|
||||
{
|
||||
return _targetTypes != null ? _targetTypes : Collections.emptyList();
|
||||
return _targetTypes != null ? _targetTypes : Collections.emptySet();
|
||||
}
|
||||
|
||||
public void addBodyPart(Integer part)
|
||||
{
|
||||
if (_bodyParts == null)
|
||||
{
|
||||
_bodyParts = new ArrayList<>();
|
||||
_bodyParts = new HashSet<>();
|
||||
}
|
||||
_bodyParts.add(part);
|
||||
}
|
||||
@ -209,47 +210,47 @@ public class AppearanceStone
|
||||
{
|
||||
if (_allVisualIds == null)
|
||||
{
|
||||
_allVisualIds = new ArrayList<>();
|
||||
_allVisualIds = new HashSet<>();
|
||||
}
|
||||
_allVisualIds.add(appearanceHolder);
|
||||
}
|
||||
|
||||
public List<AppearanceHolder> getVisualIds()
|
||||
public Set<AppearanceHolder> getVisualIds()
|
||||
{
|
||||
return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
|
||||
return _allVisualIds != null ? _allVisualIds : Collections.emptySet();
|
||||
}
|
||||
|
||||
public List<Integer> getBodyParts()
|
||||
public Set<Integer> getBodyParts()
|
||||
{
|
||||
return _bodyParts != null ? _bodyParts : Collections.emptyList();
|
||||
return _bodyParts != null ? _bodyParts : Collections.emptySet();
|
||||
}
|
||||
|
||||
public void addRace(Race race)
|
||||
{
|
||||
if (_races == null)
|
||||
{
|
||||
_races = new ArrayList<>();
|
||||
_races = EnumSet.noneOf(Race.class);
|
||||
}
|
||||
_races.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRaces()
|
||||
public Set<Race> getRaces()
|
||||
{
|
||||
return _races != null ? _races : Collections.emptyList();
|
||||
return _races != null ? _races : Collections.emptySet();
|
||||
}
|
||||
|
||||
public void addRaceNot(Race race)
|
||||
{
|
||||
if (_racesNot == null)
|
||||
{
|
||||
_racesNot = new ArrayList<>();
|
||||
_racesNot = EnumSet.noneOf(Race.class);
|
||||
}
|
||||
_racesNot.add(race);
|
||||
}
|
||||
|
||||
public List<Race> getRacesNot()
|
||||
public Set<Race> getRacesNot()
|
||||
{
|
||||
return _racesNot != null ? _racesNot : Collections.emptyList();
|
||||
return _racesNot != null ? _racesNot : Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -302,7 +303,7 @@ public class AppearanceStone
|
||||
{
|
||||
// Seems like in retail item with already changed appearance, can be changed again without being restored.
|
||||
|
||||
final AppearanceTargetType targetType = getTargetTypes().get(0);
|
||||
final AppearanceTargetType targetType = getTargetTypes().stream().findFirst().get();
|
||||
switch (targetType)
|
||||
{
|
||||
case NONE:
|
||||
|
@ -16,16 +16,16 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.item.enchant;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.item.ItemTemplate;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.item.type.CrystalType;
|
||||
import org.l2jmobius.gameserver.model.item.type.EtcItemType;
|
||||
import org.l2jmobius.gameserver.model.item.type.ItemType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@ -34,26 +34,27 @@ public abstract class AbstractEnchantItem
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(AbstractEnchantItem.class.getName());
|
||||
|
||||
private static final ItemType[] ENCHANT_TYPES = new ItemType[]
|
||||
private static final Set<EtcItemType> ENCHANT_TYPES = EnumSet.noneOf(EtcItemType.class);
|
||||
static
|
||||
{
|
||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM,
|
||||
EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP,
|
||||
EtcItemType.BLESS_ENCHT_AM,
|
||||
EtcItemType.BLESS_ENCHT_AM_DOWN,
|
||||
EtcItemType.BLESS_ENCHT_WP,
|
||||
EtcItemType.ENCHT_AM,
|
||||
EtcItemType.ENCHT_WP,
|
||||
EtcItemType.GIANT_ENCHT_AM,
|
||||
EtcItemType.GIANT_ENCHT_WP,
|
||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM,
|
||||
EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP,
|
||||
};
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_ANCIENT_CRYSTAL_ENCHANT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_AM_DOWN);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESS_ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESSED_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_AM);
|
||||
ENCHANT_TYPES.add(EtcItemType.BLESSED_GIANT_ENCHT_ATTR_INC_PROP_ENCHT_WP);
|
||||
}
|
||||
|
||||
private final int _id;
|
||||
private final CrystalType _grade;
|
||||
@ -71,7 +72,7 @@ public abstract class AbstractEnchantItem
|
||||
{
|
||||
throw new NullPointerException();
|
||||
}
|
||||
else if (!CommonUtil.contains(ENCHANT_TYPES, getItem().getItemType()))
|
||||
else if (!ENCHANT_TYPES.contains(getItem().getItemType()))
|
||||
{
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
|
@ -24,8 +24,10 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
@ -184,7 +186,7 @@ public class LongTimeEvent extends Quest
|
||||
final Node maxLevelNode = d.getAttributes().getNamedItem("maxLevel");
|
||||
final int maxLevel = maxLevelNode == null ? Integer.MAX_VALUE : Integer.parseInt(maxLevelNode.getNodeValue());
|
||||
final Node monsterIdsNode = d.getAttributes().getNamedItem("monsterIds");
|
||||
final List<Integer> monsterIds = new ArrayList<>();
|
||||
final Set<Integer> monsterIds = new HashSet<>();
|
||||
if (monsterIdsNode != null)
|
||||
{
|
||||
for (String id : monsterIdsNode.getNodeValue().split(","))
|
||||
|
@ -23,7 +23,9 @@ import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
@ -61,9 +63,9 @@ public class ClanHall extends AbstractResidence
|
||||
private final int _minBid;
|
||||
final int _lease;
|
||||
private final int _deposit;
|
||||
private final List<Integer> _npcs;
|
||||
private final List<Door> _doors;
|
||||
private final List<ClanHallTeleportHolder> _teleports;
|
||||
private final Set<Integer> _npcs = new HashSet<>();
|
||||
private final Set<Door> _doors = new HashSet<>();
|
||||
private final Set<ClanHallTeleportHolder> _teleports = new HashSet<>();
|
||||
private final Location _ownerLocation;
|
||||
private final Location _banishLocation;
|
||||
// Dynamic parameters
|
||||
@ -85,9 +87,21 @@ public class ClanHall extends AbstractResidence
|
||||
_minBid = params.getInt("minBid");
|
||||
_lease = params.getInt("lease");
|
||||
_deposit = params.getInt("deposit");
|
||||
_npcs = params.getList("npcList", Integer.class);
|
||||
_doors = params.getList("doorList", Door.class);
|
||||
_teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
||||
final List<Integer> npcs = params.getList("npcList", Integer.class);
|
||||
if (npcs != null)
|
||||
{
|
||||
_npcs.addAll(npcs);
|
||||
}
|
||||
final List<Door> doors = params.getList("doorList", Door.class);
|
||||
if (doors != null)
|
||||
{
|
||||
_doors.addAll(doors);
|
||||
}
|
||||
final List<ClanHallTeleportHolder> teleports = params.getList("teleportList", ClanHallTeleportHolder.class);
|
||||
if (teleports != null)
|
||||
{
|
||||
_teleports.addAll(teleports);
|
||||
}
|
||||
_ownerLocation = params.getLocation("owner_loc");
|
||||
_banishLocation = params.getLocation("banish_loc");
|
||||
// Set dynamic parameters (from DB)
|
||||
@ -196,7 +210,7 @@ public class ClanHall extends AbstractResidence
|
||||
* Gets all {@link Door} related to this {@link ClanHall}.
|
||||
* @return all {@link Door} related to this {@link ClanHall}
|
||||
*/
|
||||
public List<Door> getDoors()
|
||||
public Set<Door> getDoors()
|
||||
{
|
||||
return _doors;
|
||||
}
|
||||
@ -205,7 +219,7 @@ public class ClanHall extends AbstractResidence
|
||||
* Gets all {@link Npc} related to this {@link ClanHall}.
|
||||
* @return all {@link Npc} related to this {@link ClanHall}
|
||||
*/
|
||||
public List<Integer> getNpcs()
|
||||
public Set<Integer> getNpcs()
|
||||
{
|
||||
return _npcs;
|
||||
}
|
||||
@ -324,7 +338,7 @@ public class ClanHall extends AbstractResidence
|
||||
return _banishLocation;
|
||||
}
|
||||
|
||||
public List<ClanHallTeleportHolder> getTeleportList()
|
||||
public Set<ClanHallTeleportHolder> getTeleportList()
|
||||
{
|
||||
return _teleports;
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -82,7 +84,7 @@ public class Castle extends AbstractResidence
|
||||
private SiegeZone _zone = null;
|
||||
private ResidenceTeleportZone _teleZone;
|
||||
private Clan _formerOwner = null;
|
||||
private final List<Artefact> _artefacts = new ArrayList<>(1);
|
||||
private final Set<Artefact> _artefacts = new HashSet<>(1);
|
||||
private final Map<Integer, CastleFunction> _function = new ConcurrentHashMap<>();
|
||||
private int _ticketBuyCount = 0;
|
||||
private boolean _isFirstMidVictory = false;
|
||||
@ -1071,7 +1073,7 @@ public class Castle extends AbstractResidence
|
||||
_artefacts.add(artefact);
|
||||
}
|
||||
|
||||
public List<Artefact> getArtefacts()
|
||||
public Set<Artefact> getArtefacts()
|
||||
{
|
||||
return _artefacts;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
@ -27,19 +27,19 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class BlockListPacket implements IClientOutgoingPacket
|
||||
{
|
||||
private final List<Integer> _playersId;
|
||||
private final Set<Integer> _playerIds;
|
||||
|
||||
public BlockListPacket(List<Integer> playersId)
|
||||
public BlockListPacket(Set<Integer> playerIds)
|
||||
{
|
||||
_playersId = playersId;
|
||||
_playerIds = playerIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.BLOCK_LIST.writeId(packet);
|
||||
packet.writeD(_playersId.size());
|
||||
for (int playerId : _playersId)
|
||||
packet.writeD(_playerIds.size());
|
||||
for (int playerId : _playerIds)
|
||||
{
|
||||
packet.writeS(CharNameTable.getInstance().getNameById(playerId));
|
||||
packet.writeS(""); // memo ?
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
@ -37,7 +38,7 @@ public class ExAcquireSkillInfo implements IClientOutgoingPacket
|
||||
private final int _dualClassLevel;
|
||||
private final long _spCost;
|
||||
private final int _minLevel;
|
||||
private final List<ItemHolder> _itemReq;
|
||||
private final Set<ItemHolder> _itemReq;
|
||||
private final List<Skill> _skillRem;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,7 @@ public class ExChooseShapeShiftingItem implements IClientOutgoingPacket
|
||||
public ExChooseShapeShiftingItem(AppearanceStone stone)
|
||||
{
|
||||
_type = stone.getType();
|
||||
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().get(0);
|
||||
_targetType = stone.getTargetTypes().size() > 1 ? AppearanceTargetType.ALL : stone.getTargetTypes().stream().findFirst().get();
|
||||
_itemId = stone.getId();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -390,12 +391,12 @@ public abstract class DocumentBase
|
||||
case "races":
|
||||
{
|
||||
final String[] racesVal = a.getNodeValue().split(",");
|
||||
final Race[] races = new Race[racesVal.length];
|
||||
final Set<Race> races = EnumSet.noneOf(Race.class);
|
||||
for (int r = 0; r < racesVal.length; r++)
|
||||
{
|
||||
if (racesVal[r] != null)
|
||||
{
|
||||
races[r] = Race.valueOf(racesVal[r]);
|
||||
races.add(Race.valueOf(racesVal[r]));
|
||||
}
|
||||
}
|
||||
cond = joinAnd(cond, new ConditionPlayerRace(races));
|
||||
@ -671,13 +672,13 @@ public abstract class DocumentBase
|
||||
case "instanceid":
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
|
||||
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
final String item = st.nextToken().trim();
|
||||
array.add(Integer.decode(getValue(item, template)));
|
||||
set.add(Integer.decode(getValue(item, template)));
|
||||
}
|
||||
cond = joinAnd(cond, new ConditionPlayerInstanceId(array));
|
||||
cond = joinAnd(cond, new ConditionPlayerInstanceId(set));
|
||||
break;
|
||||
}
|
||||
case "agathionid":
|
||||
@ -728,10 +729,10 @@ public abstract class DocumentBase
|
||||
if (st.countTokens() == 3)
|
||||
{
|
||||
final String[] ids = st.nextToken().split(";");
|
||||
final int[] npcIds = new int[ids.length];
|
||||
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||
for (int index = 0; index < ids.length; index++)
|
||||
{
|
||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
||||
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||
}
|
||||
final int radius = Integer.parseInt(st.nextToken());
|
||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||
@ -745,10 +746,10 @@ public abstract class DocumentBase
|
||||
if (st.countTokens() == 3)
|
||||
{
|
||||
final String[] ids = st.nextToken().split(";");
|
||||
final int[] npcIds = new int[ids.length];
|
||||
final Set<Integer> npcIds = new HashSet<>(ids.length);
|
||||
for (int index = 0; index < ids.length; index++)
|
||||
{
|
||||
npcIds[index] = Integer.parseInt(getValue(ids[index], template));
|
||||
npcIds.add(Integer.parseInt(getValue(ids[index], template)));
|
||||
}
|
||||
final int radius = Integer.parseInt(st.nextToken());
|
||||
final boolean val = Boolean.parseBoolean(st.nextToken());
|
||||
@ -834,13 +835,13 @@ public abstract class DocumentBase
|
||||
case "insidezoneid":
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
||||
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
final String item = st.nextToken().trim();
|
||||
array.add(Integer.decode(getValue(item, template)));
|
||||
set.add(Integer.decode(getValue(item, template)));
|
||||
}
|
||||
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(array));
|
||||
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(set));
|
||||
break;
|
||||
}
|
||||
case "checkabnormal":
|
||||
@ -961,13 +962,13 @@ public abstract class DocumentBase
|
||||
case "class_id_restriction":
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
||||
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
final String item = st.nextToken().trim();
|
||||
array.add(Integer.decode(getValue(item, null)));
|
||||
set.add(Integer.decode(getValue(item, null)));
|
||||
}
|
||||
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(array));
|
||||
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(set));
|
||||
break;
|
||||
}
|
||||
case "active_effect_id":
|
||||
@ -1045,13 +1046,13 @@ public abstract class DocumentBase
|
||||
case "npcid":
|
||||
{
|
||||
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
|
||||
final List<Integer> array = new ArrayList<>(st.countTokens());
|
||||
final Set<Integer> set = new HashSet<>(st.countTokens());
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
final String item = st.nextToken().trim();
|
||||
array.add(Integer.decode(getValue(item, null)));
|
||||
set.add(Integer.decode(getValue(item, null)));
|
||||
}
|
||||
cond = joinAnd(cond, new ConditionTargetNpcId(array));
|
||||
cond = joinAnd(cond, new ConditionTargetNpcId(set));
|
||||
break;
|
||||
}
|
||||
case "npctype":
|
||||
|
Reference in New Issue
Block a user