cleanup: use implicit generic type with diamond operator
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user