mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 16:49:12 +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;
|
boolean members = (buffer.get() & 0xFF) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GameObject> objects = new ArrayList<GameObject>();
|
List<GameObject> objects = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < indices; i++) {
|
for (int i = 0; i < indices; i++) {
|
||||||
ByteBuffer compressed = fs.getFile(4, landscapes[i]);
|
ByteBuffer compressed = fs.getFile(4, landscapes[i]);
|
||||||
@@ -81,7 +81,7 @@ public final class StaticObjectDecoder {
|
|||||||
* @return A collection of all parsed objects.
|
* @return A collection of all parsed objects.
|
||||||
*/
|
*/
|
||||||
private Collection<GameObject> parseArea(int area, ByteBuffer buffer) {
|
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 x = (area >> 8 & 0xFF) * 64;
|
||||||
int y = (area & 0xFF) * 64;
|
int y = (area & 0xFF) * 64;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public final class GameService extends Service {
|
|||||||
/**
|
/**
|
||||||
* A queue of players to remove.
|
* 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.
|
* The scheduled executor service.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public final class CreditsCommandListener extends CommandListener {
|
|||||||
PluginManager mgr = World.getWorld().getPluginManager();
|
PluginManager mgr = World.getWorld().getPluginManager();
|
||||||
final Set<String> authors = mgr.getAuthors();
|
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@Apollo");
|
||||||
text.add("@dre@Introduction");
|
text.add("@dre@Introduction");
|
||||||
text.add("");
|
text.add("");
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public final class Inventory implements Cloneable {
|
|||||||
/**
|
/**
|
||||||
* A list of inventory listeners.
|
* A list of inventory listeners.
|
||||||
*/
|
*/
|
||||||
private final List<InventoryListener> listeners = new ArrayList<InventoryListener>();
|
private final List<InventoryListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The stacking mode.
|
* The stacking mode.
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ public final class Scheduler {
|
|||||||
/**
|
/**
|
||||||
* A queue of new tasks that should be added.
|
* 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.
|
* 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.
|
* 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();
|
List<Player> localPlayers = player.getLocalPlayerList();
|
||||||
int oldLocalPlayers = localPlayers.size();
|
int oldLocalPlayers = localPlayers.size();
|
||||||
List<SynchronizationSegment> segments = new ArrayList<SynchronizationSegment>();
|
List<SynchronizationSegment> segments = new ArrayList<>();
|
||||||
|
|
||||||
for (Iterator<Player> it = localPlayers.iterator(); it.hasNext();) {
|
for (Iterator<Player> it = localPlayers.iterator(); it.hasNext();) {
|
||||||
Player p = it.next();
|
Player p = it.next();
|
||||||
|
|||||||
@@ -122,14 +122,14 @@ public final class BinaryPlayerLoader implements PlayerLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int friendCount = in.readByte();
|
int friendCount = in.readByte();
|
||||||
List<String> friends = new ArrayList<String>(friendCount);
|
List<String> friends = new ArrayList<>(friendCount);
|
||||||
for (int i = 0; i < friendCount; i++) {
|
for (int i = 0; i < friendCount; i++) {
|
||||||
friends.add(NameUtil.decodeBase37(in.readLong()));
|
friends.add(NameUtil.decodeBase37(in.readLong()));
|
||||||
}
|
}
|
||||||
player.setFriendUsernames(friends);
|
player.setFriendUsernames(friends);
|
||||||
|
|
||||||
int ignoreCount = in.readByte();
|
int ignoreCount = in.readByte();
|
||||||
List<String> ignores = new ArrayList<String>(ignoreCount);
|
List<String> ignores = new ArrayList<>(ignoreCount);
|
||||||
for (int i = 0; i < ignoreCount; i++) {
|
for (int i = 0; i < ignoreCount; i++) {
|
||||||
ignores.add(NameUtil.decodeBase37(in.readLong()));
|
ignores.add(NameUtil.decodeBase37(in.readLong()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public final class GameSession extends Session {
|
|||||||
/**
|
/**
|
||||||
* The queue of pending {@link Event}s.
|
* 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.
|
* The player.
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public final class PlayerCredentials {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hashed password
|
* Gets the hashed password
|
||||||
|
*
|
||||||
* @return The password (either the original loaded from file or scrypted)
|
* @return The password (either the original loaded from file or scrypted)
|
||||||
*/
|
*/
|
||||||
public String getHashedPassword() {
|
public String getHashedPassword() {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public final class UpdateDispatcher {
|
|||||||
if (httpQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
if (httpQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||||
channel.close();
|
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) {
|
if (jagGrabQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||||
channel.close();
|
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) {
|
if (onDemandQueue.size() >= MAXIMUM_QUEUE_SIZE) {
|
||||||
channel.close();
|
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();
|
EventHandlerChainGroup chains = context.getService(GameService.class).getEventHandlerChains();
|
||||||
EventHandlerChain<E> chain = chains.getChain(event);
|
EventHandlerChain<E> chain = chains.getChain(event);
|
||||||
if (chain == null) {
|
if (chain == null) {
|
||||||
chain = new EventHandlerChain<E>(handler);
|
chain = new EventHandlerChain<>(handler);
|
||||||
chains.register(event, chain);
|
chains.register(event, chain);
|
||||||
} else {
|
} else {
|
||||||
chain.addLast(handler);
|
chain.addLast(handler);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public final class PluginManager {
|
|||||||
/**
|
/**
|
||||||
* A set of all author names.
|
* A set of all author names.
|
||||||
*/
|
*/
|
||||||
private SortedSet<String> authors = new TreeSet<String>();
|
private SortedSet<String> authors = new TreeSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin context.
|
* The plugin context.
|
||||||
@@ -79,7 +79,7 @@ public final class PluginManager {
|
|||||||
* @throws SAXException If a SAX error occurs.
|
* @throws SAXException If a SAX error occurs.
|
||||||
*/
|
*/
|
||||||
private Collection<PluginMetaData> findPlugins(File dir) throws IOException, SAXException {
|
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()) {
|
for (File plugin : dir.listFiles()) {
|
||||||
if (plugin.isDirectory() && !plugin.getName().startsWith(".")) {
|
if (plugin.isDirectory() && !plugin.getName().startsWith(".")) {
|
||||||
File xml = new File(plugin, "plugin.xml");
|
File xml = new File(plugin, "plugin.xml");
|
||||||
@@ -138,7 +138,7 @@ public final class PluginManager {
|
|||||||
*/
|
*/
|
||||||
public void start() throws IOException, SAXException, DependencyException {
|
public void start() throws IOException, SAXException, DependencyException {
|
||||||
Map<String, PluginMetaData> plugins = createMap(findPlugins());
|
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!
|
PluginEnvironment env = new RubyPluginEnvironment(); // TODO isolate plugins if possible in the future!
|
||||||
env.setContext(context);
|
env.setContext(context);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public final class XmlNode implements Iterable<XmlNode> {
|
|||||||
/**
|
/**
|
||||||
* The list of child nodes.
|
* 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.
|
* 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.
|
* 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.
|
* The current root node.
|
||||||
|
|||||||
Reference in New Issue
Block a user