Search in sources :

Example 31 with ConfigurationSection

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);
}
Also used : StandardRewardScheme(au.com.mineauz.minigames.minigame.reward.scheme.StandardRewardScheme) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 32 with ConfigurationSection

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);
}
Also used : ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 33 with ConfigurationSection

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);
    }
}
Also used : Rewards(au.com.mineauz.minigames.minigame.reward.Rewards) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 34 with ConfigurationSection

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);
}
Also used : ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 35 with ConfigurationSection

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());
}
Also used : ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Aggregations

ConfigurationSection (org.bukkit.configuration.ConfigurationSection)49 ItemStack (org.bukkit.inventory.ItemStack)7 IOException (java.io.IOException)6 Material (org.bukkit.Material)6 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)6 File (java.io.File)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 MemoryConfiguration (org.bukkit.configuration.MemoryConfiguration)3 EntityType (org.bukkit.entity.EntityType)3 Rewards (au.com.mineauz.minigames.minigame.reward.Rewards)2 ChatColor (com.gamingmesh.jobs.util.ChatColor)2 ASkyBlock (com.wasteofplastic.acidisland.ASkyBlock)2 BigDecimal (java.math.BigDecimal)2 Enchantment (org.bukkit.enchantments.Enchantment)2 SQLiteBackend (au.com.mineauz.minigames.backend.sqlite.SQLiteBackend)1 MenuItemRewardGroup (au.com.mineauz.minigames.menu.MenuItemRewardGroup)1 LoadoutAddon (au.com.mineauz.minigames.minigame.modules.LoadoutModule.LoadoutAddon)1 StandardRewardScheme (au.com.mineauz.minigames.minigame.reward.scheme.StandardRewardScheme)1 NoChargeException (com.earth2me.essentials.commands.NoChargeException)1