mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-10-01 02:17:35 +00:00
Clean-up and format; use diamond operator.
This commit is contained in:
@@ -60,7 +60,7 @@ public final class StaticObjectDecoder {
|
||||
boolean members = (buffer.get() & 0xFF) == 1;
|
||||
}
|
||||
|
||||
List<GameObject> objects = new ArrayList<GameObject>();
|
||||
List<GameObject> objects = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < indices; i++) {
|
||||
ByteBuffer compressed = fs.getFile(4, landscapes[i]);
|
||||
@@ -81,7 +81,7 @@ public final class StaticObjectDecoder {
|
||||
* @return A collection of all parsed objects.
|
||||
*/
|
||||
private Collection<GameObject> parseArea(int area, ByteBuffer buffer) {
|
||||
List<GameObject> objects = new ArrayList<GameObject>();
|
||||
List<GameObject> objects = new ArrayList<>();
|
||||
|
||||
int x = (area >> 8 & 0xFF) * 64;
|
||||
int y = (area & 0xFF) * 64;
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class GameService extends Service {
|
||||
/**
|
||||
* A queue of players to remove.
|
||||
*/
|
||||
private final Queue<Player> oldPlayers = new ConcurrentLinkedQueue<Player>();
|
||||
private final Queue<Player> oldPlayers = new ConcurrentLinkedQueue<>();
|
||||
|
||||
/**
|
||||
* The scheduled executor service.
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class CreditsCommandListener extends CommandListener {
|
||||
PluginManager mgr = World.getWorld().getPluginManager();
|
||||
final Set<String> authors = mgr.getAuthors();
|
||||
|
||||
List<String> text = new ArrayList<String>(12 + authors.size());
|
||||
List<String> text = new ArrayList<>(12 + authors.size());
|
||||
text.add("@dre@Apollo");
|
||||
text.add("@dre@Introduction");
|
||||
text.add("");
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class Inventory implements Cloneable {
|
||||
/**
|
||||
* A list of inventory listeners.
|
||||
*/
|
||||
private final List<InventoryListener> listeners = new ArrayList<InventoryListener>();
|
||||
private final List<InventoryListener> listeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The stacking mode.
|
||||
|
||||
@@ -16,12 +16,12 @@ public final class Scheduler {
|
||||
/**
|
||||
* A queue of new tasks that should be added.
|
||||
*/
|
||||
private Queue<ScheduledTask> newTasks = new ArrayDeque<ScheduledTask>();
|
||||
private Queue<ScheduledTask> newTasks = new ArrayDeque<>();
|
||||
|
||||
/**
|
||||
* A list of currently active tasks.
|
||||
*/
|
||||
private List<ScheduledTask> tasks = new ArrayList<ScheduledTask>();
|
||||
private List<ScheduledTask> tasks = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Called every pulse: executes tasks that are still pending, adds new tasks and stops old tasks.
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
|
||||
|
||||
List<Player> localPlayers = player.getLocalPlayerList();
|
||||
int oldLocalPlayers = localPlayers.size();
|
||||
List<SynchronizationSegment> segments = new ArrayList<SynchronizationSegment>();
|
||||
List<SynchronizationSegment> segments = new ArrayList<>();
|
||||
|
||||
for (Iterator<Player> it = localPlayers.iterator(); it.hasNext();) {
|
||||
Player p = it.next();
|
||||
|
||||
@@ -122,14 +122,14 @@ public final class BinaryPlayerLoader implements PlayerLoader {
|
||||
}
|
||||
|
||||
int friendCount = in.readByte();
|
||||
List<String> friends = new ArrayList<String>(friendCount);
|
||||
List<String> friends = new ArrayList<>(friendCount);
|
||||
for (int i = 0; i < friendCount; i++) {
|
||||
friends.add(NameUtil.decodeBase37(in.readLong()));
|
||||
}
|
||||
player.setFriendUsernames(friends);
|
||||
|
||||
int ignoreCount = in.readByte();
|
||||
List<String> ignores = new ArrayList<String>(ignoreCount);
|
||||
List<String> ignores = new ArrayList<>(ignoreCount);
|
||||
for (int i = 0; i < ignoreCount; i++) {
|
||||
ignores.add(NameUtil.decodeBase37(in.readLong()));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public final class GameSession extends Session {
|
||||
/**
|
||||
* The queue of pending {@link Event}s.
|
||||
*/
|
||||
private final BlockingQueue<Event> eventQueue = new ArrayBlockingQueue<Event>(GameConstants.EVENTS_PER_PULSE);
|
||||
private final BlockingQueue<Event> eventQueue = new ArrayBlockingQueue<>(GameConstants.EVENTS_PER_PULSE);
|
||||
|
||||
/**
|
||||
* The player.
|
||||
|
||||
@@ -63,6 +63,7 @@ public final class PlayerCredentials {
|
||||
|
||||
/**
|
||||
* Gets the hashed password
|
||||
*
|
||||
* @return The password (either the original loaded from file or scrypted)
|
||||
*/
|
||||
public String getHashedPassword() {
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class UpdateDispatcher {
|
||||
if (httpQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||
channel.close();
|
||||
}
|
||||
httpQueue.add(new ChannelRequest<HttpRequest>(channel, request));
|
||||
httpQueue.add(new ChannelRequest<>(channel, request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ public final class UpdateDispatcher {
|
||||
if (jagGrabQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||
channel.close();
|
||||
}
|
||||
jagGrabQueue.add(new ChannelRequest<JagGrabRequest>(channel, request));
|
||||
jagGrabQueue.add(new ChannelRequest<>(channel, request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ public final class UpdateDispatcher {
|
||||
if (onDemandQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||
channel.close();
|
||||
}
|
||||
onDemandQueue.add(new ChannelRequest<OnDemandRequest>(channel, request));
|
||||
onDemandQueue.add(new ChannelRequest<>(channel, request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class PluginContext {
|
||||
EventHandlerChainGroup chains = context.getService(GameService.class).getEventHandlerChains();
|
||||
EventHandlerChain<E> chain = chains.getChain(event);
|
||||
if (chain == null) {
|
||||
chain = new EventHandlerChain<E>(handler);
|
||||
chain = new EventHandlerChain<>(handler);
|
||||
chains.register(event, chain);
|
||||
} else {
|
||||
chain.addLast(handler);
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class PluginManager {
|
||||
/**
|
||||
* A set of all author names.
|
||||
*/
|
||||
private SortedSet<String> authors = new TreeSet<String>();
|
||||
private SortedSet<String> authors = new TreeSet<>();
|
||||
|
||||
/**
|
||||
* The plugin context.
|
||||
@@ -79,7 +79,7 @@ public final class PluginManager {
|
||||
* @throws SAXException If a SAX error occurs.
|
||||
*/
|
||||
private Collection<PluginMetaData> findPlugins(File dir) throws IOException, SAXException {
|
||||
Collection<PluginMetaData> plugins = new ArrayList<PluginMetaData>();
|
||||
Collection<PluginMetaData> plugins = new ArrayList<>();
|
||||
for (File plugin : dir.listFiles()) {
|
||||
if (plugin.isDirectory() && !plugin.getName().startsWith(".")) {
|
||||
File xml = new File(plugin, "plugin.xml");
|
||||
@@ -138,7 +138,7 @@ public final class PluginManager {
|
||||
*/
|
||||
public void start() throws IOException, SAXException, DependencyException {
|
||||
Map<String, PluginMetaData> plugins = createMap(findPlugins());
|
||||
Set<PluginMetaData> started = new HashSet<PluginMetaData>();
|
||||
Set<PluginMetaData> started = new HashSet<>();
|
||||
|
||||
PluginEnvironment env = new RubyPluginEnvironment(); // TODO isolate plugins if possible in the future!
|
||||
env.setContext(context);
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class XmlNode implements Iterable<XmlNode> {
|
||||
/**
|
||||
* The list of child nodes.
|
||||
*/
|
||||
private final List<XmlNode> children = new ArrayList<XmlNode>();
|
||||
private final List<XmlNode> children = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The name of this node.
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class XmlParser {
|
||||
/**
|
||||
* The stack of nodes, which is used when traversing the document and going through child nodes.
|
||||
*/
|
||||
private Stack<XmlNode> nodeStack = new Stack<XmlNode>();
|
||||
private Stack<XmlNode> nodeStack = new Stack<>();
|
||||
|
||||
/**
|
||||
* The current root node.
|
||||
|
||||
Reference in New Issue
Block a user