mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 11:14:44 +02:00
Second Smelt makes use of its own section in Bonus Drops in config.yml
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
@ -28,7 +28,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
/* GENERAL */
|
||||
if (getAbilityLength() < 1) {
|
||||
|
@ -28,10 +28,10 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
Set<String> oldKeys = new HashSet<String>(configKeys);
|
||||
Set<String> oldKeys = new HashSet<>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
Set<String> newKeys = new HashSet<String>(internalConfigKeys);
|
||||
Set<String> newKeys = new HashSet<>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
// Don't need a re-save if we have old keys sticking around?
|
||||
@ -66,17 +66,17 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
|
||||
LinkedHashMap<String, String> comments = new LinkedHashMap<String, String>();
|
||||
String temp = "";
|
||||
LinkedHashMap<String, String> comments = new LinkedHashMap<>();
|
||||
StringBuilder temp = new StringBuilder();
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp += line + "\n";
|
||||
temp.append(line).append("\n");
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if (!temp.isEmpty()) {
|
||||
if (temp.length() > 0) {
|
||||
if(comments.containsKey(line)) {
|
||||
int index = 0;
|
||||
while(comments.containsKey(line + index)) {
|
||||
@ -86,14 +86,14 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
line = line + index;
|
||||
}
|
||||
|
||||
comments.put(line, temp);
|
||||
temp = "";
|
||||
comments.put(line, temp.toString());
|
||||
temp = new StringBuilder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
HashMap<String, Integer> indexed = new HashMap<String, Integer>();
|
||||
HashMap<String, Integer> indexed = new HashMap<>();
|
||||
for (String key : comments.keySet()) {
|
||||
String actualkey = key.substring(0, key.indexOf(":") + 1);
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
/* General Settings */
|
||||
if (getSaveInterval() <= 0) {
|
||||
|
@ -31,7 +31,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* In the future this method will check keys for all skills, but for now it only checks overhauled skills
|
||||
|
@ -38,7 +38,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* FORMULA SETTINGS
|
||||
|
@ -15,12 +15,12 @@ import java.util.Set;
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customBoots = new ArrayList<Material>();
|
||||
public List<Material> customChestplates = new ArrayList<Material>();
|
||||
public List<Material> customHelmets = new ArrayList<Material>();
|
||||
public List<Material> customLeggings = new ArrayList<Material>();
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customChestplates = new ArrayList<>();
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
public List<Material> customLeggings = new ArrayList<>();
|
||||
|
||||
public List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
|
||||
protected CustomArmorConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CustomEntityConfig extends ConfigLoader {
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
|
||||
protected CustomEntityConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
|
@ -17,16 +17,16 @@ import java.util.Set;
|
||||
public class CustomToolConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customAxes = new ArrayList<Material>();
|
||||
public List<Material> customBows = new ArrayList<Material>();
|
||||
public List<Material> customHoes = new ArrayList<Material>();
|
||||
public List<Material> customPickaxes = new ArrayList<Material>();
|
||||
public List<Material> customShovels = new ArrayList<Material>();
|
||||
public List<Material> customSwords = new ArrayList<Material>();
|
||||
public List<Material> customAxes = new ArrayList<>();
|
||||
public List<Material> customBows = new ArrayList<>();
|
||||
public List<Material> customHoes = new ArrayList<>();
|
||||
public List<Material> customPickaxes = new ArrayList<>();
|
||||
public List<Material> customShovels = new ArrayList<>();
|
||||
public List<Material> customSwords = new ArrayList<>();
|
||||
|
||||
public HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
|
||||
public HashMap<Material, CustomTool> customToolMap = new HashMap<>();
|
||||
|
||||
public List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
|
||||
protected CustomToolConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
|
@ -27,7 +27,7 @@ public class ItemWeightConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
public HashSet<Material> getMiscItems() {
|
||||
HashSet<Material> miscItems = new HashSet<Material>();
|
||||
HashSet<Material> miscItems = new HashSet<>();
|
||||
|
||||
for (String item : config.getStringList("Party_Shareables.Misc_Items")) {
|
||||
Material material = Material.getMaterial(item.toUpperCase(Locale.ENGLISH));
|
||||
|
@ -18,16 +18,16 @@ import java.util.Map;
|
||||
public class PotionConfig extends ConfigLoader {
|
||||
private static PotionConfig instance;
|
||||
|
||||
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<ItemStack>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<>();
|
||||
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<>();
|
||||
|
||||
private final Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
|
||||
private final Map<String, AlchemyPotion> potionMap = new HashMap<>();
|
||||
|
||||
private PotionConfig() {
|
||||
super("potions.yml");
|
||||
@ -137,14 +137,14 @@ public class PotionConfig extends ConfigLoader {
|
||||
material = Material.valueOf(mat);
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (potion_section.contains("Lore")) {
|
||||
for (String line : potion_section.getStringList("Lore")) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||
}
|
||||
}
|
||||
|
||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||
List<PotionEffect> effects = new ArrayList<>();
|
||||
if (potion_section.contains("Effects")) {
|
||||
for (String effect : potion_section.getStringList("Effects")) {
|
||||
String[] parts = effect.split(" ");
|
||||
@ -162,7 +162,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
Color color = null;
|
||||
Color color;
|
||||
if (potion_section.contains("Color")) {
|
||||
color = Color.fromRGB(potion_section.getInt("Color"));
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
color = this.generateColor(effects);
|
||||
}
|
||||
|
||||
Map<ItemStack, String> children = new HashMap<ItemStack, String>();
|
||||
Map<ItemStack, String> children = new HashMap<>();
|
||||
if (potion_section.contains("Children")) {
|
||||
for (String child : potion_section.getConfigurationSection("Children").getKeys(false)) {
|
||||
ItemStack ingredient = loadIngredient(child);
|
||||
@ -255,7 +255,7 @@ public class PotionConfig extends ConfigLoader {
|
||||
|
||||
public Color generateColor(List<PotionEffect> effects) {
|
||||
if (effects != null && !effects.isEmpty()) {
|
||||
List<Color> colors = new ArrayList<Color>();
|
||||
List<Color> colors = new ArrayList<>();
|
||||
for (PotionEffect effect : effects) {
|
||||
if (effect.getType().getColor() != null) {
|
||||
colors.add(effect.getType().getColor());
|
||||
|
@ -25,7 +25,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
repairables = new ArrayList<Repairable>();
|
||||
repairables = new ArrayList<>();
|
||||
|
||||
if (!config.isConfigurationSection("Repairables")) {
|
||||
mcMMO.p.getLogger().severe("Could not find Repairables section in " + fileName);
|
||||
@ -42,7 +42,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
// Item Material
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
@ -177,7 +177,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
protected List<Repairable> getLoadedRepairables() {
|
||||
return repairables == null ? new ArrayList<Repairable>() : repairables;
|
||||
return repairables == null ? new ArrayList<>() : repairables;
|
||||
}
|
||||
|
||||
private boolean noErrorsInRepairable(List<String> issues) {
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RepairConfigManager {
|
||||
private final List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
private final List<Repairable> repairables = new ArrayList<>();
|
||||
|
||||
public RepairConfigManager(mcMMO plugin) {
|
||||
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");
|
||||
|
@ -28,7 +28,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
salvageables = new ArrayList<Salvageable>();
|
||||
salvageables = new ArrayList<>();
|
||||
|
||||
if (!config.isConfigurationSection("Salvageables")) {
|
||||
mcMMO.p.getLogger().severe("Could not find Salvageables section in " + fileName);
|
||||
@ -59,7 +59,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
|
||||
for (String key : keys) {
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
// Item Material
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
@ -195,7 +195,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
protected List<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables == null ? new ArrayList<Salvageable>() : salvageables;
|
||||
return salvageables == null ? new ArrayList<>() : salvageables;
|
||||
}
|
||||
|
||||
private boolean noErrorsInSalvageable(List<String> issues) {
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SalvageConfigManager {
|
||||
private final List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
||||
private final List<Salvageable> salvageables = new ArrayList<>();
|
||||
|
||||
public SalvageConfigManager(mcMMO plugin) {
|
||||
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||
|
@ -24,13 +24,13 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
private static TreasureConfig instance;
|
||||
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
|
||||
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
|
||||
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
|
||||
|
||||
private TreasureConfig() {
|
||||
super("treasures.yml");
|
||||
@ -49,7 +49,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) {
|
||||
double totalEnchantDropRate = 0;
|
||||
double totalItemDropRate = 0;
|
||||
@ -116,13 +116,13 @@ public class TreasureConfig extends ConfigLoader {
|
||||
// Initialize fishing HashMap
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (!fishingRewards.containsKey(rarity)) {
|
||||
fishingRewards.put(rarity, (new ArrayList<FishingTreasure>()));
|
||||
fishingRewards.put(rarity, (new ArrayList<>()));
|
||||
}
|
||||
}
|
||||
|
||||
for (String treasureName : treasureSection.getKeys(false)) {
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
||||
String[] treasureInfo = treasureName.split("[|]");
|
||||
String materialName = treasureInfo[0];
|
||||
@ -135,7 +135,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
if (materialName.contains("INVENTORY")) {
|
||||
// Use magic material BEDROCK to know that we're grabbing something from the inventory and not a normal treasure
|
||||
if (!shakeMap.containsKey(EntityType.PLAYER))
|
||||
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
|
||||
shakeMap.put(EntityType.PLAYER, new ArrayList<>());
|
||||
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BEDROCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
|
||||
continue;
|
||||
} else {
|
||||
@ -218,7 +218,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||
List<String> lore = new ArrayList<String>();
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
@ -237,7 +237,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<String>();
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
EntityType entityType = EntityType.valueOf(type.substring(6));
|
||||
if (!shakeMap.containsKey(entityType))
|
||||
shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
|
||||
shakeMap.put(entityType, new ArrayList<>());
|
||||
shakeMap.get(entityType).add(shakeTreasure);
|
||||
} else if (isExcavation) {
|
||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
@ -262,7 +262,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
for (String blockType : dropList) {
|
||||
if (!excavationMap.containsKey(blockType))
|
||||
excavationMap.put(blockType, new ArrayList<ExcavationTreasure>());
|
||||
excavationMap.put(blockType, new ArrayList<>());
|
||||
excavationMap.get(blockType).add(excavationTreasure);
|
||||
}
|
||||
} else if (isHylian) {
|
||||
@ -305,7 +305,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
if (!hylianMap.containsKey(dropper))
|
||||
hylianMap.put(dropper, new ArrayList<HylianTreasure>());
|
||||
hylianMap.put(dropper, new ArrayList<>());
|
||||
hylianMap.get(dropper).add(treasure);
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
if (!fishingEnchantments.containsKey(rarity)) {
|
||||
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
|
||||
fishingEnchantments.put(rarity, (new ArrayList<>()));
|
||||
}
|
||||
|
||||
ConfigurationSection enchantmentSection = config.getConfigurationSection("Enchantments_Rarity." + rarity.toString());
|
||||
|
Reference in New Issue
Block a user