use of org.bukkit.configuration.ConfigurationSection in project Minigames by AddstarMC.
the class RewardsModule method load.
@Override
public void load(FileConfiguration config) {
ConfigurationSection root = config.getConfigurationSection(getMinigame().getName(false));
String name = root.getString("reward-scheme", "standard");
scheme = RewardSchemes.createScheme(name);
if (scheme == null) {
scheme = new StandardRewardScheme();
}
ConfigurationSection rewards = root.getConfigurationSection("rewards");
scheme.load(rewards);
}
use of org.bukkit.configuration.ConfigurationSection in project Minigames by AddstarMC.
the class RewardsModule method save.
@Override
public void save(FileConfiguration config) {
String name = RewardSchemes.getName(scheme.getClass());
ConfigurationSection root = config.getConfigurationSection(getMinigame().getName(false));
root.set("reward-scheme", name);
ConfigurationSection rewards = root.createSection("rewards");
scheme.save(rewards);
}
use of org.bukkit.configuration.ConfigurationSection in project Minigames by AddstarMC.
the class HierarchyRewardScheme method save.
private void save(TreeMap<T, Rewards> map, ConfigurationSection section) {
for (Entry<T, Rewards> entry : map.entrySet()) {
ConfigurationSection scoreSection = section.createSection(String.valueOf(entry.getKey()));
entry.getValue().save(scoreSection);
}
}
use of org.bukkit.configuration.ConfigurationSection in project Minigames by AddstarMC.
the class HierarchyRewardScheme method save.
@Override
public void save(ConfigurationSection config) {
ConfigurationSection primary = config.createSection("score-primary");
ConfigurationSection secondary = config.createSection("score-secondary");
save(primaryRewards, primary);
save(secondaryRewards, secondary);
}
use of org.bukkit.configuration.ConfigurationSection in project Minigames by AddstarMC.
the class RewardGroup method save.
public void save(ConfigurationSection section) {
int index = 0;
for (RewardType item : items) {
ConfigurationSection itemSection = section.createSection(String.valueOf(index));
itemSection.set("type", item.getName());
item.saveReward("data", itemSection);
index++;
}
section.set("rarity", rarity.name());
}
Aggregations