Huge changes to how config files are loaded/updated, fixes many issues

Fixes #4715
This commit is contained in:
nossr50
2022-01-10 22:29:22 -08:00
parent dd4a5a6b9a
commit c21a040ddb
34 changed files with 1644 additions and 736 deletions

View File

@@ -14,14 +14,12 @@ import java.util.List;
import java.util.Set;
public class CustomArmorConfig extends ConfigLoader {
private boolean needsUpdate = false;
public List<Material> customBoots = new ArrayList<>();
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<Material> customHelmets = new ArrayList<>();
public List<Material> customLeggings = new ArrayList<>();
public List<Repairable> repairables = new ArrayList<>();
private boolean needsUpdate = false;
protected CustomArmorConfig(String fileName) {
super("mods", fileName);

View File

@@ -12,17 +12,15 @@ import java.util.List;
import java.util.Set;
public class CustomBlockConfig extends ConfigLoader {
private boolean needsUpdate = false;
public List<Material> customExcavationBlocks = new ArrayList<>();
public List<Material> customHerbalismBlocks = new ArrayList<>();
public List<Material> customMiningBlocks = new ArrayList<>();
public List<Material> customOres = new ArrayList<>();
public List<Material> customLogs = new ArrayList<>();
public List<Material> customLeaves = new ArrayList<>();
public List<Material> customAbilityBlocks = new ArrayList<>();
public List<Material> customExcavationBlocks = new ArrayList<>();
public List<Material> customHerbalismBlocks = new ArrayList<>();
public List<Material> customMiningBlocks = new ArrayList<>();
public List<Material> customOres = new ArrayList<>();
public List<Material> customLogs = new ArrayList<>();
public List<Material> customLeaves = new ArrayList<>();
public List<Material> customAbilityBlocks = new ArrayList<>();
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
private boolean needsUpdate = false;
protected CustomBlockConfig(String fileName) {
super("mods", fileName);
@@ -85,12 +83,10 @@ public class CustomBlockConfig extends ConfigLoader {
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
customOres.add(blockMaterial);
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
}
else if (skillType.equals("Woodcutting")) {
} else if (skillType.equals("Woodcutting")) {
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
customLogs.add(blockMaterial);
}
else {
} else {
customLeaves.add(blockMaterial);
xp = 0; // Leaves don't grant XP
}

View File

@@ -11,7 +11,7 @@ import java.util.HashMap;
public class CustomEntityConfig extends ConfigLoader {
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
protected CustomEntityConfig(String fileName) {
super("mods", fileName);
@@ -31,8 +31,7 @@ public class CustomEntityConfig extends ConfigLoader {
try {
clazz = ClassUtils.getClass(className);
}
catch (ClassNotFoundException e) {
} catch (ClassNotFoundException e) {
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
mcMMO.p.getLogger().warning("This custom entity may not function properly.");
}

View File

@@ -16,18 +16,15 @@ import java.util.List;
import java.util.Set;
public class CustomToolConfig extends ConfigLoader {
private boolean needsUpdate = false;
public List<Material> customAxes = new ArrayList<>();
public List<Material> customBows = new ArrayList<>();
public List<Material> customHoes = new ArrayList<>();
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 List<Material> customShovels = new ArrayList<>();
public List<Material> customSwords = new ArrayList<>();
public HashMap<Material, CustomTool> customToolMap = new HashMap<>();
public List<Repairable> repairables = new ArrayList<>();
private boolean needsUpdate = false;
protected CustomToolConfig(String fileName) {
super("mods", fileName);