mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Finally use the diamond operator throughout.
This commit is contained in:
@@ -15,7 +15,7 @@ public final class CommandDispatcher {
|
||||
/**
|
||||
* A map of command strings to command listeners.
|
||||
*/
|
||||
private final Map<String, CommandListener> listeners = new HashMap<String, CommandListener>();
|
||||
private final Map<String, CommandListener> listeners = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Creates the command dispatcher and registers a listener for the credits command.
|
||||
|
||||
@@ -16,7 +16,7 @@ public final class EquipmentDefinition {
|
||||
/**
|
||||
* The equipment definitions.
|
||||
*/
|
||||
private static final Map<Integer, EquipmentDefinition> definitions = new HashMap<Integer, EquipmentDefinition>();
|
||||
private static final Map<Integer, EquipmentDefinition> definitions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Initialises the equipment definitions.
|
||||
|
||||
@@ -406,11 +406,10 @@ public final class Inventory implements Cloneable {
|
||||
if (amount >= item.getAmount()) {
|
||||
set(slot, null);
|
||||
return item.getAmount();
|
||||
} else {
|
||||
int newAmount = item.getAmount() - amount;
|
||||
set(slot, new Item(item.getId(), newAmount));
|
||||
return amount;
|
||||
}
|
||||
int newAmount = item.getAmount() - amount;
|
||||
set(slot, new Item(item.getId(), newAmount));
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ public final class MessageHandlerChainParser {
|
||||
}
|
||||
|
||||
Class<? extends Message> messageClass = (Class<? extends Message>) Class.forName(messageClassName);
|
||||
List<MessageHandler<?>> handlers = new ArrayList<MessageHandler<?>>();
|
||||
List<MessageHandler<?>> handlers = new ArrayList<>();
|
||||
|
||||
for (XmlNode handlerNode : chainNode) {
|
||||
if (!handlerNode.getName().equals("handler")) {
|
||||
|
||||
@@ -33,8 +33,7 @@ public final class GamePacketEncoder extends MessageToMessageEncoder<GamePacket>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encode(ChannelHandlerContext ctx, GamePacket msg, List<Object> out) throws Exception {
|
||||
GamePacket packet = (GamePacket) msg;
|
||||
protected void encode(ChannelHandlerContext ctx, GamePacket packet, List<Object> out) throws Exception {
|
||||
PacketType type = packet.getType();
|
||||
int headerLength = 1;
|
||||
int payloadLength = packet.getLength();
|
||||
|
||||
@@ -312,9 +312,8 @@ public final class GamePacketReader {
|
||||
int peek = buffer.getByte(buffer.readerIndex());
|
||||
if (peek < 128) {
|
||||
return buffer.readByte() - 64;
|
||||
} else {
|
||||
return buffer.readShort() - 49152;
|
||||
}
|
||||
return buffer.readShort() - 49152;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,9 +393,8 @@ public final class GamePacketReader {
|
||||
int peek = buffer.getByte(buffer.readerIndex());
|
||||
if (peek < 128) {
|
||||
return buffer.readByte();
|
||||
} else {
|
||||
return buffer.readShort() - 32768;
|
||||
}
|
||||
return buffer.readShort() - 32768;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -941,9 +941,8 @@ public final class EquipmentUpdater {
|
||||
}
|
||||
if (name.equals("Mithril arrow")) {
|
||||
return 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class NoteUpdater {
|
||||
ItemDefinition.init(defs);
|
||||
|
||||
os.writeShort(defs.length);
|
||||
Map<Integer, Integer> itemToNote = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> itemToNote = new HashMap<>();
|
||||
|
||||
for (int id = 0; id < defs.length; id++) {
|
||||
ItemDefinition def = ItemDefinition.lookup(id);
|
||||
|
||||
@@ -25,17 +25,17 @@ public final class UpdateDispatcher {
|
||||
/**
|
||||
* A queue for pending HTTP requests.
|
||||
*/
|
||||
private final BlockingQueue<ChannelRequest<HttpRequest>> httpQueue = new LinkedBlockingQueue<ChannelRequest<HttpRequest>>();
|
||||
private final BlockingQueue<ChannelRequest<HttpRequest>> httpQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
/**
|
||||
* A queue for pending JAGGRAB requests.
|
||||
*/
|
||||
private final BlockingQueue<ChannelRequest<JagGrabRequest>> jagGrabQueue = new LinkedBlockingQueue<ChannelRequest<JagGrabRequest>>();
|
||||
private final BlockingQueue<ChannelRequest<JagGrabRequest>> jagGrabQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
/**
|
||||
* A queue for pending 'on-demand' requests.
|
||||
*/
|
||||
private final BlockingQueue<ChannelRequest<OnDemandRequest>> onDemandQueue = new PriorityBlockingQueue<ChannelRequest<OnDemandRequest>>();
|
||||
private final BlockingQueue<ChannelRequest<OnDemandRequest>> onDemandQueue = new PriorityBlockingQueue<>();
|
||||
|
||||
/**
|
||||
* Dispatches a HTTP request.
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class UpdateService extends Service {
|
||||
/**
|
||||
* A list of request workers.
|
||||
*/
|
||||
private final List<RequestWorker<?, ?>> workers = new ArrayList<RequestWorker<?, ?>>();
|
||||
private final List<RequestWorker<?, ?>> workers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates the update service.
|
||||
|
||||
@@ -104,7 +104,7 @@ public final class TextUtil {
|
||||
for (char c : str.toLowerCase().toCharArray()) {
|
||||
for (char validChar : FREQUENCY_ORDERED_CHARS) {
|
||||
if (c == validChar) {
|
||||
builder.append((char) c);
|
||||
builder.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public final class PluginManager {
|
||||
* @return The plugin map.
|
||||
*/
|
||||
private Map<String, PluginMetaData> createMap(Collection<PluginMetaData> plugins) {
|
||||
Map<String, PluginMetaData> map = new HashMap<String, PluginMetaData>();
|
||||
Map<String, PluginMetaData> map = new HashMap<>();
|
||||
for (PluginMetaData plugin : plugins) {
|
||||
map.put(plugin.getId(), plugin);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class XmlNode implements Iterable<XmlNode> {
|
||||
/**
|
||||
* The attribute map.
|
||||
*/
|
||||
private final Map<String, String> attributes = new HashMap<String, String>();
|
||||
private final Map<String, String> attributes = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The list of child nodes.
|
||||
|
||||
Reference in New Issue
Block a user