mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-24 17:47:44 +01:00
new config system part 4
This commit is contained in:
parent
fd8e44ef47
commit
78f0a42ec1
@ -1,5 +0,0 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
public interface DefaultKeys {
|
||||
boolean validateKeys();
|
||||
}
|
@ -9,12 +9,11 @@ import net.md_5.bungee.api.ChatColor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public class AdvancedConfig extends ConfigLoaderConfigurable {
|
||||
private static AdvancedConfig instance;
|
||||
|
||||
private AdvancedConfig() {
|
||||
super("advanced.yml");
|
||||
validate();
|
||||
super(mcMMO.p.getDataFolder(), "advanced.yml");
|
||||
}
|
||||
|
||||
public static AdvancedConfig getInstance() {
|
||||
@ -26,7 +25,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
public List<String> validateKeys() {
|
||||
// Validate all the settings!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
@ -637,12 +636,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Kraken.Attack_Damage should be at least 1!");
|
||||
}
|
||||
|
||||
return noErrorsInConfig(reason);
|
||||
return reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
|
||||
/* GENERAL */
|
||||
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); }
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.DefaultKeys;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.io.Files;
|
||||
import ninja.leaping.configurate.ConfigurationNode;
|
||||
@ -10,6 +9,7 @@ import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles loading and cacheing configuration settings from a configurable compatible config file
|
||||
@ -66,7 +66,19 @@ public abstract class ConfigLoaderConfigurable implements DefaultKeys {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
validateKeys(); // Validate Keys
|
||||
/*
|
||||
* Print Errors about Keys
|
||||
*/
|
||||
|
||||
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
||||
|
||||
if(validKeyErrors.size() > 0)
|
||||
{
|
||||
for(String error : validKeyErrors)
|
||||
{
|
||||
mcMMO.p.getLogger().severe(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
7
src/main/java/com/gmail/nossr50/config/DefaultKeys.java
Normal file
7
src/main/java/com/gmail/nossr50/config/DefaultKeys.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DefaultKeys {
|
||||
List<String> validateKeys();
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Advanced configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# For advanced users only! There is no need to change anything here.
|
||||
#
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# mcMMO child skill configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# You do not need to modify this file except to change parents of child skills
|
||||
#
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# mcMMO configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
#####
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Experience configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# Configure the experience formula and experience settings here.
|
||||
#
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Settings for Concoctions
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
###
|
||||
Concoctions:
|
||||
Tier_One_Ingredients:
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Repair configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# Any file named repair.*.yml in the mcmmmo folder will be loaded as a repair config
|
||||
# All repair configs have a main section titled "Repairables"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Salvage configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# Any file named salvage.*.yml in the mcmmmo folder will be loaded as a salvage config
|
||||
# All salvage configs have a main section titled "Salvageables"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#
|
||||
# Settings for Fishing
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
###
|
||||
Fishing:
|
||||
LEATHER_BOOTS:
|
||||
|
Loading…
Reference in New Issue
Block a user