cleanup: use implicit generic type with diamond operator
This commit is contained in:
@@ -36,8 +36,8 @@ public class MapleShopFactory {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Map<Integer, MapleShop> shops = new HashMap<Integer, MapleShop>();
|
||||
private Map<Integer, MapleShop> npcShops = new HashMap<Integer, MapleShop>();
|
||||
private Map<Integer, MapleShop> shops = new HashMap<>();
|
||||
private Map<Integer, MapleShop> npcShops = new HashMap<>();
|
||||
|
||||
private MapleShop loadShop(int id, boolean isShopId) {
|
||||
MapleShop ret = MapleShop.createFromDB(id, isShopId);
|
||||
|
||||
@@ -181,7 +181,7 @@ public class MapleStatEffect {
|
||||
ret.prop = iprop / 100.0;
|
||||
|
||||
ret.cp = MapleDataTool.getInt("cp", source, 0);
|
||||
List<MapleDisease> cure = new ArrayList<MapleDisease>(5);
|
||||
List<MapleDisease> cure = new ArrayList<>(5);
|
||||
if (MapleDataTool.getInt("poison", source, 0) > 0) {
|
||||
cure.add(MapleDisease.POISON);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,7 @@
|
||||
*/
|
||||
package server;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -59,7 +54,7 @@ public class ThreadManager {
|
||||
RejectedExecutionHandler reh = new RejectedExecutionHandlerImpl();
|
||||
ThreadFactory tf = Executors.defaultThreadFactory();
|
||||
|
||||
tpe = new ThreadPoolExecutor(20, 1000, 77, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50), tf, reh);
|
||||
tpe = new ThreadPoolExecutor(20, 1000, 77, TimeUnit.SECONDS, new ArrayBlockingQueue<>(50), tf, reh);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MapleCoconut extends MapleEvent {
|
||||
private int countBombing = 80;
|
||||
private int countFalling = 401;
|
||||
private int countStopped = 20;
|
||||
private List<MapleCoconuts> coconuts = new LinkedList<MapleCoconuts>();
|
||||
private List<MapleCoconuts> coconuts = new LinkedList<>();
|
||||
|
||||
public MapleCoconut(MapleMap map) {
|
||||
super(1, 50);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MapleSnowball {
|
||||
private boolean hittable = false;
|
||||
private int team;
|
||||
private boolean winner = false;
|
||||
List<MapleCharacter> characters = new LinkedList<MapleCharacter>();
|
||||
List<MapleCharacter> characters = new LinkedList<>();
|
||||
|
||||
public MapleSnowball(int team, MapleMap map) {
|
||||
this.map = map;
|
||||
|
||||
@@ -172,7 +172,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
public void addSummonedMob(MapleMonster mob) {
|
||||
Set<Integer> calledOids = this.calledMobOids;
|
||||
if (calledOids == null) {
|
||||
calledOids = Collections.synchronizedSet(new HashSet<Integer>());
|
||||
calledOids = Collections.synchronizedSet(new HashSet<>());
|
||||
this.calledMobOids = calledOids;
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
||||
}
|
||||
|
||||
public final void dispelSkill(final MobSkill skillId) {
|
||||
List<MonsterStatus> toCancel = new ArrayList<MonsterStatus>();
|
||||
List<MonsterStatus> toCancel = new ArrayList<>();
|
||||
for (Entry<MonsterStatus, MonsterStatusEffect> effects : stati.entrySet()) {
|
||||
MonsterStatusEffect mse = effects.getValue();
|
||||
if (mse.getMobSkill() != null && mse.getMobSkill().getSkillId() == skillId.getSkillId()) { //not checking for level.
|
||||
|
||||
@@ -228,13 +228,13 @@ public class MapleMonsterInformationProvider {
|
||||
|
||||
public static ArrayList<Pair<Integer, String>> getMobsIDsFromName(String search) {
|
||||
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz"));
|
||||
ArrayList<Pair<Integer, String>> retMobs = new ArrayList<Pair<Integer, String>>();
|
||||
ArrayList<Pair<Integer, String>> retMobs = new ArrayList<>();
|
||||
MapleData data = dataProvider.getData("Mob.img");
|
||||
List<Pair<Integer, String>> mobPairList = new LinkedList<Pair<Integer, String>>();
|
||||
List<Pair<Integer, String>> mobPairList = new LinkedList<>();
|
||||
for (MapleData mobIdData : data.getChildren()) {
|
||||
int mobIdFromData = Integer.parseInt(mobIdData.getName());
|
||||
String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME");
|
||||
mobPairList.add(new Pair<Integer, String>(mobIdFromData, mobNameFromData));
|
||||
mobPairList.add(new Pair<>(mobIdFromData, mobNameFromData));
|
||||
}
|
||||
for (Pair<Integer, String> mobPair : mobPairList) {
|
||||
if (mobPair.getRight().toLowerCase().contains(search.toLowerCase())) {
|
||||
|
||||
@@ -37,11 +37,11 @@ public class MapleMonsterStats {
|
||||
public int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive = -1, removeAfter;
|
||||
public boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
||||
public String name;
|
||||
public Map<String, Integer> animationTimes = new HashMap<String, Integer>();
|
||||
public Map<Element, ElementalEffectiveness> resistance = new HashMap<Element, ElementalEffectiveness>();
|
||||
public Map<String, Integer> animationTimes = new HashMap<>();
|
||||
public Map<Element, ElementalEffectiveness> resistance = new HashMap<>();
|
||||
public List<Integer> revives = Collections.emptyList();
|
||||
public byte tagColor, tagBgColor;
|
||||
public List<Pair<Integer, Integer>> skills = new ArrayList<Pair<Integer, Integer>>();
|
||||
public List<Pair<Integer, Integer>> skills = new ArrayList<>();
|
||||
public Pair<Integer, Integer> cool = null;
|
||||
public BanishInfo banish = null;
|
||||
public List<loseItem> loseItem = null;
|
||||
@@ -267,7 +267,7 @@ public class MapleMonsterStats {
|
||||
|
||||
public void addLoseItem(loseItem li) {
|
||||
if (loseItem == null) {
|
||||
loseItem = new LinkedList<loseItem>();
|
||||
loseItem = new LinkedList<>();
|
||||
}
|
||||
loseItem.add(li);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.Map;
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class MobAttackInfoFactory {
|
||||
private static Map<String, MobAttackInfo> mobAttacks = new HashMap<String, MobAttackInfo>();
|
||||
private static Map<String, MobAttackInfo> mobAttacks = new HashMap<>();
|
||||
private static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Mob.wz"));
|
||||
|
||||
public static MobAttackInfo getMobAttackInfo(MapleMonster mob, int attack) {
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.*;
|
||||
public class MobSkill {
|
||||
|
||||
private int skillId, skillLevel, mpCon;
|
||||
private List<Integer> toSummon = new ArrayList<Integer>();
|
||||
private List<Integer> toSummon = new ArrayList<>();
|
||||
private int spawnEffect, hp, x, y;
|
||||
private long duration, cooltime;
|
||||
private float prop;
|
||||
@@ -117,8 +117,8 @@ public class MobSkill {
|
||||
|
||||
public void applyEffect(MapleCharacter player, MapleMonster monster, boolean skill, List<MapleCharacter> banishPlayers) {
|
||||
MapleDisease disease = null;
|
||||
Map<MonsterStatus, Integer> stats = new ArrayMap<MonsterStatus, Integer>();
|
||||
List<Integer> reflection = new LinkedList<Integer>();
|
||||
Map<MonsterStatus, Integer> stats = new ArrayMap<>();
|
||||
List<Integer> reflection = new LinkedList<>();
|
||||
switch (skillId) {
|
||||
case 100:
|
||||
case 110:
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class MobSkillFactory {
|
||||
|
||||
private static Map<String, MobSkill> mobSkills = new HashMap<String, MobSkill>();
|
||||
private static Map<String, MobSkill> mobSkills = new HashMap<>();
|
||||
private final static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||
private static MapleData skillRoot = dataSource.getData("MobSkill.img");
|
||||
private final static MonitoredReentrantReadWriteLock dataLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.MOBSKILL_FACTORY);
|
||||
@@ -71,7 +71,7 @@ public class MobSkillFactory {
|
||||
MapleData skillData = skillRoot.getChildByPath(skillId + "/level/" + level);
|
||||
if (skillData != null) {
|
||||
int mpCon = MapleDataTool.getInt(skillData.getChildByPath("mpCon"), 0);
|
||||
List<Integer> toSummon = new ArrayList<Integer>();
|
||||
List<Integer> toSummon = new ArrayList<>();
|
||||
for (int i = 0; i > -1; i++) {
|
||||
if (skillData.getChildByPath(String.valueOf(i)) == null) {
|
||||
break;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
package server.maps;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -35,7 +35,7 @@ public class MapleFootholdTree {
|
||||
private MapleFootholdTree ne = null;
|
||||
private MapleFootholdTree sw = null;
|
||||
private MapleFootholdTree se = null;
|
||||
private List<MapleFoothold> footholds = new LinkedList<MapleFoothold>();
|
||||
private List<MapleFoothold> footholds = new LinkedList<>();
|
||||
private Point p1;
|
||||
private Point p2;
|
||||
private Point center;
|
||||
@@ -96,7 +96,7 @@ public class MapleFootholdTree {
|
||||
}
|
||||
|
||||
private List<MapleFoothold> getRelevants(Point p) {
|
||||
return getRelevants(p, new LinkedList<MapleFoothold>());
|
||||
return getRelevants(p, new LinkedList<>());
|
||||
}
|
||||
|
||||
private List<MapleFoothold> getRelevants(Point p, List<MapleFoothold> list) {
|
||||
@@ -161,7 +161,7 @@ public class MapleFootholdTree {
|
||||
|
||||
public MapleFoothold findBelow(Point p) {
|
||||
List<MapleFoothold> relevants = getRelevants(p);
|
||||
List<MapleFoothold> xMatches = new LinkedList<MapleFoothold>();
|
||||
List<MapleFoothold> xMatches = new LinkedList<>();
|
||||
for (MapleFoothold fh : relevants) {
|
||||
if (fh.getX1() <= p.x && fh.getX2() >= p.x) {
|
||||
xMatches.add(fh);
|
||||
|
||||
@@ -82,8 +82,8 @@ public class MapleMap {
|
||||
|
||||
private Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
||||
private Set<Integer> selfDestructives = new LinkedHashSet<>();
|
||||
private Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<SpawnPoint>());
|
||||
private Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<SpawnPoint>());
|
||||
private Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||
private Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||
private AtomicInteger spawnedMonstersOnMap = new AtomicInteger(0);
|
||||
private AtomicInteger droppedItemCount = new AtomicInteger(0);
|
||||
private Collection<MapleCharacter> characters = new LinkedHashSet<>();
|
||||
@@ -2500,7 +2500,7 @@ public class MapleMap {
|
||||
broadcastGMSpawnPlayerMapObjectMessage(chr, chr, true);
|
||||
chr.announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
|
||||
|
||||
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
|
||||
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<>(MapleBuffStat.DARKSIGHT, 0));
|
||||
broadcastGMMessage(chr, MaplePacketCreator.giveForeignBuff(chr.getId(), dsstat), false);
|
||||
} else {
|
||||
broadcastSpawnPlayerMapObjectMessage(chr, chr, true);
|
||||
@@ -4346,7 +4346,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public final void addMobSpawn(int mobId, int spendCP) {
|
||||
this.mobsToSpawn.add(new Pair<Integer, Integer>(mobId, spendCP));
|
||||
this.mobsToSpawn.add(new Pair<>(mobId, spendCP));
|
||||
}
|
||||
|
||||
public final List<Pair<Integer, Integer>> getMobsToSpawn() {
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.Map;
|
||||
|
||||
public class MapleReactorFactory {
|
||||
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Reactor.wz"));
|
||||
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<Integer, MapleReactorStats>();
|
||||
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<>();
|
||||
|
||||
|
||||
public static final MapleReactorStats getReactorS(int rid) {
|
||||
@@ -70,7 +70,7 @@ public class MapleReactorFactory {
|
||||
Pair<Integer, Integer> reactItem = null;
|
||||
int type = MapleDataTool.getIntConvert("type", reactorInfoData);
|
||||
if (type == 100) { //reactor waits for item
|
||||
reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", reactorInfoData), MapleDataTool.getIntConvert("1", reactorInfoData, 1));
|
||||
reactItem = new Pair<>(MapleDataTool.getIntConvert("0", reactorInfoData), MapleDataTool.getIntConvert("1", reactorInfoData, 1));
|
||||
if (!areaSet) { //only set area of effect for item-triggered reactors once
|
||||
stats.setTL(MapleDataTool.getPoint("lt", reactorInfoData));
|
||||
stats.setBR(MapleDataTool.getPoint("rb", reactorInfoData));
|
||||
@@ -129,7 +129,7 @@ public class MapleReactorFactory {
|
||||
Pair<Integer, Integer> reactItem = null;
|
||||
int type = MapleDataTool.getIntConvert("type", fknexon);
|
||||
if (type == 100) { //reactor waits for item
|
||||
reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", fknexon), MapleDataTool.getIntConvert("1", fknexon));
|
||||
reactItem = new Pair<>(MapleDataTool.getIntConvert("0", fknexon), MapleDataTool.getIntConvert("1", fknexon));
|
||||
if (!areaSet || loadArea) { //only set area of effect for item-triggered reactors once
|
||||
stats.setTL(MapleDataTool.getPoint("lt", fknexon));
|
||||
stats.setBR(MapleDataTool.getPoint("rb", fknexon));
|
||||
@@ -139,7 +139,7 @@ public class MapleReactorFactory {
|
||||
MapleData activeSkillID = fknexon.getChildByPath("activeSkillID");
|
||||
List<Integer> skillids = null;
|
||||
if (activeSkillID != null) {
|
||||
skillids = new ArrayList<Integer>();
|
||||
skillids = new ArrayList<>();
|
||||
for (MapleData skill : activeSkillID.getChildren()) {
|
||||
skillids.add(MapleDataTool.getInt(skill));
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package server.partyquest;
|
||||
|
||||
import client.MapleDisease;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataProvider;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import provider.MapleDataTool;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import server.life.MobSkillFactory;
|
||||
import provider.MapleDataProvider;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataTool;
|
||||
import server.life.MobSkill;
|
||||
|
||||
/**
|
||||
*@author Drago (Dragohe4rt)
|
||||
@@ -19,8 +20,8 @@ import server.life.MobSkill;
|
||||
public class MapleCarnivalFactory {
|
||||
|
||||
private final static MapleCarnivalFactory instance = new MapleCarnivalFactory();
|
||||
private final Map<Integer, MCSkill> skills = new HashMap<Integer, MCSkill>();
|
||||
private final Map<Integer, MCSkill> guardians = new HashMap<Integer, MCSkill>();
|
||||
private final Map<Integer, MCSkill> skills = new HashMap<>();
|
||||
private final Map<Integer, MCSkill> guardians = new HashMap<>();
|
||||
private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||
|
||||
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
||||
|
||||
@@ -23,8 +23,8 @@ import provider.MapleData;
|
||||
import server.quest.MapleQuest;
|
||||
import server.quest.MapleQuestActionType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -51,7 +51,7 @@ public abstract class MapleQuestAction {
|
||||
}
|
||||
|
||||
public static List<Integer> getJobBy5ByteEncoding(int encoded) {
|
||||
List<Integer> ret = new ArrayList<Integer>();
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
if ((encoded & 0x1) != 0) {
|
||||
ret.add(0);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public abstract class MapleQuestAction {
|
||||
}
|
||||
|
||||
public static List<Integer> getJobBySimpleEncoding(int encoded) {
|
||||
List<Integer> ret = new ArrayList<Integer>();
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
if ((encoded & 0x1) != 0) {
|
||||
ret.add(200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user