Java Code Examples for org.bukkit.configuration.file.FileConfiguration#addDefault()

The following examples show how to use org.bukkit.configuration.file.FileConfiguration#addDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Sweeping.java    From MineTinker with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%RED%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.IRON_INGOT);
}
 
Example 2
Source File: Knockback.java    From MineTinker with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GRAY%");
	config.addDefault("MaxLevel", 2);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.TNT);
}
 
Example 3
Source File: Melting.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GOLD%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("BonusMultiplier", 0.1); //Percent of Bonus-damage per Level or Damage-reduction on Armor
	config.addDefault("CancelBurningOnArmor", true);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.MAGMA_BLOCK);

	this.bonusMultiplier = config.getDouble("BonusMultiplier", 0.1);
	this.cancelBurning = config.getBoolean("CancelBurningOnArmor", true);

	this.description = this.description.replaceAll("%amount", String.valueOf(this.bonusMultiplier * 100));
}
 
Example 4
Source File: SoulSpeed.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GRAY%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "GSG");
	config.addDefault("Recipe.Middle", "SAS");
	config.addDefault("Recipe.Bottom", "GSG");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("S", Material.SOUL_SAND.name());
	recipeMaterials.put("G", Material.GOLD_BLOCK.name());
	recipeMaterials.put("A", Material.ANCIENT_DEBRIS.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.SOUL_SAND);
}
 
Example 5
Source File: Sunblazer.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%YELLOW%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("DamageMultiplierPerLevel", 0.1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "GIG");
	config.addDefault("Recipe.Middle", "IDI");
	config.addDefault("Recipe.Bottom", "GIG");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("G", Material.GOLD_BLOCK.name());
	recipeMaterials.put("D", Material.DAYLIGHT_DETECTOR.name());
	recipeMaterials.put("I", Material.GOLD_INGOT.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.DAYLIGHT_DETECTOR);
	this.damageMultiplierPerLevel = config.getDouble("DamageMultiplierPerLevel", 0.1);

	this.description = this.description
			.replaceAll("%amountmin", String.format("%.2f", (Math.pow(this.damageMultiplierPerLevel + 1.0, 1) - 1) * 100))
			.replaceAll("%amountmax", String.format("%.2f", (Math.pow(this.damageMultiplierPerLevel + 1.0, this.getMaxLvl()) - 1) * 100));
}
 
Example 6
Source File: Speedy.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%BLUE%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);
	config.addDefault("SpeedPerLevel", 0.01);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "R R");
	config.addDefault("Recipe.Middle", " H ");
	config.addDefault("Recipe.Bottom", "R R");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("H", Material.RABBIT_HIDE.name());
	recipeMaterials.put("R", Material.RABBIT_FOOT.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	this.speedPerLevel = config.getDouble("SpeedPerLevel");

	init(Material.RABBIT_HIDE);

	this.description = this.description.replace("%amount", String.valueOf(this.speedPerLevel * 100));
}
 
Example 7
Source File: Tanky.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GRAY%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);
	config.addDefault("HealthPerLevel", 3);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "RBR");
	config.addDefault("Recipe.Middle", "BOB");
	config.addDefault("Recipe.Bottom", "RBR");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("B", Material.BONE.name());
	recipeMaterials.put("O", Material.OBSIDIAN.name());
	recipeMaterials.put("R", Material.ROTTEN_FLESH.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	this.healthPerLevel = config.getInt("HealthPerLevel", 3);

	init(Material.OBSIDIAN);

	this.description = this.description.replace("%amount", String.valueOf(this.healthPerLevel / 2.0));
}
 
Example 8
Source File: Experienced.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GREEN%");
	config.addDefault("MaxLevel", 10);
	config.addDefault("SlotCost", 1);
	config.addDefault("PercentagePerLevel", 2); //= 20% at Level 10 -> every 5th hit / block will trigger Experienced
	config.addDefault("Amount", 1); //How much XP should be dropped when triggered

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);
	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "   ");
	config.addDefault("Recipe.Middle", " E ");
	config.addDefault("Recipe.Bottom", "   ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("E", Material.EXPERIENCE_BOTTLE.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.EXPERIENCE_BOTTLE);

	this.percentagePerLevel = config.getInt("PercentagePerLevel", 2);
	this.amount = config.getInt("Amount", 1);
	this.description = this.description.replace("%chance", String.valueOf(this.percentagePerLevel))
			.replace("%amount", String.valueOf(this.amount));
}
 
Example 9
Source File: AntiArrowPlating.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%WHITE%");
	config.addDefault("MaxLevel", 4);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "IAI");
	config.addDefault("Recipe.Middle", "ADA");
	config.addDefault("Recipe.Bottom", "IAI");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("I", Material.IRON_BLOCK.name());
	recipeMaterials.put("A", Material.ARROW.name());
	recipeMaterials.put("D", Material.DIAMOND.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	// Save Config
	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	// Initialize modifier
	init(Material.IRON_BLOCK);
}
 
Example 10
Source File: Protecting.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GRAY%");
	config.addDefault("MaxLevel", 4);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "DID");
	config.addDefault("Recipe.Middle", "IOI");
	config.addDefault("Recipe.Bottom", "DID");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("D", Material.DIAMOND.name());
	recipeMaterials.put("I", Material.IRON_INGOT.name());
	recipeMaterials.put("O", Material.OBSIDIAN.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.OBSIDIAN);
}
 
Example 11
Source File: Glowing.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%YELLOW%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 200); //ticks INTEGER (20 ticks ~ 1 sec)
	config.addDefault("DurationMultiplier", 1.4); //Duration * (Multiplier^Level) DOUBLE

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "GGG");
	config.addDefault("Recipe.Middle", "GEG");
	config.addDefault("Recipe.Bottom", "GGG");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("G", Material.GLOWSTONE_DUST.name());
	recipeMaterials.put("E", Material.ENDER_EYE.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.GLOWSTONE);

	this.duration = config.getInt("Duration", 200);
	this.durationMultiplier = config.getDouble("DurationMultiplier", 1.4);

	this.description = this.description.replaceAll("%durationmin", String.valueOf(this.duration / 20.0d))
			.replaceAll("%durationmax", String.valueOf(Math.round(this.duration * Math.pow(this.durationMultiplier, this.getMaxLvl() - 1)) / 20.0d));
}
 
Example 12
Source File: Shulking.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%LIGHT_PURPLE%");
	config.addDefault("MaxLevel", 10);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 20); //ticks (20 ticks ~ 1 sec)
	config.addDefault("EffectAmplifier", 2); //per Level (Level 1 = 0, Level 2 = 2, Level 3 = 4, ...)
	config.addDefault("GivesImmunityToEffect", true);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", " S ");
	config.addDefault("Recipe.Middle", " C ");
	config.addDefault("Recipe.Bottom", " S ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("S", Material.SHULKER_SHELL.name());
	recipeMaterials.put("C", Material.CHORUS_FRUIT.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.SHULKER_SHELL);

	this.duration = config.getInt("Duration", 20);
	this.effectAmplifier = config.getInt("EffectAmplifier", 2);
	this.givesImmunity = config.getBoolean("GivesImmunityToEffect", true);

	this.description = this.description.replace("%duration", String.valueOf(this.duration));
}
 
Example 13
Source File: Directing.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("MaxLevel", 1);
	config.addDefault("SlotCost", 1);
	config.addDefault("WorksOnXP", true);
	config.addDefault("MinimumLevelToGetXP", 1); //Modifier-Level to give Player XP
	config.addDefault("WorkInPVP", true);
	config.addDefault("Color", "%GRAY%");

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "ECE");
	config.addDefault("Recipe.Middle", "CIC");
	config.addDefault("Recipe.Bottom", "ECE");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("C", Material.COMPASS.name());
	recipeMaterials.put("E", Material.ENDER_PEARL.name());
	recipeMaterials.put("I", Material.IRON_BLOCK.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.COMPASS);

	this.workInPVP = config.getBoolean("WorkInPVP", true);
	this.workOnXP = config.getBoolean("WorksOnXP", true);
	this.minimumLevelForXP = config.getInt("MinimumLevelToGetXP", 1);
}
 
Example 14
Source File: Propelling.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%GOLD%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("CooldownInSeconds", 5);
	config.addDefault("Elytra.DurabilityLoss", 10);
	config.addDefault("Elytra.SpeedPerLevel", 0.05);
	config.addDefault("Elytra.Sound", true);
	config.addDefault("Elytra.Particles", true);
	config.addDefault("ConsiderReinforced", true); //should Reinforced (Unbreaking) be considered
	config.addDefault("ReinforcedUseLessDurability", true); //should Reinforced lessen the durability damage or if false chance to dont use durability at all

	config.addDefault("EnchantCost", 25);
	config.addDefault("Enchantable", true);

	config.addDefault("Recipe.Enabled", false);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.FIREWORK_STAR);

	this.durabilityLoss = config.getInt("Elytra.DurabilityLoss", 10);
	this.speedPerLevel = config.getDouble("Elytra.SpeedPerLevel", 0.05);
	this.considerReinforced = config.getBoolean("ConsiderReinforced", true);
	this.useLessDurability = config.getBoolean("ReinforcedUseLessDurability", true);
	this.cooldownInSeconds = config.getInt("CooldownInSeconds", 5);

	this.sound = config.getBoolean("Elytra.Sound", true);
	this.particles = config.getBoolean("Elytra.Particles", true);
}
 
Example 15
Source File: Insulating.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%WHITE%");
	config.addDefault("MaxLevel", 4);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "IMI");
	config.addDefault("Recipe.Middle", "MDM");
	config.addDefault("Recipe.Bottom", "IMI");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("I", Material.IRON_BLOCK.name());
	recipeMaterials.put("M", Material.MAGMA_BLOCK.name());
	recipeMaterials.put("D", Material.DIAMOND.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.MAGMA_CREAM);
}
 
Example 16
Source File: Thorned.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GREEN%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "VAV");
	config.addDefault("Recipe.Middle", "ASA");
	config.addDefault("Recipe.Bottom", "VAV");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("V", Material.VINE.name());
	recipeMaterials.put("A", Material.ARROW.name());
	recipeMaterials.put("S", Material.SLIME_BALL.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.VINE);
}
 
Example 17
Source File: Aquaphilic.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%AQUA%");
	config.addDefault("MaxLevel", 3); //higher will have no effect on depth strider
	config.addDefault("SlotCost", 1);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "PNP");
	config.addDefault("Recipe.Middle", "NHN");
	config.addDefault("Recipe.Bottom", "PNP");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("H", Material.HEART_OF_THE_SEA.name());
	recipeMaterials.put("N", Material.NAUTILUS_SHELL.name());
	recipeMaterials.put("P", Material.PRISMARINE_SHARD.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.HEART_OF_THE_SEA);
}
 
Example 18
Source File: Reinforced.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GRAY%");
	config.addDefault("MaxLevel", 3);
	config.addDefault("SlotCost", 1);
	config.addDefault("ApplyUnbreakableOnMaxLevel", false);
	config.addDefault("HideUnbreakableFlag", true);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "IOI");
	config.addDefault("Recipe.Middle", "ODO");
	config.addDefault("Recipe.Bottom", "IOI");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("O", Material.OBSIDIAN.name());
	recipeMaterials.put("I", Material.IRON_INGOT.name());
	recipeMaterials.put("D", Material.DIAMOND.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	this.applyUnbreakableOnMaxLevel = config.getBoolean("ApplyUnbreakableOnMaxLevel", false);
	this.hideUnbreakableFlag = config.getBoolean("HideUnbreakableFlag", true);

	init(Material.OBSIDIAN);
}
 
Example 19
Source File: ExtraModifier.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%WHITE%");
	config.addDefault("ExtraModifierGain", 1); //How much Slots should be added per Nether-Star

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", "   ");
	config.addDefault("Recipe.Middle", " N ");
	config.addDefault("Recipe.Bottom", "   ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("N", Material.NETHER_STAR.name());

	config.addDefault("Recipe.Materials", recipeMaterials);
	config.addDefault("OverrideLanguagesystem", false);


	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.NETHER_STAR);

	this.slotCost = 0;

	this.gain = config.getInt("ExtraModifierGain", 1);
	this.description = this.description.replace("%amount", String.valueOf(this.gain));
}
 
Example 20
Source File: Withered.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void reload() {
	FileConfiguration config = getConfig();
	config.options().copyDefaults(true);

	config.addDefault("Allowed", true);
	config.addDefault("Color", "%DARK_GRAY%");
	config.addDefault("MaxLevel", 5);
	config.addDefault("SlotCost", 1);
	config.addDefault("Duration", 120); //ticks INTEGER (20 ticks ~ 1 sec)
	config.addDefault("DurationMultiplier", 1.1); //Duration * (Multiplier^Level) DOUBLE
	config.addDefault("EffectAmplifier", 2); //per Level (Level 1 = 0, Level 2 = 2, Level 3 = 4, ...) INTEGER
	config.addDefault("EffectHealsPlayer", true);

	config.addDefault("EnchantCost", 10);
	config.addDefault("Enchantable", false);

	config.addDefault("Recipe.Enabled", true);
	config.addDefault("Recipe.Top", " W ");
	config.addDefault("Recipe.Middle", "WNW");
	config.addDefault("Recipe.Bottom", " W ");

	Map<String, String> recipeMaterials = new HashMap<>();
	recipeMaterials.put("W", Material.WITHER_SKELETON_SKULL.name());
	recipeMaterials.put("N", Material.NETHER_STAR.name());

	config.addDefault("Recipe.Materials", recipeMaterials);

	ConfigurationManager.saveConfig(config);
	ConfigurationManager.loadConfig("Modifiers" + File.separator, getFileName());

	init(Material.WITHER_SKELETON_SKULL);

	this.duration = config.getInt("Duration", 120);
	this.durationMultiplier = config.getDouble("DurationMultiplier", 1.1);
	this.effectAmplifier = config.getInt("EffectAmplifier", 2);
	this.effectHealsPlayer = config.getBoolean("EffectHealsPlayer", true);

	this.description = this.description.replace("%duration", String.valueOf(this.duration))
			.replace("%multiplier", String.valueOf(this.durationMultiplier));
}