Strict source and documentation format.

This commit is contained in:
Ryley Kimmel
2015-03-02 13:01:00 -05:00
parent ad7e2de3e5
commit 012073584f
66 changed files with 239 additions and 294 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
/**
* Contains classes which deal with the file system that the client uses to
* store game data files.
* Contains classes which deal with the file system that the client uses to store game data files.
*/
package org.apollo.fs;
+2 -4
View File
@@ -49,8 +49,7 @@ public final class GameService extends Service {
/**
* The scheduled executor service.
*/
private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(
"GameService"));
private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("GameService"));
/**
* The {@link ClientSynchronizer}.
@@ -170,8 +169,7 @@ public final class GameService extends Service {
*/
@Override
public void start() {
scheduledExecutor.scheduleAtFixedRate(new GamePulseHandler(this), GameConstants.PULSE_DELAY, GameConstants.PULSE_DELAY,
TimeUnit.MILLISECONDS);
scheduledExecutor.scheduleAtFixedRate(new GamePulseHandler(this), GameConstants.PULSE_DELAY, GameConstants.PULSE_DELAY, TimeUnit.MILLISECONDS);
}
/**
+1 -2
View File
@@ -1,5 +1,4 @@
/**
* Contains classes related to actions, specialised scheduled tasks which
* mobs perform.
* Contains classes related to actions, specialised scheduled tasks which mobs perform.
*/
package org.apollo.game.action;
@@ -41,8 +41,8 @@ public final class MessageHandlerChain<M extends Message> {
}
/**
* Handles the message, passing it down the chain until the chain is broken
* or the message reaches the end of the chain.
* Handles the message, passing it down the chain until the chain is broken or the message reaches the end of the
* chain.
*
* @param player The player.
* @param message The message.
@@ -25,16 +25,16 @@ public final class BankMessageHandler extends MessageHandler<ItemActionMessage>
*/
private static final int optionToAmount(int option) {
switch (option) {
case 1:
return 1;
case 2:
return 5;
case 3:
return 10;
case 4:
return Integer.MAX_VALUE;
case 5:
return -1;
case 1:
return 1;
case 2:
return 5;
case 3:
return 10;
case 4:
return Integer.MAX_VALUE;
case 5:
return -1;
}
throw new IllegalArgumentException("Invalid option supplied.");
@@ -21,19 +21,19 @@ public final class ItemOnItemVerificationHandler extends MessageHandler<ItemOnIt
Inventory inventory;
switch (message.getInterfaceId()) {
case SynchronizationInventoryListener.INVENTORY_ID:
case BankConstants.SIDEBAR_INVENTORY_ID:
inventory = player.getInventory();
break;
case SynchronizationInventoryListener.EQUIPMENT_ID:
inventory = player.getEquipment();
break;
case BankConstants.BANK_INVENTORY_ID:
inventory = player.getBank();
break;
default:
ctx.breakHandlerChain();
return;
case SynchronizationInventoryListener.INVENTORY_ID:
case BankConstants.SIDEBAR_INVENTORY_ID:
inventory = player.getInventory();
break;
case SynchronizationInventoryListener.EQUIPMENT_ID:
inventory = player.getEquipment();
break;
case BankConstants.BANK_INVENTORY_ID:
inventory = player.getBank();
break;
default:
ctx.breakHandlerChain();
return;
}
int slot = message.getTargetSlot();
@@ -18,8 +18,7 @@ public final class ItemOnObjectVerificationHandler extends MessageHandler<ItemOn
@Override
public void handle(MessageHandlerContext ctx, Player player, ItemOnObjectMessage message) {
if (message.getInterfaceId() != SynchronizationInventoryListener.INVENTORY_ID
&& message.getInterfaceId() != BankConstants.SIDEBAR_INVENTORY_ID) {
if (message.getInterfaceId() != SynchronizationInventoryListener.INVENTORY_ID && message.getInterfaceId() != BankConstants.SIDEBAR_INVENTORY_ID) {
ctx.breakHandlerChain();
return;
}
@@ -22,23 +22,22 @@ public final class SwitchItemMessageHandler extends MessageHandler<SwitchItemMes
boolean insertPermitted = false;
switch (message.getInterfaceId()) {
case SynchronizationInventoryListener.INVENTORY_ID:
case BankConstants.SIDEBAR_INVENTORY_ID:
inventory = player.getInventory();
break;
case SynchronizationInventoryListener.EQUIPMENT_ID:
inventory = player.getEquipment();
break;
case BankConstants.BANK_INVENTORY_ID:
inventory = player.getBank();
insertPermitted = true;
break;
default:
return; // not a known inventory, ignore
case SynchronizationInventoryListener.INVENTORY_ID:
case BankConstants.SIDEBAR_INVENTORY_ID:
inventory = player.getInventory();
break;
case SynchronizationInventoryListener.EQUIPMENT_ID:
inventory = player.getEquipment();
break;
case BankConstants.BANK_INVENTORY_ID:
inventory = player.getBank();
insertPermitted = true;
break;
default:
return; // not a known inventory, ignore
}
if (message.getOldSlot() >= 0 && message.getNewSlot() >= 0 && message.getOldSlot() < inventory.capacity()
&& message.getNewSlot() < inventory.capacity()) {
if (message.getOldSlot() >= 0 && message.getNewSlot() >= 0 && message.getOldSlot() < inventory.capacity() && message.getNewSlot() < inventory.capacity()) {
// events must be fired for it to work if a sidebar inventory overlay is used
inventory.swap(insertPermitted && message.isInserting(), message.getOldSlot(), message.getNewSlot());
}
@@ -37,9 +37,9 @@ public final class WalkMessageHandler extends MessageHandler<WalkMessage> {
}
player.getInterfaceSet().close();
if(player.getInteractingMob() != null) {
player.resetInteractingMob();
}
if (player.getInteractingMob() != null) {
player.resetInteractingMob();
}
}
@@ -53,8 +53,7 @@ public final class PlayerSynchronizationMessage extends Message {
* @param localPlayers The number of local players.
* @param segments A list of segments.
*/
public PlayerSynchronizationMessage(Position lastKnownSector, Position position, boolean sectorChanged,
SynchronizationSegment segment, int localPlayers, List<SynchronizationSegment> segments) {
public PlayerSynchronizationMessage(Position lastKnownSector, Position position, boolean sectorChanged, SynchronizationSegment segment, int localPlayers, List<SynchronizationSegment> segments) {
this.lastKnownSector = lastKnownSector;
this.position = position;
this.sectorChanged = sectorChanged;
+2 -2
View File
@@ -14,8 +14,8 @@ public final class Appearance {
/**
* The default appearance.
*/
public static final Appearance DEFAULT_APPEARANCE = new Appearance(Gender.MALE, new int[] { 0, 10, 18, 26, 33, 36, 42 },
new int[5]);
public static final Appearance DEFAULT_APPEARANCE = new Appearance(Gender.MALE, new int[] { 0, 10, 18, 26, 33, 36,
42 }, new int[5]);
/**
* The array of clothing/skin colors.
+1 -5
View File
@@ -1,9 +1,5 @@
package org.apollo.game.model;
/**
* Represents a single movement direction.
*
@@ -90,7 +86,7 @@ public enum Direction {
return Direction.WEST;
}
}
return Direction.NONE;
}
+1 -2
View File
@@ -226,8 +226,7 @@ public final class Position {
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("x", getX()).add("y", getY()).add("height", getHeight())
.add("sector", getSectorCoordinates()).toString();
return MoreObjects.toStringHelper(this).add("x", getX()).add("y", getY()).add("height", getHeight()).add("sector", getSectorCoordinates()).toString();
}
}
+1 -2
View File
@@ -237,8 +237,7 @@ public final class Sector {
* @throws IllegalArgumentException If the specified position is not included in this sector.
*/
private void checkPosition(Position position) {
Preconditions.checkArgument(coordinates.equals(SectorCoordinates.fromPosition(position)),
"Position is not included in this sector.");
Preconditions.checkArgument(coordinates.equals(SectorCoordinates.fromPosition(position)), "Position is not included in this sector.");
}
}
@@ -161,8 +161,7 @@ public final class CollisionMatrix {
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("width", width).add("length", length).add("matrix", Arrays.toString(matrix))
.toString();
return MoreObjects.toStringHelper(this).add("width", width).add("length", length).add("matrix", Arrays.toString(matrix)).toString();
}
/**
@@ -1,5 +1,5 @@
/**
* Contains classes which represent in-game sectors - blocks of 8x8 tiles used to store ground items, temporary objects, etc.
* efficiently.
* Contains classes which represent in-game sectors - blocks of 8x8 tiles used to store ground items, temporary objects,
* etc. efficiently.
*/
package org.apollo.game.model.area;
@@ -178,8 +178,7 @@ public final class ObjectDefinition {
/**
* Indicates the impenetrability of this object.
*
* @return {@code true} if this object is impenetrable, otherwise
* {@code false}.
* @return {@code true} if this object is impenetrable, otherwise {@code false}.
*/
public boolean isImpenetrable() {
return impenetrable;
@@ -188,8 +187,7 @@ public final class ObjectDefinition {
/**
* Indicates the interactivity of this object.
*
* @return {@code true} if the object is interactive, otherwise
* {@code false}.
* @return {@code true} if the object is interactive, otherwise {@code false}.
*/
public boolean isInteractive() {
return interactive;
@@ -198,8 +196,7 @@ public final class ObjectDefinition {
/**
* Indicates whether or not this object obstructs the ground.
*
* @return {@code true} if the object obstructs the ground otherwise
* {@code false}.
* @return {@code true} if the object obstructs the ground otherwise {@code false}.
*/
public boolean isObstructive() {
return obstructive;
@@ -1,5 +1,4 @@
/**
* Contains definition classes which contain information about types of items,
* NPCs, etc.
* Contains definition classes which contain information about types of items, NPCs, etc.
*/
package org.apollo.game.model.def;
@@ -89,8 +89,7 @@ public final class GameObject extends Entity {
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("id", getId()).add("type", getType()).add("rotation", getRotation())
.toString();
return MoreObjects.toStringHelper(this).add("id", getId()).add("type", getType()).add("rotation", getRotation()).toString();
}
}
+2 -2
View File
@@ -194,8 +194,8 @@ public abstract class Mob extends Entity {
*/
public final Direction[] getDirections() {
if (firstDirection != Direction.NONE) {
return secondDirection == Direction.NONE ? new Direction[] { firstDirection } : new Direction[] { firstDirection,
secondDirection };
return secondDirection == Direction.NONE ? new Direction[] { firstDirection } : new Direction[] {
firstDirection, secondDirection };
}
return Direction.EMPTY_DIRECTION_ARRAY;
+3 -6
View File
@@ -943,8 +943,7 @@ public final class Player extends Mob {
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("username", getUsername()).add("privilege", privilegeLevel)
.add("client version", getClientVersion()).toString();
return MoreObjects.toStringHelper(this).add("username", getUsername()).add("privilege", privilegeLevel).add("client version", getClientVersion()).toString();
}
/**
@@ -968,11 +967,9 @@ public final class Player extends Mob {
InventoryListener fullBankListener = new FullInventoryListener(this, FullInventoryListener.FULL_BANK_MESSAGE);
InventoryListener appearanceListener = new AppearanceInventoryListener(this);
InventoryListener syncInventoryListener = new SynchronizationInventoryListener(this,
SynchronizationInventoryListener.INVENTORY_ID);
InventoryListener syncInventoryListener = new SynchronizationInventoryListener(this, SynchronizationInventoryListener.INVENTORY_ID);
InventoryListener syncBankListener = new SynchronizationInventoryListener(this, BankConstants.BANK_INVENTORY_ID);
InventoryListener syncEquipmentListener = new SynchronizationInventoryListener(this,
SynchronizationInventoryListener.EQUIPMENT_ID);
InventoryListener syncEquipmentListener = new SynchronizationInventoryListener(this, SynchronizationInventoryListener.EQUIPMENT_ID);
inventory.addListener(syncInventoryListener);
inventory.addListener(fullInventoryListener);
+3 -3
View File
@@ -115,9 +115,9 @@ public final class Skill {
/**
* The skill names.
*/
private static final String[] SKILL_NAMES = { "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer", "Magic",
"Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore",
"Agility", "Thieving", "Slayer", "Farming", "Runecraft" };
private static final String[] SKILL_NAMES = { "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer",
"Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining",
"Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft" };
/**
* Gets the name of a skill.
@@ -57,8 +57,7 @@ public final class SkillSet {
* @return The minimum level.
*/
public static int getLevelForExperience(double experience) {
Preconditions.checkArgument(experience >= 0 && experience <= MAXIMUM_EXP, "Experience must be between 0 and "
+ MAXIMUM_EXP + ", inclusive.");
Preconditions.checkArgument(experience >= 0 && experience <= MAXIMUM_EXP, "Experience must be between 0 and " + MAXIMUM_EXP + ", inclusive.");
for (int level = 1; level <= 98; level++) {
if (experience < EXPERIENCE_FOR_LEVEL[level + 1]) {
@@ -80,8 +80,7 @@ public final class AttributeMap {
AttributeDefinition<T> definition = getDefinition(name);
Preconditions.checkNotNull(definition, "Attributes must be defined before their value can be retreived.");
return (Attribute<T>) attributes.computeIfAbsent(name,
key -> createAttribute(definition.getDefault(), definition.getType()));
return (Attribute<T>) attributes.computeIfAbsent(name, key -> createAttribute(definition.getDefault(), definition.getType()));
}
/**
+2 -2
View File
@@ -6,7 +6,7 @@ package org.apollo.game.model.event;
* @author Major
*/
public abstract class Event {
/**
* Indicates whether or not the Event chain has been terminated.
*/
@@ -27,5 +27,5 @@ public abstract class Event {
public final boolean terminated() {
return terminated;
}
}
@@ -10,8 +10,8 @@ public class InterfaceConstants {
/**
* The default inventory tab ids.
*/
public static final int[] DEFAULT_INVENTORY_TABS = { 2423, 3917, 638, 3213, 1644, 5608, 1151, -1, 5065, 5715, 2449, 904, 147,
962, };
public static final int[] DEFAULT_INVENTORY_TABS = { 2423, 3917, 638, 3213, 1644, 5608, 1151, -1, 5065, 5715, 2449,
904, 147, 962, };
// 6299 = music tab, music disabled
// 4445 = settings tab, music disabled
// 12855 = ancients magic
@@ -19,8 +19,8 @@ public class InterfaceConstants {
/**
* The level-up dialogue interface ids.
*/
public static final int[] LEVEL_UP_INTERFACES = { 6247, 6253, 6206, 6216, 4443, 6242, 6211, 6226, 4272, 6231, 6258, 4282,
6263, 6221, 4416, 6237, 4277, 4261, 12122, 4887, 4267 };
public static final int[] LEVEL_UP_INTERFACES = { 6247, 6253, 6206, 6216, 4443, 6242, 6211, 6226, 4272, 6231, 6258,
4282, 6263, 6221, 4416, 6237, 4277, 4261, 12122, 4887, 4267 };
/**
* The quest interface id.
@@ -35,12 +35,13 @@ public class InterfaceConstants {
/**
* The array of widgets that display the text.
*/
public static final int[] QUEST_TEXT = { 8144, 8145, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158,
8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177,
8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191, 8192, 8193, 8194, 8195, 12174,
12175, 12176, 12177, 12178, 12179, 12180, 12181, 12182, 12183, 12184, 12185, 12186, 12187, 12188, 12189, 12190,
12191, 12192, 12193, 12194, 12195, 12196, 12197, 12198, 12199, 12200, 12201, 12202, 12203, 12204, 12205, 12206,
12207, 12208, 12209, 12210, 12211, 12212, 12213, 12214, 12215, 12216, 12217, 12218, 12219, 12220, 12221, 12222, 12223 };
public static final int[] QUEST_TEXT = { 8144, 8145, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174,
8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191, 8192,
8193, 8194, 8195, 12174, 12175, 12176, 12177, 12178, 12179, 12180, 12181, 12182, 12183, 12184, 12185,
12186, 12187, 12188, 12189, 12190, 12191, 12192, 12193, 12194, 12195, 12196, 12197, 12198, 12199, 12200,
12201, 12202, 12203, 12204, 12205, 12206, 12207, 12208, 12209, 12210, 12211, 12212, 12213, 12214, 12215,
12216, 12217, 12218, 12219, 12220, 12221, 12222, 12223 };
/**
* The quest title widget id.
+1 -2
View File
@@ -1,5 +1,4 @@
/**
* Contains classes which represent things in the in-game world such as items,
* players and NPCs.
* Contains classes which represent things in the in-game world such as items, players and NPCs.
*/
package org.apollo.game.model;
@@ -31,8 +31,7 @@ public final class LevelUpSkillListener extends SkillAdapter {
// TODO show the interface
String name = Skill.getName(id);
String article = LanguageUtil.getIndefiniteArticle(name);
player.sendMessage("You've just advanced " + article + " " + name + " level! You have reached level "
+ skill.getMaximumLevel() + ".");
player.sendMessage("You've just advanced " + article + " " + name + " level! You have reached level " + skill.getMaximumLevel() + ".");
if (Skill.isCombatSkill(id)) {
player.getSkillSet().calculateCombatLevel();
@@ -1,5 +1,4 @@
/**
* Contains classes related to scheduling which allow tasks to be executed in
* future pulses periodically.
* Contains classes related to scheduling which allow tasks to be executed in future pulses periodically.
*/
package org.apollo.game.scheduling;
@@ -77,8 +77,7 @@ public final class AppearanceBlock extends SynchronizationBlock {
* @param isSkulled Whether or not the player is skulled.
* @param npcId The npc id of the player, if they are appearing as an npc, (otherwise {@code -1}).
*/
AppearanceBlock(long name, Appearance appearance, int combat, int skill, Inventory equipment, int headIcon,
boolean isSkulled, int npcId) {
AppearanceBlock(long name, Appearance appearance, int combat, int skill, Inventory equipment, int headIcon, boolean isSkulled, int npcId) {
this.name = name;
this.appearance = appearance;
this.combat = combat;
@@ -48,8 +48,7 @@ public final class ForceMovementBlock extends SynchronizationBlock {
* @param travelDurationY The length of time (in game pulses) the player's movement along the Y-axis will last.
* @param direction The direction the player should move.
*/
ForceMovementBlock(Position initialPosition, Position finalPosition, int travelDurationX, int travelDurationY,
Direction direction) {
ForceMovementBlock(Position initialPosition, Position finalPosition, int travelDurationX, int travelDurationY, Direction direction) {
this.initialPosition = initialPosition;
this.finalPosition = finalPosition;
this.travelDurationX = travelDurationX;
@@ -37,8 +37,7 @@ public abstract class SynchronizationBlock {
int combat = player.getSkillSet().getCombatLevel();
int id = player.hasNpcDefinition() ? player.getDefinition().getId() : -1;
return new AppearanceBlock(player.getEncodedName(), player.getAppearance(), combat, 0, player.getEquipment(),
player.getPrayerIcon(), player.isSkulled(), id);
return new AppearanceBlock(player.getEncodedName(), player.getAppearance(), combat, 0, player.getEquipment(), player.getPrayerIcon(), player.isSkulled(), id);
}
/**
@@ -72,8 +71,7 @@ public abstract class SynchronizationBlock {
* @param direction The {@link Direction} the player should move.
* @return The force movement block.
*/
public static SynchronizationBlock createForceMovementBlock(Position initialPosition, Position finalPosition,
int travelDurationX, int travelDurationY, Direction direction) {
public static SynchronizationBlock createForceMovementBlock(Position initialPosition, Position finalPosition, int travelDurationX, int travelDurationY, Direction direction) {
return new ForceMovementBlock(initialPosition, finalPosition, travelDurationX, travelDurationY, direction);
}
@@ -98,10 +96,8 @@ public abstract class SynchronizationBlock {
* @param secondary If the block is a secondary hit or not.
* @return The hit update block.
*/
public static SynchronizationBlock createHitUpdateBlock(int damage, int type, int currentHealth, int maximumHealth,
boolean secondary) {
return secondary ? new SecondaryHitUpdateBlock(damage, type, currentHealth, maximumHealth) : new HitUpdateBlock(damage,
type, currentHealth, maximumHealth);
public static SynchronizationBlock createHitUpdateBlock(int damage, int type, int currentHealth, int maximumHealth, boolean secondary) {
return secondary ? new SecondaryHitUpdateBlock(damage, type, currentHealth, maximumHealth) : new HitUpdateBlock(damage, type, currentHealth, maximumHealth);
}
/**
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Contains classes related to client synchronization - the process where the
* client's state is updated by the server so it matches the server's state.
* Contains classes related to client synchronization - the process where the client's state is updated by the server so
* it matches the server's state.
*/
package org.apollo.game.sync;
@@ -26,8 +26,7 @@ public final class MovementSegment extends SynchronizationSegment {
*/
public MovementSegment(SynchronizationBlockSet blockSet, Direction[] directions) {
super(blockSet);
Preconditions.checkArgument(directions.length >= 0 && directions.length < 3,
"Directions length must be between 0 and 2 inclusive.");
Preconditions.checkArgument(directions.length >= 0 && directions.length < 3, "Directions length must be between 0 and 2 inclusive.");
this.directions = directions;
}
@@ -43,14 +42,14 @@ public final class MovementSegment extends SynchronizationSegment {
@Override
public SegmentType getType() {
switch (directions.length) {
case 0:
return SegmentType.NO_MOVEMENT;
case 1:
return SegmentType.WALK;
case 2:
return SegmentType.RUN;
default:
throw new IllegalStateException("Direction type unsupported.");
case 0:
return SegmentType.NO_MOVEMENT;
case 1:
return SegmentType.WALK;
case 2:
return SegmentType.RUN;
default:
throw new IllegalStateException("Direction type unsupported.");
}
}
@@ -1,6 +1,5 @@
/**
* Contains classes related to synchronization segments. Each segment contains
* multiple blocks and can be used to add, remove, teleport or move a
* mob.
* Contains classes related to synchronization segments. Each segment contains multiple blocks and can be used to add,
* remove, teleport or move a mob.
*/
package org.apollo.game.sync.seg;
@@ -50,8 +50,7 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
for (Iterator<Npc> it = localNpcs.iterator(); it.hasNext();) {
Npc npc = it.next();
if (!npc.isActive() || npc.isTeleporting()
|| npc.getPosition().getLongestDelta(playerPosition) > player.getViewingDistance()) {
if (!npc.isActive() || npc.isTeleporting() || npc.getPosition().getLongestDelta(playerPosition) > player.getViewingDistance()) {
it.remove();
segments.add(new RemoveMobSegment());
} else {
@@ -70,8 +69,7 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
}
Position npcPosition = npc.getPosition();
if (npcPosition.isWithinDistance(playerPosition, player.getViewingDistance()) && !localNpcs.contains(npc)
&& npcPosition.getHeight() == playerPosition.getHeight()) {
if (npcPosition.isWithinDistance(playerPosition, player.getViewingDistance()) && !localNpcs.contains(npc) && npcPosition.getHeight() == playerPosition.getHeight()) {
localNpcs.add(npc);
added++;
npc.turnTo(npc.getFacingPosition());
@@ -70,8 +70,7 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
for (Iterator<Player> it = localPlayers.iterator(); it.hasNext();) {
Player other = it.next();
if (!other.isActive() || other.isTeleporting()
|| other.getPosition().getLongestDelta(player.getPosition()) > player.getViewingDistance()) {
if (!other.isActive() || other.isTeleporting() || other.getPosition().getLongestDelta(player.getPosition()) > player.getViewingDistance()) {
it.remove();
segments.add(new RemoveMobSegment());
} else {
@@ -91,8 +90,7 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
break;
}
if (other != player && other.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance())
&& !localPlayers.contains(other)) {
if (other != player && other.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance()) && !localPlayers.contains(other)) {
localPlayers.add(other);
added++;
@@ -107,8 +105,7 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
}
}
PlayerSynchronizationMessage message = new PlayerSynchronizationMessage(lastKnownSector, player.getPosition(),
sectorChanged, segment, oldLocalPlayers, segments);
PlayerSynchronizationMessage message = new PlayerSynchronizationMessage(lastKnownSector, player.getPosition(), sectorChanged, segment, oldLocalPlayers, segments);
player.send(message);
}
@@ -1,6 +1,5 @@
/**
* Contains classes related to
* {@link org.apollo.game.sync.task.SynchronizationTask}s, small chunks of work
* executed during the client synchronization process.
* Contains classes related to {@link org.apollo.game.sync.task.SynchronizationTask}s, small chunks of work executed
* during the client synchronization process.
*/
package org.apollo.game.sync.task;
@@ -53,8 +53,7 @@ public final class MessageHandlerChainParser {
* @return A {@link MessageHandlerChainGroup}.
*/
@SuppressWarnings("unchecked")
public MessageHandlerChainGroup parse() throws IOException, SAXException, ClassNotFoundException, InstantiationException,
IllegalAccessException {
public MessageHandlerChainGroup parse() throws IOException, SAXException, ClassNotFoundException, InstantiationException, IllegalAccessException {
XmlNode messages = parser.parse(is);
if (!messages.getName().equals("messages")) {
throw new IOException("Root node name is not 'messages'.");
@@ -94,8 +93,7 @@ public final class MessageHandlerChainParser {
throw new IOException("Handler node must have a value.");
}
Class<? extends MessageHandler<?>> handlerClass = (Class<? extends MessageHandler<?>>) Class
.forName(handlerClassName);
Class<? extends MessageHandler<?>> handlerClass = (Class<? extends MessageHandler<?>>) Class.forName(handlerClassName);
MessageHandler<?> handler = handlerClass.newInstance();
handlers.add(handler);
}
@@ -32,8 +32,7 @@ public final class PlayerLoaderResponse {
* {@link LoginConstants#STATUS_RECONNECTION_OK}.
*/
public PlayerLoaderResponse(int status) {
Preconditions.checkArgument(status != LoginConstants.STATUS_OK && status != LoginConstants.STATUS_RECONNECTION_OK,
"Player required for this status code.");
Preconditions.checkArgument(status != LoginConstants.STATUS_OK && status != LoginConstants.STATUS_RECONNECTION_OK, "Player required for this status code.");
this.status = status;
player = Optional.empty();
}
@@ -47,8 +46,7 @@ public final class PlayerLoaderResponse {
* @throws NullPointerException If the specified player is null.
*/
public PlayerLoaderResponse(int status, Player player) {
Preconditions.checkArgument(status == LoginConstants.STATUS_OK || status == LoginConstants.STATUS_RECONNECTION_OK,
"Player not required for this status code.");
Preconditions.checkArgument(status == LoginConstants.STATUS_OK || status == LoginConstants.STATUS_RECONNECTION_OK, "Player not required for this status code.");
this.status = status;
this.player = Optional.of(player);
}
+6 -6
View File
@@ -85,13 +85,13 @@ public final class ApolloHandler extends ChannelInboundHandlerAdapter {
HandshakeMessage handshakeMessage = (HandshakeMessage) message;
switch (handshakeMessage.getServiceId()) {
case HandshakeConstants.SERVICE_GAME:
attribute.set(new LoginSession(ctx, serverContext));
break;
case HandshakeConstants.SERVICE_GAME:
attribute.set(new LoginSession(ctx, serverContext));
break;
case HandshakeConstants.SERVICE_UPDATE:
attribute.set(new UpdateSession(ctx.channel(), serverContext));
break;
case HandshakeConstants.SERVICE_UPDATE:
attribute.set(new UpdateSession(ctx.channel(), serverContext));
break;
}
}
@@ -62,17 +62,17 @@ public final class GamePacketDecoder extends StatefulFrameDecoder<GameDecoderSta
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out, GameDecoderState state) {
switch (state) {
case GAME_OPCODE:
decodeOpcode(in, out);
break;
case GAME_LENGTH:
decodeLength(in);
break;
case GAME_PAYLOAD:
decodePayload(in, out);
break;
default:
throw new IllegalStateException("Invalid game decoder state.");
case GAME_OPCODE:
decodeOpcode(in, out);
break;
case GAME_LENGTH:
decodeLength(in);
break;
case GAME_PAYLOAD:
decodePayload(in, out);
break;
default:
throw new IllegalStateException("Invalid game decoder state.");
}
}
@@ -106,20 +106,20 @@ public final class GamePacketDecoder extends StatefulFrameDecoder<GameDecoderSta
type = metaData.getType();
switch (type) {
case FIXED:
length = metaData.getLength();
if (length == 0) {
setState(GameDecoderState.GAME_OPCODE);
out.add(new GamePacket(opcode, type, Unpooled.EMPTY_BUFFER));
} else {
setState(GameDecoderState.GAME_PAYLOAD);
}
break;
case VARIABLE_BYTE:
setState(GameDecoderState.GAME_LENGTH);
break;
default:
throw new IllegalStateException("Illegal packet type: " + type + ".");
case FIXED:
length = metaData.getLength();
if (length == 0) {
setState(GameDecoderState.GAME_OPCODE);
out.add(new GamePacket(opcode, type, Unpooled.EMPTY_BUFFER));
} else {
setState(GameDecoderState.GAME_PAYLOAD);
}
break;
case VARIABLE_BYTE:
setState(GameDecoderState.GAME_LENGTH);
break;
default:
throw new IllegalStateException("Illegal packet type: " + type + ".");
}
}
}
@@ -34,23 +34,23 @@ public final class HandshakeDecoder extends ByteToMessageDecoder {
int id = buffer.readUnsignedByte();
switch (id) {
case HandshakeConstants.SERVICE_GAME:
ctx.pipeline().addFirst("loginEncoder", new LoginEncoder());
ctx.pipeline().addAfter("handshakeDecoder", "loginDecoder", new LoginDecoder());
break;
case HandshakeConstants.SERVICE_GAME:
ctx.pipeline().addFirst("loginEncoder", new LoginEncoder());
ctx.pipeline().addAfter("handshakeDecoder", "loginDecoder", new LoginDecoder());
break;
case HandshakeConstants.SERVICE_UPDATE:
ctx.pipeline().addFirst("updateEncoder", new UpdateEncoder());
ctx.pipeline().addBefore("handler", "updateDecoder", new UpdateDecoder());
case HandshakeConstants.SERVICE_UPDATE:
ctx.pipeline().addFirst("updateEncoder", new UpdateEncoder());
ctx.pipeline().addBefore("handler", "updateDecoder", new UpdateDecoder());
ByteBuf buf = ctx.alloc().buffer(8).writeLong(0);
ctx.channel().writeAndFlush(buf);
break;
ByteBuf buf = ctx.alloc().buffer(8).writeLong(0);
ctx.channel().writeAndFlush(buf);
break;
default:
ByteBuf data = buffer.readBytes(buffer.readableBytes());
logger.info(String.format("Unexpected handshake request received: %d data: %s", id, data.toString()));
return;
default:
ByteBuf data = buffer.readBytes(buffer.readableBytes());
logger.info(String.format("Unexpected handshake request received: %d data: %s", id, data.toString()));
return;
}
ctx.pipeline().remove(this);
@@ -60,17 +60,17 @@ public final class LoginDecoder extends StatefulFrameDecoder<LoginDecoderState>
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out, LoginDecoderState state) {
switch (state) {
case LOGIN_HANDSHAKE:
decodeHandshake(ctx, in, out);
break;
case LOGIN_HEADER:
decodeHeader(ctx, in, out);
break;
case LOGIN_PAYLOAD:
decodePayload(ctx, in, out);
break;
default:
throw new IllegalStateException("Invalid login decoder state: " + state);
case LOGIN_HANDSHAKE:
decodeHandshake(ctx, in, out);
break;
case LOGIN_HEADER:
decodeHeader(ctx, in, out);
break;
case LOGIN_PAYLOAD:
decodePayload(ctx, in, out);
break;
default:
throw new IllegalStateException("Invalid login decoder state: " + state);
}
}
@@ -56,8 +56,7 @@ public final class LoginRequest {
* @param archiveCrcs The archive CRCs.
* @param clientVersion The client version.
*/
public LoginRequest(PlayerCredentials credentials, IsaacRandomPair randomPair, boolean lowMemory, boolean reconnecting,
int releaseNumber, int[] archiveCrcs, int clientVersion) {
public LoginRequest(PlayerCredentials credentials, IsaacRandomPair randomPair, boolean lowMemory, boolean reconnecting, int releaseNumber, int[] archiveCrcs, int clientVersion) {
this.credentials = credentials;
this.randomPair = randomPair;
this.lowMemory = lowMemory;
@@ -41,14 +41,14 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
*/
public static Priority valueOf(int value) {
switch (value) {
case 0:
return HIGH;
case 1:
return MEDIUM;
case 2:
return LOW;
default:
throw new IllegalArgumentException("Priority out of range - received " + value + ".");
case 0:
return HIGH;
case 1:
return MEDIUM;
case 2:
return LOW;
default:
throw new IllegalArgumentException("Priority out of range - received " + value + ".");
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Contains classes related to networking. Many of these extend Netty's set of
* classes - such as the pipeline factory, handler and codecs.
* Contains classes related to networking. Many of these extend Netty's set of classes - such as the pipeline factory,
* handler and codecs.
*/
package org.apollo.net;
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Contains abstract classes which should be extended by a particular release,
* allowing for portability between various protocol and client releases.
* Contains abstract classes which should be extended by a particular release, allowing for portability between various
* protocol and client releases.
*/
package org.apollo.net.release;
@@ -227,8 +227,7 @@ public final class NpcSynchronizationMessageEncoder extends MessageEncoder<NpcSy
* @param message The message.
* @param builder The builder.
*/
private static void putMovementUpdate(SynchronizationSegment segment, NpcSynchronizationMessage message,
GamePacketBuilder builder) {
private static void putMovementUpdate(SynchronizationSegment segment, NpcSynchronizationMessage message, GamePacketBuilder builder) {
boolean updateRequired = segment.getBlockSet().size() > 0;
if (segment.getType() == SegmentType.RUN) {
Direction[] directions = ((MovementSegment) segment).getDirections();
@@ -388,8 +388,7 @@ public final class PlayerSynchronizationMessageEncoder extends MessageEncoder<Pl
* @param message The message.
* @param builder The builder.
*/
private static void putMovementUpdate(SynchronizationSegment seg, PlayerSynchronizationMessage message,
GamePacketBuilder builder) {
private static void putMovementUpdate(SynchronizationSegment seg, PlayerSynchronizationMessage message, GamePacketBuilder builder) {
boolean updateRequired = seg.getBlockSet().size() > 0;
if (seg.getType() == SegmentType.TELEPORT) {
Position position = ((TeleportSegment) seg).getDestination();
@@ -11,11 +11,11 @@ import org.apollo.net.release.MessageDecoder;
*/
public final class FirstNpcActionMessageDecoder extends MessageDecoder<FirstNpcActionMessage> {
@Override
public FirstNpcActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
return new FirstNpcActionMessage(index);
}
@Override
public FirstNpcActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE);
return new FirstNpcActionMessage(index);
}
}
@@ -29,7 +29,7 @@ public final class FlaggedMouseEventMessageDecoder extends MessageDecoder<Flagge
} else {
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
}
clicks = (read >> 19);
x = (read & 0x7f) % 765;
y = (read & 0x7f) / 765;
@@ -15,14 +15,14 @@ import org.apollo.net.release.MessageDecoder;
*/
public final class MagicOnNpcMessageDecoder extends MessageDecoder<MagicOnNpcMessage> {
@Override
public MagicOnNpcMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
@Override
public MagicOnNpcMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int spell = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
int index = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
int spell = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
return new MagicOnNpcMessage(index, spell);
}
return new MagicOnNpcMessage(index, spell);
}
}
@@ -388,8 +388,7 @@ public final class PlayerSynchronizationMessageEncoder extends MessageEncoder<Pl
* @param message The message.
* @param builder The builder.
*/
private static void putMovementUpdate(SynchronizationSegment seg, PlayerSynchronizationMessage message,
GamePacketBuilder builder) {
private static void putMovementUpdate(SynchronizationSegment seg, PlayerSynchronizationMessage message, GamePacketBuilder builder) {
boolean updateRequired = seg.getBlockSet().size() > 0;
if (seg.getType() == SegmentType.TELEPORT) {
Position pos = ((TeleportSegment) seg).getDestination();
@@ -13,9 +13,9 @@ public final class SecondNpcActionMessageDecoder extends MessageDecoder<SecondNp
@Override
public SecondNpcActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataTransformation.ADD);
return new SecondNpcActionMessage(index);
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataTransformation.ADD);
return new SecondNpcActionMessage(index);
}
}
@@ -17,9 +17,9 @@ public final class ThirdNpcActionMessageDecoder extends MessageDecoder<ThirdNpcA
@Override
public ThirdNpcActionMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
return new ThirdNpcActionMessage(index);
GamePacketReader reader = new GamePacketReader(packet);
int index = (int) reader.getSigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
return new ThirdNpcActionMessage(index);
}
}
+2 -4
View File
@@ -103,8 +103,7 @@ public final class LoginSession extends Session {
optional = Optional.empty();
rights = 0;
status = (registration == RegistrationStatus.ALREADY_ONLINE) ? LoginConstants.STATUS_ACCOUNT_ONLINE
: LoginConstants.STATUS_SERVER_FULL;
status = (registration == RegistrationStatus.ALREADY_ONLINE) ? LoginConstants.STATUS_ACCOUNT_ONLINE : LoginConstants.STATUS_SERVER_FULL;
}
}
@@ -119,8 +118,7 @@ public final class LoginSession extends Session {
channel.pipeline().addFirst("eventEncoder", new GameMessageEncoder(release));
channel.pipeline().addBefore("eventEncoder", "gameEncoder", new GamePacketEncoder(randomPair.getEncodingRandom()));
channel.pipeline().addBefore("handler", "gameDecoder",
new GamePacketDecoder(randomPair.getDecodingRandom(), serverContext.getRelease()));
channel.pipeline().addBefore("handler", "gameDecoder", new GamePacketDecoder(randomPair.getDecodingRandom(), serverContext.getRelease()));
channel.pipeline().addAfter("gameDecoder", "eventDecoder", new GameMessageDecoder(release));
channel.pipeline().remove("loginDecoder");
+2 -3
View File
@@ -1,7 +1,6 @@
/**
* Contains {@link org.apollo.net.session.Session} classes which are the
* equivalent of Netty's {@link io.netty.channel.Channel}s but are
* designed for Apollo to use itself - unlike Netty's which are purely
* Contains {@link org.apollo.net.session.Session} classes which are the equivalent of Netty's
* {@link io.netty.channel.Channel}s but are designed for Apollo to use itself - unlike Netty's which are purely
* designed for networking.
*/
package org.apollo.net.session;
+1 -2
View File
@@ -1,5 +1,4 @@
/**
* Contains core Apollo server classes such as service management and the
* server bootstrap class.
* Contains core Apollo server classes such as service management and the server bootstrap class.
*/
package org.apollo;
+13 -11
View File
@@ -22,8 +22,9 @@ public final class EquipmentConstants {
/**
* Bodies.
*/
public static final String[] BODY = { "platebody", "chainbody", "robetop", "leathertop", "platemail", "top", "brassard",
"Robe top", "body", "platebody (t)", "platebody (g)", "body(g)", "body_(g)", "chestplate", "torso", "shirt" };
public static final String[] BODY = { "platebody", "chainbody", "robetop", "leathertop", "platemail", "top",
"brassard", "Robe top", "body", "platebody (t)", "platebody (g)", "body(g)", "body_(g)", "chestplate",
"torso", "shirt" };
/**
* Boots.
@@ -38,8 +39,8 @@ public final class EquipmentConstants {
/**
* Full bodies.
*/
public static final String[] FULL_BODIES = { "top", "shirt", "platebody", "Ahrims robetop", "Karils leathertop", "brassard",
"Robe top", "robetop", "platebody (t)", "platebody (g)", "chestplate", "torso" };
public static final String[] FULL_BODIES = { "top", "shirt", "platebody", "Ahrims robetop", "Karils leathertop",
"brassard", "Robe top", "robetop", "platebody (t)", "platebody (g)", "chestplate", "torso" };
/**
* Full hats.
@@ -50,8 +51,8 @@ public final class EquipmentConstants {
/**
* Full masks.
*/
public static final String[] FULL_MASKS = { "full helm", "mask", "Veracs helm", "Guthans helm", "Torags helm", "Karils coif",
"full helm (t)", "full helm (g)", "mask" };
public static final String[] FULL_MASKS = { "full helm", "mask", "Veracs helm", "Guthans helm", "Torags helm",
"Karils coif", "full helm (t)", "full helm (g)", "mask" };
/**
* Gloves.
@@ -61,8 +62,9 @@ public final class EquipmentConstants {
/**
* Hats.
*/
public static final String[] HATS = { "tiara", "helm", "hood", "coif", "Coif", "hat", "partyhat", "Hat", "full helm (t)",
"full helm (g)", "hat (t)", "hat (g)", "cav", "boater", "helmet", "mask", "Helm of neitiznot" };
public static final String[] HATS = { "tiara", "helm", "hood", "coif", "Coif", "hat", "partyhat", "Hat",
"full helm (t)", "full helm (g)", "hat (t)", "hat (g)", "cav", "boater", "helmet", "mask",
"Helm of neitiznot" };
/**
* Legs.
@@ -87,9 +89,9 @@ public final class EquipmentConstants {
*/
public static final String[] WEAPONS = { "scimitar", "longsword", "sword", "longbow", "shortbow", "dagger", "mace",
"halberd", "spear", "Abyssal whip", "axe", "flail", "crossbow", "Torags hammers", "dagger(p)", "dagger(+)",
"dagger(s)", "spear(p)", "spear(+)", "spear(s)", "spear(kp)", "maul", "dart", "dart(p)", "javelin", "javelin(p)",
"knife", "knife(p)", "Longbow", "Shortbow", "Crossbow", "Toktz-xil", "Toktz-mej", "Tzhaar-ket", "staff", "Staff",
"godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" };
"dagger(s)", "spear(p)", "spear(+)", "spear(s)", "spear(kp)", "maul", "dart", "dart(p)", "javelin",
"javelin(p)", "knife", "knife(p)", "Longbow", "Shortbow", "Crossbow", "Toktz-xil", "Toktz-mej",
"Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" };
/**
* Default private constructor to prevent instantiation.
+1 -3
View File
@@ -1169,9 +1169,7 @@ public final class EquipmentUpdater {
Preconditions.checkArgument(args.length == 1, "Usage:\njava -cp ... org.apollo.tools.EquipmentUpdater [release].");
String release = args[0];
try (DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("data/equipment-" + release
+ ".dat")));
IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", release), true)) {
try (DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("data/equipment-" + release + ".dat"))); IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", release), true)) {
ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs);
ItemDefinition[] definitions = decoder.decode();
ItemDefinition.init(definitions);
+1 -2
View File
@@ -100,8 +100,7 @@ public final class CompressionUtil {
byte[] data = new byte[compressed.remaining()];
compressed.get(data);
try (InputStream is = new GZIPInputStream(new ByteArrayInputStream(data));
ByteArrayOutputStream os = new ByteArrayOutputStream()) {
try (InputStream is = new GZIPInputStream(new ByteArrayInputStream(data)); ByteArrayOutputStream os = new ByteArrayOutputStream()) {
while (true) {
byte[] buf = new byte[1024];
int read = is.read(buf, 0, buf.length);
+4 -4
View File
@@ -12,10 +12,10 @@ public final class NameUtil {
/**
* An array of valid characters in a player name encoded as a long.
*/
private static final char[] NAME_CHARS = { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '@',
'#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', ':', ';', '.', '>', '<', ',', '"', '[', ']', '|', '?', '/',
'`' };
private static final char[] NAME_CHARS = { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', ':', ';', '.', '>', '<', ',',
'"', '[', ']', '|', '?', '/', '`' };
/**
* Converts a long to a player name.
+4 -4
View File
@@ -11,10 +11,10 @@ public final class TextUtil {
* An array of characters ordered by frequency - the elements with lower indices (generally) appear more often in
* chat messages.
*/
public static final char[] FREQUENCY_ORDERED_CHARS = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', 'm',
'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
'[', ']' };
public static final char[] FREQUENCY_ORDERED_CHARS = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l',
'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+',
'=', '\243', '$', '%', '"', '[', ']' };
/**
* Capitalizes the string correctly.
@@ -156,8 +156,7 @@ public final class PluginManager {
* @throws DependencyException If a dependency error occurs.
* @throws IOException If an I/O error occurs.
*/
private void start(PluginEnvironment env, PluginMetaData plugin, Map<String, PluginMetaData> plugins,
Set<PluginMetaData> started) throws DependencyException, IOException {
private void start(PluginEnvironment env, PluginMetaData plugin, Map<String, PluginMetaData> plugins, Set<PluginMetaData> started) throws DependencyException, IOException {
// TODO check for cyclic dependencies! this way just won't cut it, we need an exception
if (started.contains(plugin)) {
return;
@@ -61,8 +61,7 @@ public final class PluginMetaData {
* @param dependencies The plugin's dependencies.
* @param version The plugin's version.
*/
public PluginMetaData(String id, File base, String name, String description, String[] authors, String[] scripts,
String[] dependencies, double version) {
public PluginMetaData(String id, File base, String name, String description, String[] authors, String[] scripts, String[] dependencies, double version) {
this.id = id;
this.base = base;
this.name = name;