public static TownTeleport getByIcon(int icon) { for (TownTeleport town : TownTeleport.values()) { if (town.getIcon() == icon) { return town; } } return null; // Default }
public static String getTownTeleportSelection() { String mapselect = ""; for (TownTeleport gate : TownTeleport.values()) { mapselect += "#" + gate.getIcon() + "#" + gate.getName(); } if (mapselect == null || "".equals(mapselect)) { mapselect = "#-1# There are no locations you can move to."; } return mapselect; }
public static int getTownLocation(int icon) { return TownTeleport.getByIcon(icon) != null ? TownTeleport.getByIcon(icon).getMap() : TownTeleport.TOWN_0.getMap(); }