mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 00:26:45 +01:00
no more MultiConfigContainers, updating existing config classes for HOCON (WIP)
This commit is contained in:
parent
132b908eee
commit
55b1da0341
@ -115,6 +115,7 @@ Version 2.1.16
|
|||||||
Breaking Kelp should now count the whole plant for XP
|
Breaking Kelp should now count the whole plant for XP
|
||||||
Spawned Mobs that are not supposed to award XP will no longer reward XP once transformed (ie: drowned)
|
Spawned Mobs that are not supposed to award XP will no longer reward XP once transformed (ie: drowned)
|
||||||
mcMMO's config system has been rewritten
|
mcMMO's config system has been rewritten
|
||||||
|
Repair and Salvage configs are now confined to a single file
|
||||||
mcMMO will no longer shutdown if it finds invalid config entries
|
mcMMO will no longer shutdown if it finds invalid config entries
|
||||||
mcMMO will nag admins about invalid config entries when they join the server
|
mcMMO will nag admins about invalid config entries when they join the server
|
||||||
mcMMO's mod config system has been temporarily disabled as modded bukkit servers don't exist anymore (Forge Bukkit hybrid servers)
|
mcMMO's mod config system has been temporarily disabled as modded bukkit servers don't exist anymore (Forge Bukkit hybrid servers)
|
||||||
|
@ -4,11 +4,13 @@ import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class AdvancedConfig extends ConfigValidated {
|
public class AdvancedConfig extends ConfigValidated {
|
||||||
|
|
||||||
public static final String SKILLS = "Skills";
|
public static final String SKILLS = "Skills";
|
||||||
@ -125,7 +127,7 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
|
|
||||||
public AdvancedConfig() {
|
public AdvancedConfig() {
|
||||||
//super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true);
|
//super(mcMMO.getDataFolderPath().getAbsoluteFile(), "advanced.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "advanced.yml", true, true, true);
|
super("advanced", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,11 +5,14 @@ import com.google.common.io.Files;
|
|||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||||
|
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,11 +20,14 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public abstract class Config implements VersionedConfig, Unload {
|
public abstract class Config implements VersionedConfig, Unload {
|
||||||
|
|
||||||
|
public static final String HOCON_FILE_EXTENSION = ".conf";
|
||||||
/* SETTINGS */
|
/* SETTINGS */
|
||||||
//private static final String FILE_EXTENSION = ".conf"; //HOCON
|
//private static final String FILE_EXTENSION = ".conf"; //HOCON
|
||||||
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
|
private boolean mergeNewKeys; //Whether or not to merge keys found in the default config
|
||||||
private boolean removeOldKeys; //Whether or not to remove unused keys form the config
|
private boolean removeOldKeys; //Whether or not to remove unused keys form the config
|
||||||
private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
|
private boolean copyDefaults; //Whether or not to copy the default config when first creating the file
|
||||||
|
private boolean generateDefaults; //Whether or not we use Configurate to generate a default file, if this is false we copy the file from the JAR
|
||||||
|
private String fileName; //The file name of the config
|
||||||
|
|
||||||
/* PATH VARS */
|
/* PATH VARS */
|
||||||
|
|
||||||
@ -56,16 +62,18 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
System.out.println("mcMMO Debug: Don't forget to check if loading config file by string instead of File works...");
|
System.out.println("mcMMO Debug: Don't forget to check if loading config file by string instead of File works...");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public Config(File pathToParentFolder, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
public Config(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
/*
|
/*
|
||||||
* These must be at the top
|
* These must be at the top
|
||||||
*/
|
*/
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.generateDefaults = generateDefaults;
|
||||||
this.copyDefaults = copyDefaults;
|
this.copyDefaults = copyDefaults;
|
||||||
this.mergeNewKeys = mergeNewKeys; //Whether or not we add new keys when they are found
|
this.mergeNewKeys = mergeNewKeys; //Whether or not we add new keys when they are found
|
||||||
this.removeOldKeys = removeOldKeys;
|
this.removeOldKeys = removeOldKeys;
|
||||||
mkdirDefaults(); // Make our default config dir
|
mkdirDefaults(); // Make our default config dir
|
||||||
DIRECTORY_DATA_FOLDER = pathToParentFolder; //Data Folder for our plugin
|
DIRECTORY_DATA_FOLDER = pathToParentFolder; //Data Folder for our plugin
|
||||||
FILE_RELATIVE_PATH = relativePath; //Relative path to config from a parent folder
|
FILE_RELATIVE_PATH = relativePath + fileName + HOCON_FILE_EXTENSION; //Relative path to config from a parent folder
|
||||||
|
|
||||||
//Attempt IO Operations
|
//Attempt IO Operations
|
||||||
try {
|
try {
|
||||||
@ -151,9 +159,39 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
private File initDefaultConfig() throws IOException {
|
private File initDefaultConfig() throws IOException {
|
||||||
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
if(generateDefaults)
|
||||||
|
{
|
||||||
|
return generateDefaultFile();
|
||||||
|
} else
|
||||||
|
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a default config file using the Configurate library, makes use of @Setting and @ConfigSerializable annotations in the config file
|
||||||
|
* Assigns the default root node to the newly loaded default config if successful
|
||||||
|
* @return the File for the newly created config
|
||||||
|
*/
|
||||||
|
private File generateDefaultFile()
|
||||||
|
{
|
||||||
|
//Not sure if this will work properly...
|
||||||
|
Path potentialFile = Paths.get(getDefaultConfigCopyRelativePath());
|
||||||
|
ConfigurationLoader<CommentedConfigurationNode> generation_loader
|
||||||
|
= HoconConfigurationLoader.builder().setPath(potentialFile).build();
|
||||||
|
try {
|
||||||
|
defaultRootNode = generation_loader.load();
|
||||||
|
generation_loader.save(defaultRootNode);
|
||||||
|
mcMMO.p.getLogger().info("Generated a default file for "+fileName);
|
||||||
|
} catch(IOException e) {
|
||||||
|
mcMMO.p.getLogger().severe("Error when trying to generate a default configuration file for " + getDefaultConfigCopyRelativePath());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return the default file
|
||||||
|
return getDefaultConfigFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
|
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
|
||||||
* @return user config File
|
* @return user config File
|
||||||
@ -242,6 +280,15 @@ public abstract class Config implements VersionedConfig, Unload {
|
|||||||
return DIRECTORY_DEFAULTS + File.separator + FILE_RELATIVE_PATH;
|
return DIRECTORY_DEFAULTS + File.separator + FILE_RELATIVE_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs the File representation of the default config, which is stored on disk in a defaults folder
|
||||||
|
* this file will be overwritten every time mcMMO starts to keep it up to date.
|
||||||
|
* @return the copy of the default config file, stored in the defaults directory
|
||||||
|
*/
|
||||||
|
private File getDefaultConfigFile() {
|
||||||
|
return new File(DIRECTORY_DATA_FOLDER, DIRECTORY_DEFAULTS + File.separator + FILE_RELATIVE_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the defaults directory
|
* Creates the defaults directory
|
||||||
*/
|
*/
|
||||||
|
@ -13,14 +13,14 @@ public abstract class ConfigCollection<T> extends Config implements Registers, G
|
|||||||
protected Collection<T> genericCollection;
|
protected Collection<T> genericCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parentFolderPath Path to the "parent" folder on disk
|
* @param pathToParentFolder Path to the "parent" folder on disk
|
||||||
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
||||||
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
||||||
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
|
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
|
||||||
*/
|
*/
|
||||||
public ConfigCollection(String parentFolderPath, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
public ConfigCollection(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
||||||
super(parentFolderPath, relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
|
|
||||||
//init
|
//init
|
||||||
initCollection();
|
initCollection();
|
||||||
@ -29,23 +29,6 @@ public abstract class ConfigCollection<T> extends Config implements Registers, G
|
|||||||
//register();
|
//register();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param parentFolderPath Path to the "parent" folder on disk
|
|
||||||
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
|
||||||
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
|
||||||
* @param removeOldKeys if true, the users config file will have keys not found in the internal default resource file of the same name and path removed
|
|
||||||
*/
|
|
||||||
public ConfigCollection(File parentFolderPath, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
|
|
||||||
super(parentFolderPath, relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
|
||||||
|
|
||||||
//init
|
|
||||||
initCollection();
|
|
||||||
|
|
||||||
//load
|
|
||||||
//register();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the generic collection held by this class
|
* Initializes the generic collection held by this class
|
||||||
*/
|
*/
|
||||||
|
@ -11,10 +11,12 @@ public class ConfigConstants {
|
|||||||
/* FOLDER NAMES */
|
/* FOLDER NAMES */
|
||||||
public static final String FOLDER_NAME_CONFIG = "config";
|
public static final String FOLDER_NAME_CONFIG = "config";
|
||||||
public static final String FOLDER_NAME_SKILLS = "skills";
|
public static final String FOLDER_NAME_SKILLS = "skills";
|
||||||
|
public static final String FOLDER_NAME_EXPERIENCE = "Experience Settings";
|
||||||
|
|
||||||
/* RELATIVE PATHS */
|
/* RELATIVE PATHS */
|
||||||
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG;
|
public final static String RELATIVE_PATH_CONFIG_DIR = File.separator + FOLDER_NAME_CONFIG + File.separator;
|
||||||
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + File.separator + FOLDER_NAME_SKILLS;
|
public final static String RELATIVE_PATH_SKILLS_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_SKILLS + File.separator;
|
||||||
|
public final static String RELATIVE_PATH_XP_DIR = RELATIVE_PATH_CONFIG_DIR + FOLDER_NAME_EXPERIENCE + File.separator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the data folder for mcMMO
|
* Return the data folder for mcMMO
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.collectionconfigs.CollectionClassType;
|
import com.gmail.nossr50.config.collectionconfigs.RepairConfig;
|
||||||
import com.gmail.nossr50.config.collectionconfigs.MultiConfigContainer;
|
import com.gmail.nossr50.config.collectionconfigs.SalvageConfig;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.hocon.database.ConfigDatabase;
|
import com.gmail.nossr50.config.hocon.database.ConfigDatabase;
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
@ -24,12 +24,6 @@ import java.util.ArrayList;
|
|||||||
* This makes sure that mcMMO properly loads and unloads its values on reload
|
* This makes sure that mcMMO properly loads and unloads its values on reload
|
||||||
*
|
*
|
||||||
* Config Manager also holds all of our MultiConfigContainers
|
* Config Manager also holds all of our MultiConfigContainers
|
||||||
*
|
|
||||||
* MultiConfigContainers
|
|
||||||
* Represents a collection of config files that serve a similar purpose
|
|
||||||
* As an example, with Repair you can have an unlimited number of files named repair.*.yml and each one will be treated the same and have its collections registered
|
|
||||||
* The master file is always named x.vanilla.yml, for example "repair.vanilla.yml"
|
|
||||||
* To be honest I'm not sure how many people make use of this system, but I'm keeping it since its been in mcMMO for like 6+ years
|
|
||||||
*/
|
*/
|
||||||
public final class ConfigManager {
|
public final class ConfigManager {
|
||||||
|
|
||||||
@ -40,8 +34,8 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
/* MULTI CONFIG INSTANCES */
|
/* MULTI CONFIG INSTANCES */
|
||||||
|
|
||||||
private MultiConfigContainer<Repairable> repairableMultiConfigContainer;
|
//private MultiConfigContainer<Repairable> repairableMultiConfigContainer;
|
||||||
private MultiConfigContainer<Salvageable> salvageableMultiConfigContainer;
|
//private MultiConfigContainer<Salvageable> salvageableMultiConfigContainer;
|
||||||
|
|
||||||
/* COLLECTION MANAGERS */
|
/* COLLECTION MANAGERS */
|
||||||
|
|
||||||
@ -77,6 +71,8 @@ public final class ConfigManager {
|
|||||||
private SoundConfig soundConfig;
|
private SoundConfig soundConfig;
|
||||||
private RankConfig rankConfig;
|
private RankConfig rankConfig;
|
||||||
private ItemWeightConfig itemWeightConfig;
|
private ItemWeightConfig itemWeightConfig;
|
||||||
|
private RepairConfig repairConfig;
|
||||||
|
private SalvageConfig salvageConfig;
|
||||||
|
|
||||||
/* CONFIG ERRORS */
|
/* CONFIG ERRORS */
|
||||||
|
|
||||||
@ -116,6 +112,11 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
itemWeightConfig = new ItemWeightConfig();
|
itemWeightConfig = new ItemWeightConfig();
|
||||||
|
|
||||||
|
repairConfig = new RepairConfig();
|
||||||
|
|
||||||
|
salvageConfig = new SalvageConfig();
|
||||||
|
|
||||||
|
|
||||||
/*if (MainConfig.getInstance().getToolModsEnabled()) {
|
/*if (MainConfig.getInstance().getToolModsEnabled()) {
|
||||||
new ToolConfigManager();
|
new ToolConfigManager();
|
||||||
}
|
}
|
||||||
@ -133,7 +134,7 @@ public final class ConfigManager {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Multi Config Containers
|
// Multi Config Containers
|
||||||
initMultiConfigContainers();
|
//initMultiConfigContainers();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Managers
|
* Managers
|
||||||
@ -155,7 +156,7 @@ public final class ConfigManager {
|
|||||||
/**
|
/**
|
||||||
* Initializes all of our Multi Config Containers
|
* Initializes all of our Multi Config Containers
|
||||||
*/
|
*/
|
||||||
private void initMultiConfigContainers()
|
/*private void initMultiConfigContainers()
|
||||||
{
|
{
|
||||||
//Repair
|
//Repair
|
||||||
repairableMultiConfigContainer = new MultiConfigContainer<>("repair", CollectionClassType.REPAIR);
|
repairableMultiConfigContainer = new MultiConfigContainer<>("repair", CollectionClassType.REPAIR);
|
||||||
@ -164,7 +165,7 @@ public final class ConfigManager {
|
|||||||
//Salvage
|
//Salvage
|
||||||
salvageableMultiConfigContainer = new MultiConfigContainer<>("salvage", CollectionClassType.SALVAGE);
|
salvageableMultiConfigContainer = new MultiConfigContainer<>("salvage", CollectionClassType.SALVAGE);
|
||||||
unloadables.add(salvageableMultiConfigContainer);
|
unloadables.add(salvageableMultiConfigContainer);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes any managers related to config collections
|
* Initializes any managers related to config collections
|
||||||
@ -186,7 +187,7 @@ public final class ConfigManager {
|
|||||||
*/
|
*/
|
||||||
public ArrayList<Repairable> getRepairables()
|
public ArrayList<Repairable> getRepairables()
|
||||||
{
|
{
|
||||||
return (ArrayList<Repairable>) repairableMultiConfigContainer.getCollection();
|
return (ArrayList<Repairable>) repairConfig.genericCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -195,7 +196,7 @@ public final class ConfigManager {
|
|||||||
*/
|
*/
|
||||||
public ArrayList<Salvageable> getSalvageables()
|
public ArrayList<Salvageable> getSalvageables()
|
||||||
{
|
{
|
||||||
return (ArrayList<Salvageable>) salvageableMultiConfigContainer.getCollection();
|
return (ArrayList<Salvageable>) salvageConfig.genericCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,26 +8,14 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
public abstract class ConfigValidated extends Config implements UnsafeValueValidation {
|
||||||
/**
|
/**
|
||||||
* @param parentFolderPath Path to the "parent" folder on disk
|
* @param pathToParentFolder File for the "parent" folder on disk
|
||||||
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
||||||
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
||||||
*/
|
*/
|
||||||
public ConfigValidated(String parentFolderPath, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys)
|
public ConfigValidated(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys)
|
||||||
{
|
{
|
||||||
super(parentFolderPath, relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
|
||||||
validateEntries();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param parentFolderFile File for the "parent" folder on disk
|
|
||||||
* @param relativePath Path to the config relative to the "parent" folder, this should mirror internal structure of resource files
|
|
||||||
* @param mergeNewKeys if true, the users config will add keys found in the internal file that are missing from the users file during load
|
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
|
||||||
*/
|
|
||||||
public ConfigValidated(File parentFolderFile, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys)
|
|
||||||
{
|
|
||||||
super(parentFolderFile, relativePath, mergeNewKeys, copyDefaults, removeOldKeys);
|
|
||||||
validateEntries();
|
validateEntries();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,16 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class CoreSkillsConfig extends Config {
|
public class CoreSkillsConfig extends Config {
|
||||||
public static final String ENABLED = "Enabled";
|
public static final String ENABLED = "Enabled";
|
||||||
//private static CoreSkillsConfig instance;
|
//private static CoreSkillsConfig instance;
|
||||||
|
|
||||||
public CoreSkillsConfig() {
|
public CoreSkillsConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"coreskills.yml", true);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"coreskills.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(),"coreskills.yml", true, true, true);
|
super("coreskills", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -14,6 +15,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class MainConfig extends ConfigValidated {
|
public class MainConfig extends ConfigValidated {
|
||||||
|
|
||||||
public static final String METRICS = "Metrics";
|
public static final String METRICS = "Metrics";
|
||||||
@ -205,7 +207,7 @@ public class MainConfig extends ConfigValidated {
|
|||||||
|
|
||||||
public MainConfig() {
|
public MainConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "config.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "config.yml", true, true, true);
|
super("main", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,10 +3,12 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class RankConfig extends ConfigValidated {
|
public class RankConfig extends ConfigValidated {
|
||||||
public static final String RETRO_MODE = "RetroMode";
|
public static final String RETRO_MODE = "RetroMode";
|
||||||
public static final String STANDARD = "Standard";
|
public static final String STANDARD = "Standard";
|
||||||
@ -14,7 +16,7 @@ public class RankConfig extends ConfigValidated {
|
|||||||
|
|
||||||
public RankConfig() {
|
public RankConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"skillranks.yml", true);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"skillranks.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(),"skillranks.yml", true, true, true);
|
super("skillranks", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
//this.instance = this;
|
//this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@ package com.gmail.nossr50.config;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class SoundConfig extends ConfigValidated {
|
public class SoundConfig extends ConfigValidated {
|
||||||
public static final String SOUNDS = "Sounds";
|
public static final String SOUNDS = "Sounds";
|
||||||
public static final String VOLUME = "Volume";
|
public static final String VOLUME = "Volume";
|
||||||
@ -16,7 +18,7 @@ public class SoundConfig extends ConfigValidated {
|
|||||||
|
|
||||||
public SoundConfig() {
|
public SoundConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "sounds.yml", true);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "sounds.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "sounds.yml", true, true, true);
|
super("sounds", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/*
|
||||||
package com.gmail.nossr50.config.collectionconfigs;
|
package com.gmail.nossr50.config.collectionconfigs;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
@ -9,16 +10,22 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Represents a type of config collection, these config collections are spread across multiple config files potentially
|
* Represents a type of config collection, these config collections are spread across multiple config files potentially
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
public class MultiConfigContainer<T> implements Unload {
|
public class MultiConfigContainer<T> implements Unload {
|
||||||
|
|
||||||
/* CONSTANTS */
|
*/
|
||||||
|
/* CONSTANTS *//*
|
||||||
|
|
||||||
public static final String DEFAULT_MULTICONFIG_FILENAME_SUFFIX = ".vanilla.yml";
|
public static final String DEFAULT_MULTICONFIG_FILENAME_SUFFIX = ".vanilla.yml";
|
||||||
|
|
||||||
/* VARS */
|
*/
|
||||||
|
/* VARS *//*
|
||||||
|
|
||||||
private final String configPrefix;
|
private final String configPrefix;
|
||||||
private Collection<T> collection;
|
private Collection<T> collection;
|
||||||
public final CollectionClassType collectionClassType;
|
public final CollectionClassType collectionClassType;
|
||||||
@ -50,20 +57,24 @@ public class MultiConfigContainer<T> implements Unload {
|
|||||||
loadCustomCollections(configPrefix);
|
loadCustomCollections(configPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* Add another collection to this collection
|
* Add another collection to this collection
|
||||||
* @param otherCollection
|
* @param otherCollection
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
private void addCollection(Collection<T> otherCollection)
|
private void addCollection(Collection<T> otherCollection)
|
||||||
{
|
{
|
||||||
collection.addAll(otherCollection);
|
collection.addAll(otherCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* Grabs the Class to instance for this config collection
|
* Grabs the Class to instance for this config collection
|
||||||
* @param collectionClassType the type of class
|
* @param collectionClassType the type of class
|
||||||
* @return the class to instance for this config collection
|
* @return the class to instance for this config collection
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
private Class getConfigClass(CollectionClassType collectionClassType)
|
private Class getConfigClass(CollectionClassType collectionClassType)
|
||||||
{
|
{
|
||||||
switch(collectionClassType) {
|
switch(collectionClassType) {
|
||||||
@ -77,22 +88,26 @@ public class MultiConfigContainer<T> implements Unload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* Gets the name of the vanilla config which is always present
|
* Gets the name of the vanilla config which is always present
|
||||||
* @param configPrefix the prefix to the filename, for example "repair" or "salvage"
|
* @param configPrefix the prefix to the filename, for example "repair" or "salvage"
|
||||||
* @return the name of the vanilla config file for this collection
|
* @return the name of the vanilla config file for this collection
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
private String getVanillaConfigName(String configPrefix)
|
private String getVanillaConfigName(String configPrefix)
|
||||||
{
|
{
|
||||||
return configPrefix+DEFAULT_MULTICONFIG_FILENAME_SUFFIX;
|
return configPrefix+DEFAULT_MULTICONFIG_FILENAME_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* Initializes a config and attempts to load add its collection
|
* Initializes a config and attempts to load add its collection
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param merge
|
* @param merge
|
||||||
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
* @param copyDefaults if true, the users config file when it is first made will be a copy of an internal resource file of the same name and path
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
private void initConfigAndAddCollection(String fileName, boolean merge, boolean copyDefaults)
|
private void initConfigAndAddCollection(String fileName, boolean merge, boolean copyDefaults)
|
||||||
{
|
{
|
||||||
mcMMO.p.getLogger().info("Reading from collection config - "+fileName);
|
mcMMO.p.getLogger().info("Reading from collection config - "+fileName);
|
||||||
@ -105,7 +120,8 @@ public class MultiConfigContainer<T> implements Unload {
|
|||||||
configCollection = new SalvageConfig(fileName, merge, copyDefaults);
|
configCollection = new SalvageConfig(fileName, merge, copyDefaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*try {
|
*/
|
||||||
|
/*try {
|
||||||
//String parentFolderPath, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys
|
//String parentFolderPath, String relativePath, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys
|
||||||
//String fileName, boolean merge, boolean copyDefaults
|
//String fileName, boolean merge, boolean copyDefaults
|
||||||
configCollection = (ConfigCollection) getConfigClass(collectionClassType).getConstructor(String.class, Boolean.class, Boolean.class).newInstance(fileName, merge, copyDefaults);
|
configCollection = (ConfigCollection) getConfigClass(collectionClassType).getConstructor(String.class, Boolean.class, Boolean.class).newInstance(fileName, merge, copyDefaults);
|
||||||
@ -117,17 +133,20 @@ public class MultiConfigContainer<T> implements Unload {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
|
|
||||||
//Add the collection loaded from this config
|
//Add the collection loaded from this config
|
||||||
addCollection(configCollection.getLoadedCollection());
|
addCollection(configCollection.getLoadedCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
*/
|
||||||
|
/**
|
||||||
* mcMMO allows collection config files to be named things like repair.whatevernameyouwanthere.yml and so on,
|
* mcMMO allows collection config files to be named things like repair.whatevernameyouwanthere.yml and so on,
|
||||||
* these files are treated in the same way as the vanilla file. They serve the purpose of organization
|
* these files are treated in the same way as the vanilla file. They serve the purpose of organization
|
||||||
* @param configPrefix the prefix of the file name, for example "repair", "salvage", etc
|
* @param configPrefix the prefix of the file name, for example "repair", "salvage", etc
|
||||||
*/
|
*//*
|
||||||
|
|
||||||
public void loadCustomCollections(String configPrefix)
|
public void loadCustomCollections(String configPrefix)
|
||||||
{
|
{
|
||||||
String vanillaConfigFileName = getVanillaConfigName(configPrefix);
|
String vanillaConfigFileName = getVanillaConfigName(configPrefix);
|
||||||
@ -163,3 +182,4 @@ public class MultiConfigContainer<T> implements Unload {
|
|||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.collectionconfigs;
|
package com.gmail.nossr50.config.collectionconfigs;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -9,6 +10,7 @@ import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
|||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -18,6 +20,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* This config
|
* This config
|
||||||
*/
|
*/
|
||||||
|
@ConfigSerializable
|
||||||
public class RepairConfig extends ConfigCollection {
|
public class RepairConfig extends ConfigCollection {
|
||||||
|
|
||||||
public static final String REPAIRABLES = "Repairables";
|
public static final String REPAIRABLES = "Repairables";
|
||||||
@ -31,9 +34,9 @@ public class RepairConfig extends ConfigCollection {
|
|||||||
public static final String MINIMUM_LEVEL = "MinimumLevel";
|
public static final String MINIMUM_LEVEL = "MinimumLevel";
|
||||||
public static final String MINIMUM_QUANTITY = "MinimumQuantity";
|
public static final String MINIMUM_QUANTITY = "MinimumQuantity";
|
||||||
|
|
||||||
public RepairConfig(String fileName, boolean merge, boolean copyDefaults) {
|
public RepairConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), fileName, false);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), fileName, false);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), fileName, merge, copyDefaults, false);
|
super("repair", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_SKILLS_DIR, true, false, true, false);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.collectionconfigs;
|
package com.gmail.nossr50.config.collectionconfigs;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -9,12 +10,14 @@ import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
|||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class SalvageConfig extends ConfigCollection {
|
public class SalvageConfig extends ConfigCollection {
|
||||||
|
|
||||||
public static final String SALVAGEABLES = "Salvageables";
|
public static final String SALVAGEABLES = "Salvageables";
|
||||||
@ -27,9 +30,9 @@ public class SalvageConfig extends ConfigCollection {
|
|||||||
public static final String XP_MULTIPLIER = "XpMultiplier";
|
public static final String XP_MULTIPLIER = "XpMultiplier";
|
||||||
public static final String MAXIMUM_QUANTITY = "MaximumQuantity";
|
public static final String MAXIMUM_QUANTITY = "MaximumQuantity";
|
||||||
|
|
||||||
public SalvageConfig(String fileName, boolean merge, boolean copyDefaults) {
|
public SalvageConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), fileName, false);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), fileName, false);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), fileName, merge, copyDefaults, false);
|
super("salvage", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_SKILLS_DIR, true, false, true, false);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.config.experience;
|
package com.gmail.nossr50.config.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.config.ConfigValidated;
|
import com.gmail.nossr50.config.ConfigValidated;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
@ -7,6 +8,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
@ -15,6 +17,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
public class ExperienceConfig extends ConfigValidated {
|
public class ExperienceConfig extends ConfigValidated {
|
||||||
public static final String EXPLOIT_FIX = "ExploitFix";
|
public static final String EXPLOIT_FIX = "ExploitFix";
|
||||||
public static final String ENDERMAN_ENDERMITE_FARMS = "EndermanEndermiteFarms";
|
public static final String ENDERMAN_ENDERMITE_FARMS = "EndermanEndermiteFarms";
|
||||||
@ -79,7 +82,7 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
//TODO: Should merge be false? Seems okay to leave it as true..
|
//TODO: Should merge be false? Seems okay to leave it as true..
|
||||||
public ExperienceConfig() {
|
public ExperienceConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "experience.yml", true);
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "experience.yml", true);
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "experience.yml", true, true, false);
|
super("experience", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package com.gmail.nossr50.config.experience;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigValidated;
|
|
||||||
|
|
||||||
public class HerbalismExperienceConfig extends ConfigValidated {
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package com.gmail.nossr50.config.experience;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigValidated;
|
|
||||||
|
|
||||||
public class MiningExperienceConfig extends ConfigValidated {
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package com.gmail.nossr50.config.experience;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigValidated;
|
|
||||||
|
|
||||||
public class WoodcuttingExperienceConfig extends ConfigValidated {
|
|
||||||
|
|
||||||
}
|
|
@ -12,7 +12,8 @@ public class ConfigDatabase extends Config {
|
|||||||
private ConfigCategoryMySQL configCategoryMySQL;
|
private ConfigCategoryMySQL configCategoryMySQL;
|
||||||
|
|
||||||
public ConfigDatabase() {
|
public ConfigDatabase() {
|
||||||
super(ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true);
|
super("mysql", ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR,
|
||||||
|
true,true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
|
import com.gmail.nossr50.config.ConfigValidated;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class HerbalismExperienceConfig extends ConfigValidated {
|
||||||
|
|
||||||
|
public HerbalismExperienceConfig()
|
||||||
|
{
|
||||||
|
super("xp_herbalism", ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_XP_DIR, true, true, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> validateKeys() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
|
import com.gmail.nossr50.config.ConfigValidated;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class MiningExperienceConfig extends ConfigValidated {
|
||||||
|
|
||||||
|
public MiningExperienceConfig()
|
||||||
|
{
|
||||||
|
super("xp_mining", ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_XP_DIR, true, true, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> validateKeys() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
|
import com.gmail.nossr50.config.ConfigValidated;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class WoodcuttingExperienceConfig extends ConfigValidated {
|
||||||
|
|
||||||
|
public WoodcuttingExperienceConfig()
|
||||||
|
{
|
||||||
|
super("xp_woodcutting", ConfigConstants.getDataFolder(), ConfigConstants.RELATIVE_PATH_XP_DIR, true, true, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> validateKeys() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.party;
|
package com.gmail.nossr50.config.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
@ -16,7 +17,7 @@ public class ItemWeightConfig extends Config {
|
|||||||
|
|
||||||
public ItemWeightConfig() {
|
public ItemWeightConfig() {
|
||||||
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "itemweights.yml");
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "itemweights.yml");
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "itemweights.yml", true, true, false);
|
super("itemweights", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.gmail.nossr50.config.skills.alchemy;
|
package com.gmail.nossr50.config.skills.alchemy;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -23,6 +25,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Eventually I'm going to delete all of our Alchemy code and rewrite it from scratch
|
* Eventually I'm going to delete all of our Alchemy code and rewrite it from scratch
|
||||||
*/
|
*/
|
||||||
|
@ConfigSerializable
|
||||||
public class PotionConfig extends ConfigCollection {
|
public class PotionConfig extends ConfigCollection {
|
||||||
|
|
||||||
/* CONSTANTS */
|
/* CONSTANTS */
|
||||||
@ -63,7 +66,7 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
private Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
|
private Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
|
||||||
|
|
||||||
public PotionConfig() {
|
public PotionConfig() {
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "potions.yml", true, true, true);
|
super("skillranks", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
initIngredientLists();
|
initIngredientLists();
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
package com.gmail.nossr50.config.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.config.Registers;
|
import com.gmail.nossr50.config.Registers;
|
||||||
import com.gmail.nossr50.config.UnsafeValueValidation;
|
import com.gmail.nossr50.config.UnsafeValueValidation;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
@ -25,7 +26,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
|
|||||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
||||||
|
|
||||||
public ExcavationTreasureConfig() {
|
public ExcavationTreasureConfig() {
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "excavation_treasures.yml", false, true, false);
|
super("excavation_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
package com.gmail.nossr50.config.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.config.Registers;
|
import com.gmail.nossr50.config.Registers;
|
||||||
import com.gmail.nossr50.config.UnsafeValueValidation;
|
import com.gmail.nossr50.config.UnsafeValueValidation;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||||
@ -56,7 +57,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FishingTreasureConfig() {
|
public FishingTreasureConfig() {
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "fishing_treasures.yml", false, true, false);
|
super("fishing_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
package com.gmail.nossr50.config.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.config.ConfigConstants;
|
||||||
import com.gmail.nossr50.config.Registers;
|
import com.gmail.nossr50.config.Registers;
|
||||||
import com.gmail.nossr50.config.UnsafeValueValidation;
|
import com.gmail.nossr50.config.UnsafeValueValidation;
|
||||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||||
@ -28,7 +29,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
|
|||||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
||||||
|
|
||||||
public HerbalismTreasureConfig() {
|
public HerbalismTreasureConfig() {
|
||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "herbalism_treasures.yml", false, true, false);
|
super("hylian_luck_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user