What he suggested hardly does any good, it just fills the enum with variables it shouldn't really contain.
What he means is what you change to enum to support more variables, as for example:
Code:
ROCK_CRABS(238123, 0, "None", "None", 0, new Location(2674, 3710, 0), false, false, 5227, 130058),//notice I added two more numbers in the end, both are being the numbers relevant to the 'cases'. However there may be more components for the given slot, so it could get ugly there.
After which you could simply, instead of switching different componentID's (Assuming you're switching components) you could loop through the enum values, for example
Code:
for (TeleportData teles : TeleportData.values()) {
if (teles.getComponentId() == componentId)
player.getMagic().teleport(teles.getPosition(), TeleportTypes.SPELL_BOOK);
}
However I personally wouldn't advise storing data such as component IDs within an enum, it'll just look nasty especially if there are loads of them. If there's a pattern within the components, you could do it much better, for example:
Say there are components 5000, 5002, 5004, 5006 etc.
Instead of switching the components, you could simply write something like:
Code:
//this is WITHIN the enum
private static final HashMap<Integer, TeleportData> TELES = new HashMap<Integer, TeleportData>();
static {
for (TeleportData t : values())
TELES.put(t.ordinal(), t);
}
public static TeleportData getTeleport(int id) {
return TELES.get(id);
}
& in the spot in which it currently switches the components, you could do it as
if (componentId >= 5000 && componentId <= 5010) {
player.getMagic().teleport(TeleportData.getTelepor t((componentId - 5010) / 2), TeleportTypes.SPELL_BOOK);
}