diff --git a/src/org/apollo/game/model/def/EquipmentDefinition.java b/src/org/apollo/game/model/def/EquipmentDefinition.java index a035b722..add38b49 100644 --- a/src/org/apollo/game/model/def/EquipmentDefinition.java +++ b/src/org/apollo/game/model/def/EquipmentDefinition.java @@ -22,6 +22,7 @@ public final class EquipmentDefinition { * Initialises the equipment definitions. * * @param definitions The definitions. + * @throws RuntimeException If there is an id mismatch. */ public static void init(EquipmentDefinition[] definitions) { for (int id = 0; id < definitions.length; id++) { @@ -79,6 +80,11 @@ public final class EquipmentDefinition { this.id = id; } + /** + * Gets the total number of equipment definitions. + * + * @return The count. + */ public int count() { return definitions.size(); } diff --git a/src/org/apollo/game/model/def/ItemDefinition.java b/src/org/apollo/game/model/def/ItemDefinition.java index 2cdd52e9..3cd50ff5 100644 --- a/src/org/apollo/game/model/def/ItemDefinition.java +++ b/src/org/apollo/game/model/def/ItemDefinition.java @@ -28,9 +28,9 @@ public final class ItemDefinition { private static final BiMap notesInverse = notes.inverse(); /** - * Gets the total number of items. + * Gets the total number of item definitions. * - * @return The total number of items. + * @return The count. */ public static int count() { return definitions.length; @@ -88,7 +88,8 @@ public final class ItemDefinition { */ public static ItemDefinition lookup(int id) { if (id < 0 || id >= definitions.length) { - throw new IndexOutOfBoundsException("item id is out of bounds"); + throw new IndexOutOfBoundsException(ItemDefinition.class.getName() + " lookup index " + id + + " out of bounds."); } return definitions[id]; } diff --git a/src/org/apollo/game/model/def/NpcDefinition.java b/src/org/apollo/game/model/def/NpcDefinition.java index 11f9c422..3945d6f5 100644 --- a/src/org/apollo/game/model/def/NpcDefinition.java +++ b/src/org/apollo/game/model/def/NpcDefinition.java @@ -15,9 +15,9 @@ public final class NpcDefinition { private static NpcDefinition[] definitions; /** - * Gets the total number of NPCs. + * Gets the total number of npc definitions. * - * @return The total number of NPCs. + * @return The count. */ public static int count() { return definitions.length; @@ -43,7 +43,7 @@ public final class NpcDefinition { for (int id = 0; id < definitions.length; id++) { NpcDefinition def = definitions[id]; if (def.getId() != id) { - throw new RuntimeException("npc definition id mismatch"); + throw new RuntimeException("Npc definition id mismatch!"); } } } @@ -57,7 +57,8 @@ public final class NpcDefinition { */ public static NpcDefinition lookup(int id) { if (id < 0 || id >= definitions.length) { - throw new IndexOutOfBoundsException("npc id is 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/def/ObjectDefinition.java b/src/org/apollo/game/model/def/ObjectDefinition.java index 63e90846..82497e2f 100644 --- a/src/org/apollo/game/model/def/ObjectDefinition.java +++ b/src/org/apollo/game/model/def/ObjectDefinition.java @@ -15,9 +15,9 @@ public final class ObjectDefinition { private static ObjectDefinition[] definitions; /** - * Gets the total number of objects. + * Gets the total number of object definitions. * - * @return The total number of objects. + * @return The count. */ public static int count() { return definitions.length; @@ -36,6 +36,7 @@ public final class ObjectDefinition { * Initialises the object definitions. * * @param definitions The decoded definitions. + * @throws RuntimeException If there is an id mismatch. */ public static void init(ObjectDefinition[] definitions) { ObjectDefinition.definitions = definitions; @@ -53,6 +54,7 @@ public final class ObjectDefinition { * * @param id The id of the object. * @return The definition. + * @throws IndexOutOfBoundsException If the id is out of bounds. */ public static ObjectDefinition lookup(int id) { if (id < 0 || id > definitions.length) {