diff --git a/src/org/apollo/Server.java b/src/org/apollo/Server.java index 57d27db1..4caa6a43 100644 --- a/src/org/apollo/Server.java +++ b/src/org/apollo/Server.java @@ -112,7 +112,7 @@ public final class Server { logger.fine("Binding HTTP listener to address: " + httpAddress + "..."); try { - httpBootstrap.bind(httpAddress); + // httpBootstrap.bind(httpAddress); } catch (Throwable t) { logger.log(Level.WARNING, "Binding to HTTP failed: client will use JAGGRAB as a fallback (not recommended)!", t); diff --git a/src/org/apollo/fs/decoder/NpcDefinitionDecoder.java b/src/org/apollo/fs/decoder/NpcDefinitionDecoder.java index 21fdf00b..fd329f1f 100644 --- a/src/org/apollo/fs/decoder/NpcDefinitionDecoder.java +++ b/src/org/apollo/fs/decoder/NpcDefinitionDecoder.java @@ -65,6 +65,7 @@ public final class NpcDefinitionDecoder { */ private NpcDefinition decode(int id, ByteBuffer buffer) { NpcDefinition definition = new NpcDefinition(id); + while (true) { int opcode = buffer.get() & 0xFF; @@ -87,8 +88,7 @@ public final class NpcDefinitionDecoder { } else if (opcode == 14) { definition.setWalkAnimation(buffer.getShort()); } else if (opcode == 17) { - definition - .setWalkAnimations(buffer.getShort(), buffer.getShort(), buffer.getShort(), buffer.getShort()); + definition.setWalkAnimations(buffer.getShort(), buffer.getShort(), buffer.getShort(), buffer.getShort()); } else if (opcode >= 30 && opcode < 40) { String str = BufferUtil.readString(buffer); if (str.equals("hidden")) { diff --git a/src/org/apollo/game/GamePulseHandler.java b/src/org/apollo/game/GamePulseHandler.java index 1ec13290..aeb24582 100644 --- a/src/org/apollo/game/GamePulseHandler.java +++ b/src/org/apollo/game/GamePulseHandler.java @@ -36,6 +36,7 @@ public final class GamePulseHandler implements Runnable { } catch (Throwable t) { logger.log(Level.SEVERE, "Exception during pulse.", t); } + } } \ No newline at end of file diff --git a/src/org/apollo/game/action/Action.java b/src/org/apollo/game/action/Action.java index baccd3ee..20b56023 100644 --- a/src/org/apollo/game/action/Action.java +++ b/src/org/apollo/game/action/Action.java @@ -4,13 +4,14 @@ import org.apollo.game.model.entity.Mob; import org.apollo.game.scheduling.ScheduledTask; /** - * An action is a specialised {@link ScheduledTask} which is specific to a mob. + * An action is a specialised {@link ScheduledTask} that is specific to a {@link Mob}. *

* ALL actions MUST implement the {@link #equals(Object)} method. This is to check if * two actions are identical: if they are, then the new action does not replace the old one (so spam/accidental clicking * won't cancel your action, and start another from scratch). * * @author Graham + * @param The type of mob. */ public abstract class Action extends ScheduledTask { diff --git a/src/org/apollo/game/action/DistancedAction.java b/src/org/apollo/game/action/DistancedAction.java index a462a49f..83b69c26 100644 --- a/src/org/apollo/game/action/DistancedAction.java +++ b/src/org/apollo/game/action/DistancedAction.java @@ -8,6 +8,7 @@ import org.apollo.game.model.entity.Mob; * * @author Blake * @author Graham + * @param The type of {@link Mob}. */ public abstract class DistancedAction extends Action { diff --git a/src/org/apollo/game/message/impl/AddGlobalTileItemMessage.java b/src/org/apollo/game/message/impl/AddGlobalTileItemMessage.java index 4c8b5a0f..1339015e 100644 --- a/src/org/apollo/game/message/impl/AddGlobalTileItemMessage.java +++ b/src/org/apollo/game/message/impl/AddGlobalTileItemMessage.java @@ -3,6 +3,11 @@ package org.apollo.game.message.impl; import org.apollo.game.message.Message; import org.apollo.game.model.Item; +/** + * A {@link Message} sent to the client to display an item on a tile for every player. + * + * @author Major + */ public final class AddGlobalTileItemMessage extends Message { /** diff --git a/src/org/apollo/game/message/impl/ArrowKeyMessage.java b/src/org/apollo/game/message/impl/ArrowKeyMessage.java index 13010a13..5db0efda 100644 --- a/src/org/apollo/game/message/impl/ArrowKeyMessage.java +++ b/src/org/apollo/game/message/impl/ArrowKeyMessage.java @@ -21,6 +21,9 @@ public final class ArrowKeyMessage extends Message { /** * Creates a new arrow key message. + * + * @param roll The camera roll. + * @param yaw The camera yaw. */ public ArrowKeyMessage(int roll, int yaw) { this.roll = roll; diff --git a/src/org/apollo/game/message/impl/FocusUpdateMessage.java b/src/org/apollo/game/message/impl/FocusUpdateMessage.java index e2d5e0d1..85e1c521 100644 --- a/src/org/apollo/game/message/impl/FocusUpdateMessage.java +++ b/src/org/apollo/game/message/impl/FocusUpdateMessage.java @@ -17,7 +17,7 @@ public final class FocusUpdateMessage extends Message { /** * Creates a new focus update message. * - * @param update The data received. + * @param focused The data received. */ public FocusUpdateMessage(boolean focused) { this.focused = focused; diff --git a/src/org/apollo/game/message/impl/ForwardPrivateChatMessage.java b/src/org/apollo/game/message/impl/ForwardPrivateChatMessage.java index 8eb8262e..10b7249f 100644 --- a/src/org/apollo/game/message/impl/ForwardPrivateChatMessage.java +++ b/src/org/apollo/game/message/impl/ForwardPrivateChatMessage.java @@ -28,7 +28,8 @@ public final class ForwardPrivateChatMessage extends Message { /** * Creates a new forward private message message. * - * @param sender The player sending the message. + * @param username The username of the player sending the message. + * @param level The {@link PrivilegeLevel} of the player sending the message. * @param message The compressed message. */ public ForwardPrivateChatMessage(String username, PrivilegeLevel level, byte[] message) { diff --git a/src/org/apollo/game/message/impl/IgnoreListMessage.java b/src/org/apollo/game/message/impl/IgnoreListMessage.java index d1984f77..29ec2767 100644 --- a/src/org/apollo/game/message/impl/IgnoreListMessage.java +++ b/src/org/apollo/game/message/impl/IgnoreListMessage.java @@ -19,7 +19,7 @@ public final class IgnoreListMessage extends Message { /** * Creates a new ignore list message. * - * @param player The player. + * @param usernames The {@link List} of usernames to send. */ public IgnoreListMessage(List usernames) { this.usernames = usernames; diff --git a/src/org/apollo/game/message/impl/ItemOnItemMessage.java b/src/org/apollo/game/message/impl/ItemOnItemMessage.java index 827afe9a..62b4c17f 100644 --- a/src/org/apollo/game/message/impl/ItemOnItemMessage.java +++ b/src/org/apollo/game/message/impl/ItemOnItemMessage.java @@ -1,7 +1,7 @@ package org.apollo.game.message.impl; /** - * A {@link Message} sent by the client when a player uses one inventory item on another. + * A {@link InventoryItemMessage} sent by the client when a player uses one inventory item on another. * * @author Chris Fletcher */ @@ -32,8 +32,7 @@ public final class ItemOnItemMessage extends InventoryItemMessage { * @param targetId The id of the target item. * @param targetSlot The slot of the target item. */ - public ItemOnItemMessage(int usedInterface, int usedId, int usedSlot, int targetInterface, int targetId, - int targetSlot) { + public ItemOnItemMessage(int usedInterface, int usedId, int usedSlot, int targetInterface, int targetId, int targetSlot) { super(0, usedInterface, usedId, usedSlot); this.targetInterface = targetInterface; this.targetSlot = targetSlot; diff --git a/src/org/apollo/game/message/impl/MagicOnItemMessage.java b/src/org/apollo/game/message/impl/MagicOnItemMessage.java index bd09e4dc..068e6140 100644 --- a/src/org/apollo/game/message/impl/MagicOnItemMessage.java +++ b/src/org/apollo/game/message/impl/MagicOnItemMessage.java @@ -1,7 +1,7 @@ package org.apollo.game.message.impl; /** - * A {@link Message} sent by the client when a player casts a spell on an inventory item. + * A {@link InventoryItemMessage} sent by the client when a player casts a spell on an inventory item. * * @author Chris Fletcher */ diff --git a/src/org/apollo/game/message/impl/RegionChangeMessage.java b/src/org/apollo/game/message/impl/RegionChangeMessage.java index 9f25e8bf..724ca354 100644 --- a/src/org/apollo/game/message/impl/RegionChangeMessage.java +++ b/src/org/apollo/game/message/impl/RegionChangeMessage.java @@ -4,7 +4,7 @@ import org.apollo.game.message.Message; import org.apollo.game.model.Position; /** - * A {@link Message sent to the client instructing it to load the specified region. + * A {@link Message} sent to the client instructing it to load the specified region. * * @author Graham */ diff --git a/src/org/apollo/game/message/impl/UpdateTileItemMessage.java b/src/org/apollo/game/message/impl/UpdateTileItemMessage.java index 1d18d0e2..6bdc5ab5 100644 --- a/src/org/apollo/game/message/impl/UpdateTileItemMessage.java +++ b/src/org/apollo/game/message/impl/UpdateTileItemMessage.java @@ -28,7 +28,7 @@ public final class UpdateTileItemMessage extends Message { /** * Creates a new message that updates the previous amount of the item. * - * @param id The item to be placed. + * @param item The item to be placed. * @param previousAmount The previous amount of the item. */ public UpdateTileItemMessage(Item item, int previousAmount) { @@ -38,7 +38,7 @@ public final class UpdateTileItemMessage extends Message { /** * Creates a new set tile item message. * - * @param id The item to be placed. + * @param item The item to be placed. * @param previousAmount The previous amount of the item. * @param positionOffset The offset from the client's base position. */ diff --git a/src/org/apollo/game/model/Position.java b/src/org/apollo/game/model/Position.java index ba7997aa..60824ac1 100644 --- a/src/org/apollo/game/model/Position.java +++ b/src/org/apollo/game/model/Position.java @@ -1,6 +1,6 @@ package org.apollo.game.model; -import com.google.common.base.Objects; +import com.google.common.base.MoreObjects; /** * Represents a position in the world. @@ -219,7 +219,7 @@ public final class Position { @Override public String toString() { - return Objects.toStringHelper(this).add("x", x).add("y", y).add("height", height) + return MoreObjects.toStringHelper(this).add("x", x).add("y", y).add("height", height) .add("sector x", getTopLeftSectorX()).add("sector y", getTopLeftSectorY()).toString(); } diff --git a/src/org/apollo/game/model/World.java b/src/org/apollo/game/model/World.java index 9afaf04f..2772272a 100644 --- a/src/org/apollo/game/model/World.java +++ b/src/org/apollo/game/model/World.java @@ -2,7 +2,6 @@ package org.apollo.game.model; import java.io.BufferedInputStream; import java.io.FileInputStream; -import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -232,7 +231,7 @@ public final class World { * @param release The release number. * @param fs The file system. * @param manager The plugin manager. TODO move this. - * @throws IOException If an I/O error occurs. + * @throws Exception If any definitions could not be loaded or there was a failure when loading plugins. */ public void init(int release, IndexedFileSystem fs, PluginManager manager) throws Exception { this.releaseNumber = release; @@ -345,6 +344,7 @@ public final class World { * Schedules a new task. * * @param task The {@link ScheduledTask}. + * @return {@code true} if the task was added successfully. */ public boolean schedule(ScheduledTask task) { return scheduler.schedule(task); diff --git a/src/org/apollo/game/model/def/NpcDefinition.java b/src/org/apollo/game/model/def/NpcDefinition.java index 13c05b3b..3ea59e4b 100644 --- a/src/org/apollo/game/model/def/NpcDefinition.java +++ b/src/org/apollo/game/model/def/NpcDefinition.java @@ -51,14 +51,13 @@ public final class NpcDefinition { /** * Gets the NPC definition for the specified id. * - * @param The id. + * @param id The id. * @return The definition. * @throws IndexOutOfBoundsException If the id is out of bounds. */ public static NpcDefinition lookup(int id) { if (id < 0 || id >= definitions.length) { - throw new IndexOutOfBoundsException(NpcDefinition.class.getName() + " lookup index " + id - + " out of bounds."); + throw new IndexOutOfBoundsException(NpcDefinition.class.getName() + " lookup index " + id + " out of bounds."); } return definitions[id]; } diff --git a/src/org/apollo/game/model/entity/Mob.java b/src/org/apollo/game/model/entity/Mob.java index 21e618c9..33e49363 100644 --- a/src/org/apollo/game/model/entity/Mob.java +++ b/src/org/apollo/game/model/entity/Mob.java @@ -167,7 +167,7 @@ public abstract class Mob extends Entity { /** * Gets this mob's {@link NpcDefinition}. * - * @param definition The definition. + * @return The npc definition. */ public final NpcDefinition getDefinition() { return definition; @@ -180,8 +180,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; } diff --git a/src/org/apollo/game/model/entity/Player.java b/src/org/apollo/game/model/entity/Player.java index e5eaa2aa..903cbd63 100644 --- a/src/org/apollo/game/model/entity/Player.java +++ b/src/org/apollo/game/model/entity/Player.java @@ -221,8 +221,8 @@ public final class Player extends Mob { * * @param username The username. */ - public boolean addFriend(String username) { - return friends.add(username.toLowerCase()); + public void addFriend(String username) { + friends.add(username.toLowerCase()); } /** @@ -230,8 +230,8 @@ public final class Player extends Mob { * * @param username The username. */ - public boolean addIgnore(String username) { - return ignores.add(username.toLowerCase()); + public void addIgnore(String username) { + ignores.add(username.toLowerCase()); } /** @@ -606,6 +606,7 @@ public final class Player extends Mob { * Removes the specified username from this player's friend list. * * @param username The username. + * @return {@code true} if the player's friend list contained the specified user, {@code false} if not. */ public boolean removeFriend(String username) { return friends.remove(username.toLowerCase()); @@ -615,6 +616,7 @@ public final class Player extends Mob { * Removes the specified username from this player's ignore list. * * @param username The username. + * @return {@code true} if the player's ignore list contained the specified user, {@code false} if not. */ public boolean removeIgnore(String username) { return ignores.remove(username.toLowerCase()); @@ -666,6 +668,7 @@ public final class Player extends Mob { * Sends a message to the player. * * @param message The message. + * @param filterable Whether or not the message can be filtered. */ public void sendMessage(String message, boolean filterable) { if (clientVersion > 0) { @@ -909,8 +912,8 @@ public final class Player extends Mob { @Override public String toString() { - return Player.class.getName() + " [username=" + getUsername() + ", privilege=" + privilegeLevel - + ", clientVersion=" + clientVersion + "]"; + return Player.class.getName() + " [username=" + getUsername() + ", privilege=" + privilegeLevel + ", clientVersion=" + + clientVersion + "]"; } /** @@ -925,8 +928,7 @@ public final class Player extends Mob { * Initialises the player's inventories. */ private void initInventories() { - InventoryListener fullInventoryListener = new FullInventoryListener(this, - FullInventoryListener.FULL_INVENTORY_MESSAGE); + InventoryListener fullInventoryListener = new FullInventoryListener(this, FullInventoryListener.FULL_INVENTORY_MESSAGE); InventoryListener fullBankListener = new FullInventoryListener(this, FullInventoryListener.FULL_BANK_MESSAGE); InventoryListener appearanceListener = new AppearanceInventoryListener(this); diff --git a/src/org/apollo/game/model/entity/SkillSet.java b/src/org/apollo/game/model/entity/SkillSet.java index 3b6db4a3..6943c393 100644 --- a/src/org/apollo/game/model/entity/SkillSet.java +++ b/src/org/apollo/game/model/entity/SkillSet.java @@ -125,14 +125,12 @@ public final class SkillSet { * * @param listener The listener. */ - public boolean addListener(SkillListener listener) { - return listeners.add(listener); + public void addListener(SkillListener listener) { + listeners.add(listener); } /** * Calculates the combat level for this skill set. - * - * @return The combat level. */ public void calculateCombatLevel() { int attack = skills[Skill.ATTACK].getMaximumLevel(); @@ -249,8 +247,8 @@ public final class SkillSet { * * @param listener The listener to remove. */ - public boolean removeListener(SkillListener listener) { - return listeners.remove(listener); + public void removeListener(SkillListener listener) { + listeners.remove(listener); } /** diff --git a/src/org/apollo/game/model/entity/attr/AttributeMap.java b/src/org/apollo/game/model/entity/attr/AttributeMap.java index 70c4c271..f816ab46 100644 --- a/src/org/apollo/game/model/entity/attr/AttributeMap.java +++ b/src/org/apollo/game/model/entity/attr/AttributeMap.java @@ -3,77 +3,82 @@ package org.apollo.game.model.entity.attr; import java.util.HashMap; import java.util.Map; +/** + * A {@link Map} wrapper used to store {@link Attribute Attributes} and their {@link AttributeDefinition definitions}. + * + * @author Major + */ public final class AttributeMap { - /** - * The map of attribute names to definitions. - */ - private static Map> definitions = new HashMap<>(50); + /** + * The map of attribute names to definitions. + */ + private static Map> definitions = new HashMap<>(50); - /** - * Registers an {@link AttributeDefinition}. - * - * @param name The name of the attribute. - * @param definition The definition. - */ - public static void addDefinition(String name, AttributeDefinition definition) { - definitions.put(name, definition); - } - - /** - * Gets the {@link AttributeDefinition} with the specified name, or {@code null} if it is not defined. - * - * @param name The name of the attribute. - * @return The attribute definition. - */ - public static AttributeDefinition getDefinition(String name) { - return definitions.get(name); - } - - /** - * Gets the {@link AttributeDefinitions}, as a {@link Map}. - * - * @return The map of attribute names to definitions. - */ - public static Map> getDefinitions() { - return new HashMap<>(definitions); - } - - /** - * The map of attribute names to attributes. - */ - private Map> attributes = new HashMap<>(); - - /** - * Gets the {@link Attribute} with the specified name. - * - * @param name The name of the attribute. - * @return The attribute. - */ - public Attribute getAttribute(String name) { - return attributes.get(name); - } - - /** - * Gets a shallow copy of the map of attributes. - * - * @return The attributes. - */ - public Map> getAttributes() { - return new HashMap<>(attributes); - } - - /** - * Sets the value of the {@link Attribute} with the specified name. - * - * @param name The name of the attribute. - * @param attribute The attribute. - */ - public void setAttribute(String name, Attribute attribute) { - if (getDefinition(name) == null) { - throw new IllegalArgumentException("Attributes must be defined before their value can be set."); - } - attributes.put(name, attribute); + /** + * Registers an {@link AttributeDefinition}. + * + * @param name The name of the attribute. + * @param definition The definition. + */ + public static void addDefinition(String name, AttributeDefinition definition) { + definitions.put(name, definition); + } + + /** + * Gets the {@link AttributeDefinition} with the specified name, or {@code null} if it is not defined. + * + * @param name The name of the attribute. + * @return The attribute definition. + */ + public static AttributeDefinition getDefinition(String name) { + return definitions.get(name); + } + + /** + * Gets the {@link AttributeDefinition}s, as a {@link Map}. + * + * @return The map of attribute names to definitions. + */ + public static Map> getDefinitions() { + return new HashMap<>(definitions); + } + + /** + * The map of attribute names to attributes. + */ + private Map> attributes = new HashMap<>(); + + /** + * Gets the {@link Attribute} with the specified name. + * + * @param name The name of the attribute. + * @return The attribute. + */ + public Attribute getAttribute(String name) { + return attributes.get(name); + } + + /** + * Gets a shallow copy of the map of attributes. + * + * @return The attributes. + */ + public Map> getAttributes() { + return new HashMap<>(attributes); + } + + /** + * Sets the value of the {@link Attribute} with the specified name. + * + * @param name The name of the attribute. + * @param attribute The attribute. + */ + public void setAttribute(String name, Attribute attribute) { + if (getDefinition(name) == null) { + throw new IllegalArgumentException("Attributes must be defined before their value can be set."); } + attributes.put(name, attribute); + } } \ No newline at end of file diff --git a/src/org/apollo/game/model/entity/attr/AttributeType.java b/src/org/apollo/game/model/entity/attr/AttributeType.java index 75e4e62e..ba9047d9 100644 --- a/src/org/apollo/game/model/entity/attr/AttributeType.java +++ b/src/org/apollo/game/model/entity/attr/AttributeType.java @@ -2,7 +2,7 @@ package org.apollo.game.model.entity.attr; /** * The type of attribute. The functionality of this enum (and other classes) is dependent on the ordering of the values - * - the expected order is {@link #BOOLEAN}, {@link#DOUBLE}, {@link #LONG}, {@link #STRING}, {@link #SYMBOL}. + * - the expected order is {@link #BOOLEAN}, {@link #DOUBLE}, {@link #LONG}, {@link #STRING}, {@link #SYMBOL}. * * @author Major */ diff --git a/src/org/apollo/game/model/inv/Inventory.java b/src/org/apollo/game/model/inv/Inventory.java index e8d60b67..cb075f24 100644 --- a/src/org/apollo/game/model/inv/Inventory.java +++ b/src/org/apollo/game/model/inv/Inventory.java @@ -460,7 +460,6 @@ public final class Inventory implements Cloneable { * under no circumstances make any changes to other slots. * * @param slot The slot. - * @param id The item id. * @param amount The amount to remove. * @return The amount that was removed (0 if nothing was removed). */ @@ -488,7 +487,7 @@ public final class Inventory implements Cloneable { /** * Removes the item (if any) that is in the specified slot. * - * @param slot + * @param slot The slot to reset. * @return The item that was in the slot. */ public Item reset(int slot) { diff --git a/src/org/apollo/game/model/setting/PrivacyState.java b/src/org/apollo/game/model/setting/PrivacyState.java index f5a5458c..e706f872 100644 --- a/src/org/apollo/game/model/setting/PrivacyState.java +++ b/src/org/apollo/game/model/setting/PrivacyState.java @@ -40,6 +40,7 @@ public enum PrivacyState { * Gets the privacy state for the specified numerical value. * * @param value The numerical value. + * @param chat Whether or not the value is for public chat. * @return The privacy state. * @throws IllegalArgumentException If the specified value is out of bounds. */ @@ -77,6 +78,7 @@ public enum PrivacyState { /** * Converts this privacy state to an integer. * + * @param chat Whether or not the value is for public chat. * @return The numerical value used by the client. */ public int toInteger(boolean chat) { diff --git a/src/org/apollo/game/scheduling/Scheduler.java b/src/org/apollo/game/scheduling/Scheduler.java index 4f8ea0b1..8c71d6e3 100644 --- a/src/org/apollo/game/scheduling/Scheduler.java +++ b/src/org/apollo/game/scheduling/Scheduler.java @@ -45,6 +45,7 @@ public final class Scheduler { * Schedules a new task. * * @param task The task to schedule. + * @return {@code true} if the task was added successfully. */ public boolean schedule(ScheduledTask task) { return newTasks.add(task); diff --git a/src/org/apollo/game/sync/block/SynchronizationBlock.java b/src/org/apollo/game/sync/block/SynchronizationBlock.java index 7bb017a5..c2440100 100644 --- a/src/org/apollo/game/sync/block/SynchronizationBlock.java +++ b/src/org/apollo/game/sync/block/SynchronizationBlock.java @@ -34,9 +34,9 @@ public abstract class SynchronizationBlock { * @return The appearance block. */ public static SynchronizationBlock createAppearanceBlock(Player player) { - return new AppearanceBlock(player.getEncodedName(), player.getAppearance(), player.getSkillSet() - .getCombatLevel(), 0, player.getEquipment(), player.getPrayerIcon(), player.isSkulled(), - player.getDefinition() == null ? -1 : player.getDefinition().getId()); + return new AppearanceBlock(player.getEncodedName(), player.getAppearance(), player.getSkillSet().getCombatLevel(), 0, + player.getEquipment(), player.getPrayerIcon(), player.isSkulled(), player.getDefinition() == null ? -1 : player + .getDefinition().getId()); } /** @@ -61,7 +61,7 @@ public abstract class SynchronizationBlock { } /** - * Creates a {@link ForceMovement} block with the specified parameters. + * Creates a {@link ForceMovementBlock} with the specified parameters. * * @param initialPosition The initial {@link Position} of the player. * @param finalPosition The final position of the player @@ -98,8 +98,8 @@ public abstract class SynchronizationBlock { */ 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); + return secondary ? new SecondaryHitUpdateBlock(damage, type, currentHealth, maximumHealth) : new HitUpdateBlock(damage, + type, currentHealth, maximumHealth); } /** diff --git a/src/org/apollo/game/sync/block/SynchronizationBlockSet.java b/src/org/apollo/game/sync/block/SynchronizationBlockSet.java index a5ff0510..d07c1a20 100644 --- a/src/org/apollo/game/sync/block/SynchronizationBlockSet.java +++ b/src/org/apollo/game/sync/block/SynchronizationBlockSet.java @@ -65,6 +65,7 @@ public final class SynchronizationBlockSet implements Cloneable { * Removes a {@link SynchronizationBlock} from this set. * * @param clazz The block's class. + * @return The removed block. */ @SuppressWarnings("unchecked") public T remove(Class clazz) { diff --git a/src/org/apollo/io/player/impl/BinaryPlayerSaver.java b/src/org/apollo/io/player/impl/BinaryPlayerSaver.java index 60cba4be..d60f2381 100644 --- a/src/org/apollo/io/player/impl/BinaryPlayerSaver.java +++ b/src/org/apollo/io/player/impl/BinaryPlayerSaver.java @@ -95,8 +95,7 @@ public final class BinaryPlayerSaver implements PlayerSaver { } Set>> attributes = player.getAttributes().entrySet(); - attributes - .removeIf(e -> AttributeMap.getDefinition(e.getKey()).getPersistence() != AttributePersistence.SERIALIZED); + attributes.removeIf(e -> AttributeMap.getDefinition(e.getKey()).getPersistence() != AttributePersistence.SERIALIZED); out.writeInt(attributes.size()); for (Entry> entry : attributes) { @@ -108,10 +107,10 @@ public final class BinaryPlayerSaver implements PlayerSaver { } /** - * Writes an attribute map entry to the specified output stream. + * Writes an {@link Attribute} to the specified output stream. * * @param out The output stream. - * @param entry The map entry. + * @param attribute The attribute. * @throws IOException If an I/O error occurs. */ private void saveAttribute(DataOutputStream out, Attribute attribute) throws IOException { diff --git a/src/org/apollo/io/player/impl/JdbcPlayerLoader.java b/src/org/apollo/io/player/impl/JdbcPlayerLoader.java index 6005be4e..9be78090 100644 --- a/src/org/apollo/io/player/impl/JdbcPlayerLoader.java +++ b/src/org/apollo/io/player/impl/JdbcPlayerLoader.java @@ -4,11 +4,16 @@ import org.apollo.io.player.PlayerLoader; import org.apollo.io.player.PlayerLoaderResponse; import org.apollo.security.PlayerCredentials; +/** + * A {@link PlayerLoader} that utilises {@code JDBC} to load player files. + * + * @author Major + */ public final class JdbcPlayerLoader implements PlayerLoader { @Override public PlayerLoaderResponse loadPlayer(PlayerCredentials credentials) throws Exception { - return null; + throw new UnsupportedOperationException("JDBC loading is not supported at this time."); } } \ No newline at end of file diff --git a/src/org/apollo/io/player/impl/JdbcPlayerSaver.java b/src/org/apollo/io/player/impl/JdbcPlayerSaver.java index 3098b324..bbdc7d3d 100644 --- a/src/org/apollo/io/player/impl/JdbcPlayerSaver.java +++ b/src/org/apollo/io/player/impl/JdbcPlayerSaver.java @@ -3,11 +3,16 @@ package org.apollo.io.player.impl; import org.apollo.game.model.entity.Player; import org.apollo.io.player.PlayerSaver; +/** + * A {@link PlayerSaver} that utilises {@code JDBC} to save the player. + * + * @author Major + */ public final class JdbcPlayerSaver implements PlayerSaver { @Override public void savePlayer(Player player) throws Exception { - + throw new UnsupportedOperationException("JDBC saving is not supported at this time."); } } \ No newline at end of file diff --git a/src/org/apollo/net/codec/game/DataOrder.java b/src/org/apollo/net/codec/game/DataOrder.java index 186333f4..b3e47730 100644 --- a/src/org/apollo/net/codec/game/DataOrder.java +++ b/src/org/apollo/net/codec/game/DataOrder.java @@ -1,7 +1,7 @@ package org.apollo.net.codec.game; /** - * Represents the order of bytes in a {@link DataType} when {@code {@link DataType#getBytes()} > 1}. + * Represents the order of bytes in a {@link DataType} when {@link DataType#getBytes()} {@code > 1}. * * @author Graham */ diff --git a/src/org/apollo/net/codec/game/GamePacketDecoder.java b/src/org/apollo/net/codec/game/GamePacketDecoder.java index ce32ec47..bfbded3f 100644 --- a/src/org/apollo/net/codec/game/GamePacketDecoder.java +++ b/src/org/apollo/net/codec/game/GamePacketDecoder.java @@ -15,7 +15,7 @@ import org.apollo.net.release.Release; import org.apollo.util.StatefulFrameDecoder; /** - * A {@link StatefulFrameDecoder} which decodes game packets. + * A {@link StatefulFrameDecoder} that decodes {@link GamePacket}s. * * @author Graham */ @@ -59,17 +59,16 @@ public final class GamePacketDecoder extends StatefulFrameDecoder out, GameDecoderState state) - throws IOException { + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out, GameDecoderState state) throws IOException { switch (state) { case GAME_OPCODE: - decodeOpcode(ctx, in, out); + decodeOpcode(in, out); break; case GAME_LENGTH: - decodeLength(ctx, in, out); + decodeLength(in); break; case GAME_PAYLOAD: - decodePayload(ctx, in, out); + decodePayload(in, out); break; default: throw new IllegalStateException("Invalid game decoder state."); @@ -77,34 +76,27 @@ public final class GamePacketDecoder extends StatefulFrameDecoder out) { + private void decodeLength(ByteBuf buffer) { if (buffer.isReadable()) { length = buffer.readUnsignedByte(); if (length != 0) { setState(GameDecoderState.GAME_PAYLOAD); } } - return null; } /** - * Decodes in the opcode state. + * Decodes the opcode state. * - * @param ctx The channel handler context. - * @param channel The channel. * @param buffer The buffer. - * @return The frame, or {@code null}. + * @param out The {@link List} of objects to be passed along the pipeline. * @throws IOException If a received opcode or packet type is illegal. */ - private void decodeOpcode(ChannelHandlerContext ctx, ByteBuf buffer, List out) throws IOException { + private void decodeOpcode(ByteBuf buffer, List out) throws IOException { if (buffer.isReadable()) { int encryptedOpcode = buffer.readUnsignedByte(); opcode = encryptedOpcode - random.nextInt() & 0xFF; @@ -135,15 +127,12 @@ public final class GamePacketDecoder extends StatefulFrameDecoder out) { + private void decodePayload(ByteBuf buffer, List out) { if (buffer.readableBytes() >= length) { ByteBuf payload = buffer.readBytes(length); setState(GameDecoderState.GAME_OPCODE); diff --git a/src/org/apollo/net/codec/login/LoginDecoder.java b/src/org/apollo/net/codec/login/LoginDecoder.java index ed381ecb..1c96f631 100644 --- a/src/org/apollo/net/codec/login/LoginDecoder.java +++ b/src/org/apollo/net/codec/login/LoginDecoder.java @@ -58,8 +58,7 @@ public final class LoginDecoder extends StatefulFrameDecoder } @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out, LoginDecoderState state) - throws Exception { + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out, LoginDecoderState state) throws Exception { switch (state) { case LOGIN_HANDSHAKE: decodeHandshake(ctx, in, out); @@ -79,10 +78,8 @@ public final class LoginDecoder extends StatefulFrameDecoder * Decodes in the handshake state. * * @param ctx The channel handler context. - * @param channel The channel. * @param buffer The buffer. - * @return The frame, or {@code null}. - * @throws Exception If an error occurs. + * @param out The {@link List} of objects to pass forward through the pipeline. */ private void decodeHandshake(ChannelHandlerContext ctx, ByteBuf buffer, List out) { if (buffer.isReadable()) { @@ -103,9 +100,8 @@ public final class LoginDecoder extends StatefulFrameDecoder * Decodes in the header state. * * @param ctx The channel handler context. - * @param channel The channel. * @param buffer The buffer. - * @return The frame, or {@code null}. + * @param out The {@link List} of objects to pass forward through the pipeline. * @throws IOException If the login type sent by the client is invalid. */ private void decodeHeader(ChannelHandlerContext ctx, ByteBuf buffer, List out) throws IOException { @@ -127,9 +123,8 @@ public final class LoginDecoder extends StatefulFrameDecoder * Decodes in the payload state. * * @param ctx The channel handler context. - * @param channel The channel. * @param buffer The buffer. - * @return The frame, or {@code null}. + * @param out The {@link List} of objects to pass forward through the pipeline. * @throws Exception If an error occurs. */ private void decodePayload(ChannelHandlerContext ctx, ByteBuf buffer, List out) throws Exception { @@ -201,8 +196,8 @@ public final class LoginDecoder extends StatefulFrameDecoder PlayerCredentials credentials = new PlayerCredentials(username, password, usernameHash, uid); IsaacRandomPair randomPair = new IsaacRandomPair(encodingRandom, decodingRandom); - LoginRequest request = new LoginRequest(credentials, randomPair, reconnecting, lowMemory, releaseNumber, - archiveCrcs, clientVersion); + LoginRequest request = new LoginRequest(credentials, randomPair, reconnecting, lowMemory, releaseNumber, archiveCrcs, + clientVersion); out.add(request); if (buffer.isReadable()) { diff --git a/src/org/apollo/net/codec/login/LoginEncoder.java b/src/org/apollo/net/codec/login/LoginEncoder.java index 238062ad..53f176ac 100644 --- a/src/org/apollo/net/codec/login/LoginEncoder.java +++ b/src/org/apollo/net/codec/login/LoginEncoder.java @@ -13,6 +13,9 @@ import java.util.List; */ public final class LoginEncoder extends MessageToMessageEncoder { + /** + * Creates the login encoder. + */ public LoginEncoder() { super(LoginResponse.class); } @@ -21,10 +24,12 @@ public final class LoginEncoder extends MessageToMessageEncoder { protected void encode(ChannelHandlerContext ctx, LoginResponse response, List out) { ByteBuf buffer = ctx.alloc().buffer(3); buffer.writeByte(response.getStatus()); + if (response.getStatus() == LoginConstants.STATUS_OK) { buffer.writeByte(response.getRights()); buffer.writeByte(response.isFlagged() ? 1 : 0); } + out.add(buffer); } diff --git a/src/org/apollo/net/codec/login/LoginRequest.java b/src/org/apollo/net/codec/login/LoginRequest.java index d2585e2d..cac93c87 100644 --- a/src/org/apollo/net/codec/login/LoginRequest.java +++ b/src/org/apollo/net/codec/login/LoginRequest.java @@ -54,9 +54,10 @@ public final class LoginRequest { * @param reconnecting The reconnecting flag. * @param releaseNumber The release number. * @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; diff --git a/src/org/apollo/net/release/r317/PlayerSynchronizationMessageEncoder.java b/src/org/apollo/net/release/r317/PlayerSynchronizationMessageEncoder.java index 3eaf6a37..4fa30fa4 100644 --- a/src/org/apollo/net/release/r317/PlayerSynchronizationMessageEncoder.java +++ b/src/org/apollo/net/release/r317/PlayerSynchronizationMessageEncoder.java @@ -333,7 +333,7 @@ public final class PlayerSynchronizationMessageEncoder extends MessageEncoder 0; if (seg.getType() == SegmentType.TELEPORT) { Position position = ((TeleportSegment) seg).getDestination(); diff --git a/src/org/apollo/net/release/r377/SetWidgetVisibilityMessageEncoder.java b/src/org/apollo/net/release/r377/SetWidgetVisibilityMessageEncoder.java index c7072df3..bea2655b 100644 --- a/src/org/apollo/net/release/r377/SetWidgetVisibilityMessageEncoder.java +++ b/src/org/apollo/net/release/r377/SetWidgetVisibilityMessageEncoder.java @@ -7,7 +7,7 @@ import org.apollo.net.codec.game.GamePacketBuilder; import org.apollo.net.release.MessageEncoder; /** - * A {@link MessageEncoder} for the {@link SetWidgetComponentEvent}. + * A {@link MessageEncoder} for the {@link SetWidgetVisibilityMessage}. * * @author Chris Fletcher */ diff --git a/src/org/apollo/net/session/Session.java b/src/org/apollo/net/session/Session.java index e2a323ad..5ac7108a 100644 --- a/src/org/apollo/net/session/Session.java +++ b/src/org/apollo/net/session/Session.java @@ -42,7 +42,6 @@ public abstract class Session { * Processes a message received from the channel. * * @param message The message. - * @throws Exception If an error occurs. */ public abstract void messageReceived(Object message); diff --git a/src/org/apollo/util/StatefulFrameDecoder.java b/src/org/apollo/util/StatefulFrameDecoder.java index 3a4a60e8..eef66617 100644 --- a/src/org/apollo/util/StatefulFrameDecoder.java +++ b/src/org/apollo/util/StatefulFrameDecoder.java @@ -1,7 +1,6 @@ package org.apollo.util; import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; @@ -11,11 +10,10 @@ import java.util.List; * A stateful implementation of a {@link ByteToMessageDecoder} which may be extended and used by other classes. The * current state is tracked by this class and is a user-specified enumeration. * - * The state may be changed by calling the {@link StatefulFrameDecoder#setState(Enum)} method. + * The state may be changed by calling the {@link StatefulFrameDecoder#setState} method. * - * The current state is supplied as a parameter in the - * {@link StatefulFrameDecoder#decode(ChannelHandlerContext, Channel, ByteBuf, Enum)} and - * {@link StatefulFrameDecoder#decodeLast(ChannelHandlerContext, Channel, ByteBuf, Enum)} methods. + * The current state is supplied as a parameter in the {@link StatefulFrameDecoder#decode} and + * {@link StatefulFrameDecoder#decodeLast} methods. * * This class is not thread safe: it is recommended that the state is only set in the decode methods overriden. * @@ -61,8 +59,8 @@ public abstract class StatefulFrameDecoder> extends ByteToMess * Decodes the received packets into a frame. * * @param ctx The current context of this handler. - * @param channel The channel. - * @param buffer The cumulative buffer, which may contain zero or more bytes. + * @param in The cumulative buffer, which may contain zero or more bytes. + * @param out The {@link List} of objects to pass forward through the pipeline. * @param state The current state. The state may be changed by calling {@link #setState(Enum)}. */ protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, List out, T state) throws Exception; @@ -77,8 +75,8 @@ public abstract class StatefulFrameDecoder> extends ByteToMess * required. If you do not, remaining data will be discarded! * * @param ctx The current context of this handler. - * @param channel The channel. - * @param buffer The cumulative buffer, which may contain zero or more bytes. + * @param in The cumulative buffer, which may contain zero or more bytes. + * @param out The {@link List} of objects to pass forward through the pipeline. * @param state The current state. The state may be changed by calling {@link #setState(Enum)}. */ protected void decodeLast(ChannelHandlerContext ctx, ByteBuf in, List out, T state) { diff --git a/src/org/apollo/util/plugin/PluginMetaData.java b/src/org/apollo/util/plugin/PluginMetaData.java index 4ee4be0e..d5fbeb3d 100644 --- a/src/org/apollo/util/plugin/PluginMetaData.java +++ b/src/org/apollo/util/plugin/PluginMetaData.java @@ -53,6 +53,7 @@ public final class PluginMetaData { * Creates the plugin meta data. * * @param id The plugin's id. + * @param base The plugin's base folder. * @param name The plugin's name. * @param description The plugin's description. * @param authors The plugin's authors.