cleanup: use implicit generic type with diamond operator
This commit is contained in:
@@ -21,6 +21,13 @@
|
||||
*/
|
||||
package client;
|
||||
|
||||
import net.server.Server;
|
||||
import net.server.world.World;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -32,13 +39,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import net.server.Server;
|
||||
import net.server.world.World;
|
||||
import tools.DatabaseConnection;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jay Estrella - Mr.Trash :3
|
||||
@@ -49,7 +49,7 @@ public class MapleFamily {
|
||||
private static final AtomicInteger familyIDCounter = new AtomicInteger();
|
||||
|
||||
private final int id, world;
|
||||
private final Map<Integer, MapleFamilyEntry> members = new ConcurrentHashMap<Integer, MapleFamilyEntry>();
|
||||
private final Map<Integer, MapleFamilyEntry> members = new ConcurrentHashMap<>();
|
||||
private MapleFamilyEntry leader;
|
||||
private String name;
|
||||
private String preceptsMessage = "";
|
||||
@@ -184,7 +184,7 @@ public class MapleFamily {
|
||||
|
||||
public static void loadAllFamilies() {
|
||||
try(Connection con = DatabaseConnection.getConnection()) {
|
||||
List<Pair<Pair<Integer, Integer>, MapleFamilyEntry>> unmatchedJuniors = new ArrayList<Pair<Pair<Integer, Integer>, MapleFamilyEntry>>(200); // <<world, seniorid> familyEntry>
|
||||
List<Pair<Pair<Integer, Integer>, MapleFamilyEntry>> unmatchedJuniors = new ArrayList<>(200); // <<world, seniorid> familyEntry>
|
||||
try(PreparedStatement psEntries = con.prepareStatement("SELECT * FROM family_character")) {
|
||||
ResultSet rsEntries = psEntries.executeQuery();
|
||||
while(rsEntries.next()) { // can be optimized
|
||||
@@ -236,7 +236,7 @@ public class MapleFamily {
|
||||
if(senior != null) {
|
||||
familyEntry.setSenior(family.getEntryByID(seniorid), false);
|
||||
} else {
|
||||
if(seniorid > 0) unmatchedJuniors.add(new Pair<Pair<Integer, Integer>, MapleFamilyEntry>(new Pair<Integer, Integer>(world, seniorid), familyEntry));
|
||||
if(seniorid > 0) unmatchedJuniors.add(new Pair<>(new Pair<>(world, seniorid), familyEntry));
|
||||
}
|
||||
familyEntry.setReputation(reputation);
|
||||
familyEntry.setTodaysRep(todaysRep);
|
||||
|
||||
@@ -21,14 +21,11 @@
|
||||
*/
|
||||
package client;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import server.quest.MapleQuest;
|
||||
import tools.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
@@ -61,8 +58,8 @@ public class MapleQuestStatus {
|
||||
private short questID;
|
||||
private Status status;
|
||||
//private boolean updated; //maybe this can be of use for someone?
|
||||
private final Map<Integer, String> progress = new LinkedHashMap<Integer, String>();
|
||||
private final List<Integer> medalProgress = new LinkedList<Integer>();
|
||||
private final Map<Integer, String> progress = new LinkedHashMap<>();
|
||||
private final List<Integer> medalProgress = new LinkedList<>();
|
||||
private int npc;
|
||||
private long completionTime, expirationTime;
|
||||
private int forfeited = 0, completed = 0;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class IdCommand extends Command {
|
||||
if (!handbookDirectory.containsKey(type)) {
|
||||
throw new IdTypeNotSupportedException();
|
||||
}
|
||||
itemMap.put(type, new HashMap<String, String>());
|
||||
itemMap.put(type, new HashMap<>());
|
||||
BufferedReader reader = new BufferedReader(new FileReader(handbookDirectory.get(type)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
||||
@@ -135,7 +135,7 @@ public enum ItemFactory {
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
Integer cid = rs.getInt("characterid");
|
||||
items.add(new Pair<Item, Integer>(loadEquipFromResultSet(rs), cid));
|
||||
items.add(new Pair<>(loadEquipFromResultSet(rs), cid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public enum ItemFactory {
|
||||
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
|
||||
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
items.add(new Pair<Item, MapleInventoryType>(loadEquipFromResultSet(rs), mit));
|
||||
items.add(new Pair<>(loadEquipFromResultSet(rs), mit));
|
||||
} else {
|
||||
if (bundles > 0) {
|
||||
int petid = rs.getInt("petid");
|
||||
|
||||
@@ -36,8 +36,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class PetDataFactory {
|
||||
private static MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz"));
|
||||
private static Map<String, PetCommand> petCommands = new HashMap<String, PetCommand>();
|
||||
private static Map<Integer, Integer> petHunger = new HashMap<Integer, Integer>();
|
||||
private static Map<String, PetCommand> petCommands = new HashMap<>();
|
||||
private static Map<Integer, Integer> petHunger = new HashMap<>();
|
||||
|
||||
public static PetCommand getPetCommand(int petId, int skillId) {
|
||||
PetCommand ret = petCommands.get(petId + "" + skillId);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
private static void deletePackageFromInventoryDB(Connection con, int packageId) throws SQLException {
|
||||
ItemFactory.DUEY.saveItems(new LinkedList<Pair<Item, MapleInventoryType>>(), packageId, con);
|
||||
ItemFactory.DUEY.saveItems(new LinkedList<>(), packageId, con);
|
||||
}
|
||||
|
||||
private static void removePackageFromDB(int packageId) {
|
||||
|
||||
@@ -702,7 +702,7 @@ public class Server {
|
||||
try {
|
||||
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||
for (int i = playerRanking.size(); i <= worldid; i++) {
|
||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
||||
playerRanking.add(new ArrayList<>(0));
|
||||
}
|
||||
|
||||
playerRanking.add(worldid, ranking.get(0).getRight());
|
||||
@@ -746,7 +746,7 @@ public class Server {
|
||||
try {
|
||||
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||
for (int i = playerRanking.size(); i <= rankUpdates.get(rankUpdates.size() - 1).getLeft(); i++) {
|
||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
||||
playerRanking.add(new ArrayList<>(0));
|
||||
}
|
||||
|
||||
for (Pair<Integer, List<Pair<String, Integer>>> wranks : rankUpdates) {
|
||||
@@ -763,7 +763,7 @@ public class Server {
|
||||
|
||||
private void initWorldPlayerRanking() {
|
||||
if (YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
||||
playerRanking.add(new ArrayList<>(0));
|
||||
}
|
||||
updateWorldPlayerRanking();
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ public class Server {
|
||||
if (wchars == null) {
|
||||
if (!accountChars.containsKey(accountId)) {
|
||||
accountCharacterCount.put(accountId, (short) 0);
|
||||
accountChars.put(accountId, new HashSet<Integer>()); // not advisable at all to write on the map on a read-protected environment
|
||||
accountChars.put(accountId, new HashSet<>()); // not advisable at all to write on the map on a read-protected environment
|
||||
} // yet it's known there's no problem since no other point in the source does
|
||||
} else if (!wchars.isEmpty()) { // this action.
|
||||
lastwchars = wchars;
|
||||
@@ -1485,7 +1485,7 @@ public class Server {
|
||||
short characterCount = 0;
|
||||
List<List<MapleCharacter>> wchars = new ArrayList<>(wlen);
|
||||
for (int i = 0; i < wlen; i++) {
|
||||
wchars.add(i, new LinkedList<MapleCharacter>());
|
||||
wchars.add(i, new LinkedList<>());
|
||||
}
|
||||
|
||||
List<MapleCharacter> chars = new LinkedList<>();
|
||||
@@ -1567,7 +1567,7 @@ public class Server {
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM namechanges WHERE completionTime IS NULL");
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
List<Pair<String, String>> changedNames = new LinkedList<Pair<String, String>>(); //logging only
|
||||
List<Pair<String, String>> changedNames = new LinkedList<>(); //logging only
|
||||
while (rs.next()) {
|
||||
con.setAutoCommit(false);
|
||||
int nameChangeId = rs.getInt("id");
|
||||
@@ -1578,7 +1578,7 @@ public class Server {
|
||||
if (!success) {
|
||||
con.rollback(); //discard changes
|
||||
} else {
|
||||
changedNames.add(new Pair<String, String>(oldName, newName));
|
||||
changedNames.add(new Pair<>(oldName, newName));
|
||||
}
|
||||
con.setAutoCommit(true);
|
||||
}
|
||||
@@ -1597,7 +1597,7 @@ public class Server {
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM worldtransfers WHERE completionTime IS NULL",
|
||||
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet rs = ps.executeQuery()) {
|
||||
List<Integer> removedTransfers = new LinkedList<Integer>();
|
||||
List<Integer> removedTransfers = new LinkedList<>();
|
||||
while (rs.next()) {
|
||||
int nameChangeId = rs.getInt("id");
|
||||
int characterId = rs.getInt("characterId");
|
||||
@@ -1617,7 +1617,7 @@ public class Server {
|
||||
}
|
||||
}
|
||||
rs.beforeFirst();
|
||||
List<Pair<Integer, Pair<Integer, Integer>>> worldTransfers = new LinkedList<Pair<Integer, Pair<Integer, Integer>>>(); //logging only <charid, <oldWorld, newWorld>>
|
||||
List<Pair<Integer, Pair<Integer, Integer>>> worldTransfers = new LinkedList<>(); //logging only <charid, <oldWorld, newWorld>>
|
||||
while (rs.next()) {
|
||||
con.setAutoCommit(false);
|
||||
int nameChangeId = rs.getInt("id");
|
||||
@@ -1631,7 +1631,7 @@ public class Server {
|
||||
if (!success) {
|
||||
con.rollback();
|
||||
} else {
|
||||
worldTransfers.add(new Pair<Integer, Pair<Integer, Integer>>(characterId, new Pair<Integer, Integer>(oldWorld, newWorld)));
|
||||
worldTransfers.add(new Pair<>(characterId, new Pair<>(oldWorld, newWorld)));
|
||||
}
|
||||
con.setAutoCommit(true);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class Channel {
|
||||
private Map<MapleExpeditionType, MapleExpedition> expeditions = new HashMap<>();
|
||||
private Map<Integer, MapleMiniDungeon> dungeons = new HashMap<>();
|
||||
private List<MapleExpeditionType> expedType = new ArrayList<>();
|
||||
private Set<MapleMap> ownedMaps = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<MapleMap, Boolean>()));
|
||||
private Set<MapleMap> ownedMaps = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>()));
|
||||
private MapleEvent event;
|
||||
private boolean finishedShutdown = false;
|
||||
private Set<Integer> usedMC = new HashSet<>();
|
||||
@@ -456,7 +456,7 @@ public final class Channel {
|
||||
}
|
||||
|
||||
private static String [] getEvents(){
|
||||
List<String> events = new ArrayList<String>();
|
||||
List<String> events = new ArrayList<>();
|
||||
for (File file : new File("scripts/event").listFiles()){
|
||||
events.add(file.getName().substring(0, file.getName().length() - 3));
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
|
||||
if (type < 0) {
|
||||
c.announce(MaplePacketCreator.showCashShopMessage((byte) parseCouponResult(type)));
|
||||
} else {
|
||||
List<Item> cashItems = new LinkedList<Item>();
|
||||
List<Pair<Integer, Integer>> items = new LinkedList<Pair<Integer, Integer>>();
|
||||
List<Item> cashItems = new LinkedList<>();
|
||||
List<Pair<Integer, Integer>> items = new LinkedList<>();
|
||||
int nxCredit = 0;
|
||||
int maplePoints = 0;
|
||||
int nxPrepaid = 0;
|
||||
@@ -245,7 +245,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
|
||||
cashItems.add(it);
|
||||
} else {
|
||||
MapleInventoryManipulator.addById(c, item, qty, "", -1);
|
||||
items.add(new Pair<Integer, Integer>((int)qty, item));
|
||||
items.add(new Pair<>((int) qty, item));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
package net.server.coordinator.login;
|
||||
|
||||
import config.YamlConfig;
|
||||
import net.server.Server;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.server.Server;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
@@ -39,7 +39,7 @@ public class LoginStorage {
|
||||
public boolean registerLogin(int accountId) {
|
||||
List<Long> accHist = loginHistory.get(accountId);
|
||||
if (accHist == null) {
|
||||
accHist = new LinkedList<Long>();
|
||||
accHist = new LinkedList<>();
|
||||
loginHistory.put(accountId, accHist);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public class MapleGuild {
|
||||
if (notifications.keySet().size() != chs.size()) {
|
||||
notifications.clear();
|
||||
for (Integer ch : chs) {
|
||||
notifications.put(ch, new LinkedList<Integer>());
|
||||
notifications.put(ch, new LinkedList<>());
|
||||
}
|
||||
} else {
|
||||
for (List<Integer> l : notifications.values()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
public final class MapleMessenger {
|
||||
|
||||
private int id;
|
||||
private List<MapleMessengerCharacter> members = new ArrayList<MapleMessengerCharacter>(3);
|
||||
private List<MapleMessengerCharacter> members = new ArrayList<>(3);
|
||||
private boolean[] pos = new boolean[3];
|
||||
|
||||
public MapleMessenger(int id, MapleMessengerCharacter chrfor) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class World {
|
||||
private ScheduledFuture<?> timedMapObjectsSchedule;
|
||||
private MonitoredReentrantLock timedMapObjectLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.WORLD_MAPOBJS, true);
|
||||
|
||||
private Map<MapleCharacter, Integer> fishingAttempters = Collections.synchronizedMap(new WeakHashMap<MapleCharacter, Integer>());
|
||||
private Map<MapleCharacter, Integer> fishingAttempters = Collections.synchronizedMap(new WeakHashMap<>());
|
||||
|
||||
private ScheduledFuture<?> charactersSchedule;
|
||||
private ScheduledFuture<?> marriagesSchedule;
|
||||
@@ -165,7 +165,7 @@ public class World {
|
||||
mountUpdate = petUpdate;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
cashItemBought.add(new LinkedHashMap<Integer, Integer>());
|
||||
cashItemBought.add(new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
TimerManager tman = TimerManager.getInstance();
|
||||
@@ -501,7 +501,7 @@ public class World {
|
||||
if(accChars != null) {
|
||||
chrList = new LinkedList<>(accChars.values());
|
||||
} else {
|
||||
accountChars.put(accountId, new TreeMap<Integer, MapleCharacter>());
|
||||
accountChars.put(accountId, new TreeMap<>());
|
||||
chrList = null;
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -21,24 +21,21 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import tools.data.input.GenericLittleEndianAccessor;
|
||||
import tools.data.input.InputStreamByteStream;
|
||||
import tools.data.input.LittleEndianAccessor;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
||||
public class ListWZFile {
|
||||
private LittleEndianAccessor lea;
|
||||
private List<String> entries = new ArrayList<String>();
|
||||
private static Collection<String> modernImgs = new HashSet<String>();
|
||||
private List<String> entries = new ArrayList<>();
|
||||
private static Collection<String> modernImgs = new HashSet<>();
|
||||
|
||||
public static byte[] xorBytes(byte[] a, byte[] b) {
|
||||
byte[] wusched = new byte[a.length];
|
||||
@@ -73,7 +70,7 @@ public class ListWZFile {
|
||||
ListWZFile listwz;
|
||||
try {
|
||||
listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz"));
|
||||
modernImgs = new HashSet<String>(listwz.getEntries());
|
||||
modernImgs = new HashSet<>(listwz.getEntries());
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -21,20 +21,17 @@
|
||||
*/
|
||||
package provider.wz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import provider.MapleDataDirectoryEntry;
|
||||
import provider.MapleDataEntity;
|
||||
import provider.MapleDataEntry;
|
||||
import provider.MapleDataFileEntry;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class WZDirectoryEntry extends WZEntry implements MapleDataDirectoryEntry {
|
||||
private List<MapleDataDirectoryEntry> subdirs = new ArrayList<MapleDataDirectoryEntry>();
|
||||
private List<MapleDataFileEntry> files = new ArrayList<MapleDataFileEntry>();
|
||||
private Map<String, MapleDataEntry> entries = new HashMap<String, MapleDataEntry>();
|
||||
private List<MapleDataDirectoryEntry> subdirs = new ArrayList<>();
|
||||
private List<MapleDataFileEntry> files = new ArrayList<>();
|
||||
private Map<String, MapleDataEntry> entries = new HashMap<>();
|
||||
|
||||
public WZDirectoryEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
||||
super(name, size, checksum, parent);
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
public class WZIMGEntry implements MapleData {
|
||||
private String name;
|
||||
private MapleDataType type;
|
||||
private List<MapleData> children = new ArrayList<MapleData>(10);
|
||||
private List<MapleData> children = new ArrayList<>(10);
|
||||
private Object data;
|
||||
private MapleDataEntity parent;
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ public class AbstractPlayerInteraction {
|
||||
|
||||
List<List<Pair<Integer, Integer>>> invList = new ArrayList<>(6);
|
||||
for(int i = MapleInventoryType.UNDEFINED.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
||||
invList.add(new LinkedList<Pair<Integer, Integer>>());
|
||||
invList.add(new LinkedList<>());
|
||||
}
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
|
||||
@@ -67,8 +67,8 @@ public class EventManager {
|
||||
private World wserv;
|
||||
private Server server;
|
||||
private EventScriptScheduler ess = new EventScriptScheduler();
|
||||
private Map<String, EventInstanceManager> instances = new HashMap<String, EventInstanceManager>();
|
||||
private Map<String, Integer> instanceLocks = new HashMap<String, Integer>();
|
||||
private Map<String, EventInstanceManager> instances = new HashMap<>();
|
||||
private Map<String, Integer> instanceLocks = new HashMap<>();
|
||||
private final Queue<Integer> queuedGuilds = new LinkedList<>();
|
||||
private final Map<Integer, Integer> queuedGuildLeaders = new HashMap<>();
|
||||
private List<Boolean> openedLobbys;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -6540,7 +6540,7 @@ public class MaplePacketCreator {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.FAMILY_CHART_RESULT.getValue());
|
||||
mplew.writeInt(entry.getChrId()); //ID of viewed player's pedigree, can't be leader?
|
||||
List<MapleFamilyEntry> superJuniors = new ArrayList<MapleFamilyEntry>(4);
|
||||
List<MapleFamilyEntry> superJuniors = new ArrayList<>(4);
|
||||
boolean hasOtherJunior = false;
|
||||
int entryCount = 2; //2 guaranteed, leader and self
|
||||
entryCount += Math.min(2, entry.getTotalSeniors());
|
||||
|
||||
Reference in New Issue
Block a user