Cleanup and re-organise methods in some org.apollo.game.model classes.

This commit is contained in:
Major-
2014-02-25 05:40:39 +00:00
parent a71d14ed55
commit 0d169d5871
7 changed files with 204 additions and 204 deletions
+18 -18
View File
@@ -7,16 +7,16 @@ package org.apollo.game.model;
*/
public enum Direction {
/**
* East movement.
*/
EAST(4),
/**
* No movement.
*/
NONE(-1),
/**
* North west movement.
*/
NORTH_WEST(0),
/**
* North movement.
*/
@@ -28,19 +28,9 @@ public enum Direction {
NORTH_EAST(2),
/**
* West movement.
* North west movement.
*/
WEST(3),
/**
* East movement.
*/
EAST(4),
/**
* South west movement.
*/
SOUTH_WEST(5),
NORTH_WEST(0),
/**
* South movement.
@@ -50,7 +40,17 @@ public enum Direction {
/**
* South east movement.
*/
SOUTH_EAST(7);
SOUTH_EAST(7),
/**
* South west movement.
*/
SOUTH_WEST(5),
/**
* West movement.
*/
WEST(3);
/**
* An empty direction array.
+35 -35
View File
@@ -9,41 +9,6 @@ import java.io.Serializable;
*/
public abstract class Entity implements Serializable {
/**
* The generated serial UID.
*/
private static final long serialVersionUID = 5968243763380631014L;
/**
* The position of this entity.
*/
protected Position position;
/**
* Creates a new entity with the specified position.
*
* @param position The position.
*/
public Entity(Position position) {
this.position = position;
}
/**
* Gets the {@link EntityType} of this entity.
*
* @return The type.
*/
public abstract EntityType getEntityType();
/**
* Gets the {@link Position} of this entity.
*
* @return The position.
*/
public Position getPosition() {
return position;
}
/**
* Represents a type of {@link Entity}.
*
@@ -82,4 +47,39 @@ public abstract class Entity implements Serializable {
STATIC_OBJECT;
}
/**
* The generated serial UID.
*/
private static final long serialVersionUID = 5968243763380631014L;
/**
* The position of this entity.
*/
protected Position position;
/**
* Creates a new entity with the specified position.
*
* @param position The position.
*/
public Entity(Position position) {
this.position = position;
}
/**
* Gets the {@link EntityType} of this entity.
*
* @return The type.
*/
public abstract EntityType getEntityType();
/**
* Gets the {@link Position} of this entity.
*
* @return The position.
*/
public Position getPosition() {
return position;
}
}
@@ -8,59 +8,59 @@ package org.apollo.game.model;
public final class EquipmentConstants {
/**
* The hat slot.
* The amulet slot.
*/
public static final int HAT = 0;
public static final int AMULET = 2;
/**
* The arrows slot.
*/
public static final int ARROWS = 13;
/**
* The cape slot.
*/
public static final int CAPE = 1;
/**
* The amulet slot.
*/
public static final int AMULET = 2;
/**
* The weapon slot.
*/
public static final int WEAPON = 3;
/**
* The chest slot.
*/
public static final int CHEST = 4;
/**
* The shield slot.
*/
public static final int SHIELD = 5;
/**
* The legs slot.
*/
public static final int LEGS = 7;
/**
* The hands slot.
*/
public static final int HANDS = 9;
/**
* The feet slot.
*/
public static final int FEET = 10;
/**
* The hands slot.
*/
public static final int HANDS = 9;
/**
* The hat slot.
*/
public static final int HAT = 0;
/**
* The legs slot.
*/
public static final int LEGS = 7;
/**
* The ring slot.
*/
public static final int RING = 12;
/**
* The arrows slot.
* The shield slot.
*/
public static final int ARROWS = 13;
public static final int SHIELD = 5;
/**
* The weapon slot.
*/
public static final int WEAPON = 3;
/**
* Default private constructor to prevent instantiation;
+46 -46
View File
@@ -107,15 +107,6 @@ public abstract class Mob extends Entity {
init();
}
/**
* Gets this mob's {@link SynchronizationBlockSet}.
*
* @return The block set.
*/
public final SynchronizationBlockSet getBlockSet() {
return blockSet;
}
/**
* Deals damage to this mob.
*
@@ -132,6 +123,15 @@ public abstract class Mob extends Entity {
skillSet.setSkill(Skill.HITPOINTS, new Skill(hitpoints.getExperience(), current, maximum));
}
/**
* Gets this mob's {@link SynchronizationBlockSet}.
*
* @return The block set.
*/
public final SynchronizationBlockSet getBlockSet() {
return blockSet;
}
/**
* Gets this mob's movement {@link Direction}s, as an array.
*
@@ -154,6 +154,15 @@ public abstract class Mob extends Entity {
return equipment;
}
/**
* Gets the {@link Position} this mob is facing towards.
*
* @return The position.
*/
public Position getFacingPosition() {
return facingPosition;
}
/**
* Gets the first {@link Direction}.
*
@@ -174,6 +183,15 @@ public abstract class Mob extends Entity {
}
}
/**
* Gets the mob this mob is interacting with.
*
* @return The mob.
*/
public Mob getInteractingMob() {
return interactingMob;
}
/**
* Gets this mob's inventory.
*
@@ -318,6 +336,16 @@ public abstract class Mob extends Entity {
}
}
/**
* Updates this mob's interacting mob.
*
* @param mob The mob.
*/
public final void setInteractingMob(Mob mob) {
blockSet.add(SynchronizationBlock.createInteractingMobBlock(mob.index));
this.interactingMob = mob;
}
/**
* Sets the{@link Position} of this mob.
*
@@ -327,6 +355,15 @@ public abstract class Mob extends Entity {
this.position = position;
}
/**
* Sets whether this mob is teleporting or not.
*
* @param teleporting {@code true} if the mob is teleporting, {@code false} if not.
*/
public void setTeleporting(boolean teleporting) {
this.teleporting = teleporting;
}
/**
* Forces this mob to shout a message. Only messages said by a player can be shown in the chat box.
*
@@ -337,15 +374,6 @@ public abstract class Mob extends Entity {
blockSet.add(SynchronizationBlock.createForceChatBlock(message));
}
/**
* Sets whether this mob is teleporting or not.
*
* @param teleporting {@code true} if the mob is teleporting, {@code false} if not.
*/
public void setTeleporting(boolean teleporting) {
this.teleporting = teleporting;
}
/**
* Starts a new action, stopping the current one if it exists.
*
@@ -399,15 +427,6 @@ public abstract class Mob extends Entity {
stopAction(); // TODO do it on any movement is a must... walking queue perhaps?
}
/**
* Gets the {@link Position} this mob is facing towards.
*
* @return The position.
*/
public Position getFacingPosition() {
return facingPosition;
}
/**
* Turns this mob to face the specified {@link Position}.
*
@@ -418,23 +437,4 @@ public abstract class Mob extends Entity {
this.facingPosition = position;
}
/**
* Updates this mob's interacting mob.
*
* @param mob The mob.
*/
public final void setInteractingMob(Mob mob) {
blockSet.add(SynchronizationBlock.createInteractingMobBlock(mob.index));
this.interactingMob = mob;
}
/**
* Gets the mob this mob is interacting with.
*
* @return The mob.
*/
public Mob getInteractingMob() {
return interactingMob;
}
}
+14 -14
View File
@@ -92,6 +92,11 @@ public final class Player extends Mob {
*/
private transient boolean excessivePlayers = false;
/**
* Indicates whether this player has the message filter enabled.
*/
private boolean filteringMessages = false;
/**
* The privacy state of this player's private chat.
*/
@@ -187,11 +192,6 @@ public final class Player extends Mob {
*/
private transient int worldId = 1;
/**
* Indicates whether this player has the message filter enabled.
*/
private boolean filteringMessages = false;
/**
* Creates the {@link Player}.
*
@@ -628,6 +628,15 @@ public final class Player extends Mob {
send(new LogoutEvent());
}
/**
* Indicates whether the message filter is enabled.
*
* @return {@code true} if the filter is enabled, otherwise {@code false}.
*/
public boolean messageFilterEnabled() {
return filteringMessages;
}
/**
* Removes the specified username from this player's friend list.
*
@@ -948,15 +957,6 @@ public final class Player extends Mob {
return filteringMessages = !filteringMessages;
}
/**
* Indicates whether the message filter is enabled.
*
* @return {@code true} if the filter is enabled, otherwise {@code false}.
*/
public boolean messageFilterEnabled() {
return filteringMessages;
}
/**
* Toggles whether the player is running or not.
*/
+53 -53
View File
@@ -7,60 +7,35 @@ package org.apollo.game.model;
*/
public final class Skill {
/**
* The agility id.
*/
public static final int AGILITY = 16;
/**
* The attack id.
*/
public static final int ATTACK = 0;
/**
* The defence id.
*/
public static final int DEFENCE = 1;
/**
* The strength id.
*/
public static final int STRENGTH = 2;
/**
* The hitpoints id.
*/
public static final int HITPOINTS = 3;
/**
* The ranged id.
*/
public static final int RANGED = 4;
/**
* The prayer id.
*/
public static final int PRAYER = 5;
/**
* The magic id.
*/
public static final int MAGIC = 6;
/**
* The cooking id.
*/
public static final int COOKING = 7;
/**
* The woodcutting id.
* The crafting id.
*/
public static final int WOODCUTTING = 8;
public static final int CRAFTING = 12;
/**
* The fletching id.
* The defence id.
*/
public static final int FLETCHING = 9;
public static final int DEFENCE = 1;
/**
* The fishing id.
* The farming id.
*/
public static final int FISHING = 10;
public static final int FARMING = 19;
/**
* The firemaking id.
@@ -68,19 +43,14 @@ public final class Skill {
public static final int FIREMAKING = 11;
/**
* The crafting id.
* The fishing id.
*/
public static final int CRAFTING = 12;
public static final int FISHING = 10;
/**
* The smithing id.
* The fletching id.
*/
public static final int SMITHING = 13;
/**
* The mining id.rivate
*/
public static final int MINING = 14;
public static final int FLETCHING = 9;
/**
* The herblore id.
@@ -88,24 +58,29 @@ public final class Skill {
public static final int HERBLORE = 15;
/**
* The agility id.
* The hitpoints id.
*/
public static final int AGILITY = 16;
public static final int HITPOINTS = 3;
/**
* The thieving id.
* The magic id.
*/
public static final int THIEVING = 17;
public static final int MAGIC = 6;
/**
* The slayer id.
* The mining id.rivate
*/
public static final int SLAYER = 18;
public static final int MINING = 14;
/**
* The farming id.
* The prayer id.
*/
public static final int FARMING = 19;
public static final int PRAYER = 5;
/**
* The ranged id.
*/
public static final int RANGED = 4;
/**
* The runecraft id.
@@ -119,6 +94,31 @@ public final class Skill {
"Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining",
"Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft" };
/**
* The slayer id.
*/
public static final int SLAYER = 18;
/**
* The smithing id.
*/
public static final int SMITHING = 13;
/**
* The strength id.
*/
public static final int STRENGTH = 2;
/**
* The thieving id.
*/
public static final int THIEVING = 17;
/**
* The woodcutting id.
*/
public static final int WOODCUTTING = 8;
/**
* Gets the name of a skill.
*
+9 -9
View File
@@ -28,15 +28,6 @@ public final class SlottedItem {
this.item = item;
}
/**
* Gets the id of the {@link Item}.
*
* @return The id.
*/
public int getId() {
return item.getId();
}
/**
* Gets the amount of the {@link Item}.
*
@@ -46,6 +37,15 @@ public final class SlottedItem {
return item.getAmount();
}
/**
* Gets the id of the {@link Item}.
*
* @return The id.
*/
public int getId() {
return item.getId();
}
/**
* Gets the item.
*