@Override public void save(Storage profiles, int UID) { profiles.setBoolean(UID + ".wizard.unlimited-mana", unlimitedMana); profiles.setString(UID + ".wizard.time", time); profiles.setString(UID + ".wizard.mode", mode.name()); profiles.setInt(UID + ".wizard.mana", mana); profiles.setString(UID + ".wizard.locations", Joiner.on(":").skipNulls().join(locations)); profiles.setString(UID + ".wizard.mob", mob.name()); }
@Override public void load(Storage profiles, int UID) { unlimitedMana = profiles.getBoolean(UID + ".wizard.unlimited-mana"); time = profiles.getString(UID + ".wizard.time", "morning"); mode = (profiles.keyExists(UID + ".wizard.mode") && WizardMode.parse(profiles.getString(UID + ".wizard.mode")) != null) ? WizardMode.parse(profiles.getString(UID + ".wizard.mode")) : WizardMode.TELEPORT; mana = profiles.getInt(UID + ".wizard.mana", 10); locations.clear(); for (String location : splitter.split(profiles.getString(UID + ".wizard.locations"))) { locations.add(location.replace("(", "").replace(")", "")); } mob = (CreatureType.fromName(profiles.getString(UID + ".wizard.mob")) != null) ? CreatureType.fromName(profiles.getString(UID + ".wizard.mob")) : CreatureType.CREEPER; mobIndex = mob.ordinal(); }