cleanup: use implicit generic type with diamond operator

This commit is contained in:
P0nk
2021-04-08 07:42:10 +02:00
parent 8aa44711e3
commit 5730b3b42d
35 changed files with 108 additions and 121 deletions

View File

@@ -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.

View File

@@ -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())) {

View File

@@ -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);
}

View File

@@ -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) {

View File

@@ -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:

View File

@@ -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;