2019-02-17 11:32:53 -08:00
|
|
|
package com.gmail.nossr50.config;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
2019-03-08 19:40:01 -08:00
|
|
|
import com.gmail.nossr50.config.collectionconfigs.RepairConfig;
|
|
|
|
import com.gmail.nossr50.config.collectionconfigs.SalvageConfig;
|
2019-02-18 09:08:16 -08:00
|
|
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
2019-03-17 04:12:56 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.CustomEnumValueSerializer;
|
2019-03-12 04:21:46 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.SerializedConfigLoader;
|
2019-03-17 04:12:56 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.admin.ConfigAdmin;
|
2019-03-14 17:34:13 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.antiexploit.ConfigExploitPrevention;
|
2019-03-14 20:30:20 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.backup.ConfigAutomatedBackups;
|
|
|
|
import com.gmail.nossr50.config.hocon.commands.ConfigCommands;
|
2019-03-08 17:54:23 -08:00
|
|
|
import com.gmail.nossr50.config.hocon.database.ConfigDatabase;
|
2019-03-14 20:06:26 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.donation.ConfigAuthorAdvertisements;
|
|
|
|
import com.gmail.nossr50.config.hocon.hardcore.ConfigHardcore;
|
2019-03-14 20:30:20 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.items.ConfigItems;
|
|
|
|
import com.gmail.nossr50.config.hocon.language.ConfigLanguage;
|
2019-03-14 20:06:26 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.metrics.ConfigMetrics;
|
2019-03-19 08:56:48 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.mobs.ConfigMobs;
|
2019-03-14 18:14:08 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.motd.ConfigMOTD;
|
2019-03-14 20:30:20 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.notifications.ConfigNotifications;
|
|
|
|
import com.gmail.nossr50.config.hocon.particles.ConfigParticles;
|
|
|
|
import com.gmail.nossr50.config.hocon.party.ConfigParty;
|
2019-03-18 07:43:11 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.party.data.ConfigPartyData;
|
2019-03-13 18:09:33 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.playerleveling.ConfigLeveling;
|
2019-03-13 09:42:57 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
|
2019-03-20 15:53:12 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.skills.acrobatics.ConfigAcrobatics;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.alchemy.ConfigAlchemy;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.archery.ConfigArchery;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.axes.ConfigAxes;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.excavation.ConfigExcavation;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.fishing.ConfigFishing;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.herbalism.ConfigHerbalism;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.mining.ConfigMining;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.repair.ConfigRepair;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.salvage.ConfigSalvage;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.smelting.ConfigSmelting;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.swords.ConfigSwords;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.taming.ConfigTaming;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.unarmed.ConfigUnarmed;
|
|
|
|
import com.gmail.nossr50.config.hocon.skills.woodcutting.ConfigWoodcutting;
|
2019-03-14 20:30:20 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.superabilities.ConfigSuperAbilities;
|
2019-03-13 18:34:40 -07:00
|
|
|
import com.gmail.nossr50.config.hocon.worldblacklist.ConfigWorldBlacklist;
|
2019-02-17 08:59:09 -08:00
|
|
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
2019-02-21 19:06:59 -08:00
|
|
|
import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig;
|
|
|
|
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
|
|
|
import com.gmail.nossr50.config.treasure.HerbalismTreasureConfig;
|
2019-03-17 04:12:56 -07:00
|
|
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
2019-03-21 20:16:16 -07:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
2019-03-17 04:12:56 -07:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2019-02-17 08:59:09 -08:00
|
|
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
2019-03-21 23:54:55 -07:00
|
|
|
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
2019-02-17 08:59:09 -08:00
|
|
|
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
|
|
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
|
|
|
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
2019-03-06 16:50:38 -08:00
|
|
|
import com.gmail.nossr50.util.experience.ExperienceMapManager;
|
2019-03-17 04:12:56 -07:00
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
|
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
|
|
|
|
import org.bukkit.Material;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
2019-02-21 19:06:59 -08:00
|
|
|
import java.io.File;
|
2019-02-17 08:59:09 -08:00
|
|
|
import java.util.ArrayList;
|
2019-03-17 04:12:56 -07:00
|
|
|
import java.util.HashMap;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* The Config Manager handles initializing, loading, and unloading registers for all configs that mcMMO uses
|
|
|
|
* This makes sure that mcMMO properly loads and unloads its values on reload
|
|
|
|
*
|
|
|
|
* Config Manager also holds all of our MultiConfigContainers
|
|
|
|
*/
|
|
|
|
public final class ConfigManager {
|
|
|
|
|
2019-03-20 14:26:30 -07:00
|
|
|
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
/* UNLOAD REGISTER */
|
|
|
|
|
|
|
|
private ArrayList<Unload> unloadables;
|
2019-02-21 19:06:59 -08:00
|
|
|
private ArrayList<File> userFiles;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
|
|
|
/* MULTI CONFIG INSTANCES */
|
|
|
|
|
2019-03-08 19:40:01 -08:00
|
|
|
//private MultiConfigContainer<Repairable> repairableMultiConfigContainer;
|
|
|
|
//private MultiConfigContainer<Salvageable> salvageableMultiConfigContainer;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
|
|
|
/* COLLECTION MANAGERS */
|
|
|
|
|
|
|
|
private SimpleRepairableManager simpleRepairableManager;
|
|
|
|
private SimpleSalvageableManager simpleSalvageableManager;
|
|
|
|
|
2019-02-18 12:16:10 -08:00
|
|
|
/* MOD MANAGERS */
|
|
|
|
|
|
|
|
//TODO: Add these back when modded servers become a thing again
|
|
|
|
|
2019-03-06 16:50:38 -08:00
|
|
|
/* MISC MANAGERS */
|
|
|
|
|
2019-03-21 20:16:16 -07:00
|
|
|
SkillPropertiesManager skillPropertiesManager;
|
|
|
|
|
2019-03-06 16:50:38 -08:00
|
|
|
private ExperienceMapManager experienceMapManager;
|
|
|
|
|
2019-02-18 12:31:31 -08:00
|
|
|
//private ModManager modManager;
|
2019-02-18 12:16:10 -08:00
|
|
|
|
|
|
|
/*private ToolConfigManager toolConfigManager;
|
|
|
|
private ArmorConfigManager armorConfigManager;
|
|
|
|
private BlockConfigManager blockConfigManager;
|
|
|
|
private EntityConfigManager entityConfigManager;*/
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
/* CONFIG INSTANCES */
|
|
|
|
|
2019-03-12 04:21:46 -07:00
|
|
|
private SerializedConfigLoader<ConfigDatabase> configDatabase;
|
2019-03-13 09:42:57 -07:00
|
|
|
private SerializedConfigLoader<ConfigScoreboard> configScoreboard;
|
2019-03-13 13:09:27 -07:00
|
|
|
private SerializedConfigLoader<ConfigLeveling> configLeveling;
|
2019-03-13 18:34:40 -07:00
|
|
|
private SerializedConfigLoader<ConfigWorldBlacklist> configWorldBlacklist;
|
2019-03-14 17:34:13 -07:00
|
|
|
private SerializedConfigLoader<ConfigExploitPrevention> configExploitPrevention;
|
2019-03-14 20:06:26 -07:00
|
|
|
private SerializedConfigLoader<ConfigHardcore> configHardcore;
|
|
|
|
private SerializedConfigLoader<ConfigMetrics> configMetrics;
|
2019-03-14 18:14:08 -07:00
|
|
|
private SerializedConfigLoader<ConfigMOTD> configMOTD;
|
2019-03-14 20:06:26 -07:00
|
|
|
private SerializedConfigLoader<ConfigAuthorAdvertisements> configAuthorAdvertisements;
|
2019-03-14 20:30:20 -07:00
|
|
|
private SerializedConfigLoader<ConfigAutomatedBackups> configAutomatedBackups;
|
|
|
|
private SerializedConfigLoader<ConfigCommands> configCommands;
|
|
|
|
private SerializedConfigLoader<ConfigItems> configItems;
|
|
|
|
private SerializedConfigLoader<ConfigLanguage> configLanguage;
|
|
|
|
private SerializedConfigLoader<ConfigParticles> configParticles;
|
|
|
|
private SerializedConfigLoader<ConfigParty> configParty;
|
|
|
|
private SerializedConfigLoader<ConfigNotifications> configNotifications;
|
|
|
|
private SerializedConfigLoader<ConfigSuperAbilities> configSuperAbilities;
|
2019-03-17 04:12:56 -07:00
|
|
|
private SerializedConfigLoader<ConfigAdmin> configAdmin;
|
2019-03-19 08:56:48 -07:00
|
|
|
private SerializedConfigLoader<ConfigMobs> configMobs;
|
2019-03-14 20:30:20 -07:00
|
|
|
|
2019-03-20 15:53:12 -07:00
|
|
|
private SerializedConfigLoader<ConfigAcrobatics> configAcrobatics;
|
|
|
|
private SerializedConfigLoader<ConfigAlchemy> configAlchemy;
|
|
|
|
private SerializedConfigLoader<ConfigArchery> configArchery;
|
|
|
|
private SerializedConfigLoader<ConfigAxes> configAxes;
|
|
|
|
private SerializedConfigLoader<ConfigExcavation> configExcavation;
|
|
|
|
private SerializedConfigLoader<ConfigFishing> configFishing;
|
|
|
|
private SerializedConfigLoader<ConfigHerbalism> configHerbalism;
|
|
|
|
private SerializedConfigLoader<ConfigMining> configMining;
|
|
|
|
private SerializedConfigLoader<ConfigRepair> configRepair;
|
|
|
|
private SerializedConfigLoader<ConfigSwords> configSwords;
|
|
|
|
private SerializedConfigLoader<ConfigTaming> configTaming;
|
|
|
|
private SerializedConfigLoader<ConfigUnarmed> configUnarmed;
|
|
|
|
private SerializedConfigLoader<ConfigWoodcutting> configWoodcutting;
|
|
|
|
private SerializedConfigLoader<ConfigSmelting> configSmelting;
|
|
|
|
private SerializedConfigLoader<ConfigSalvage> configSalvage;
|
|
|
|
|
2019-03-18 07:43:11 -07:00
|
|
|
//Data
|
|
|
|
private SerializedConfigLoader<ConfigPartyData> partyData;
|
|
|
|
|
2019-02-17 11:32:53 -08:00
|
|
|
private MainConfig mainConfig;
|
2019-02-21 19:06:59 -08:00
|
|
|
private FishingTreasureConfig fishingTreasureConfig;
|
|
|
|
private ExcavationTreasureConfig excavationTreasureConfig;
|
|
|
|
private HerbalismTreasureConfig herbalismTreasureConfig;
|
2019-02-18 09:08:16 -08:00
|
|
|
private ExperienceConfig experienceConfig;
|
2019-02-17 08:59:09 -08:00
|
|
|
private AdvancedConfig advancedConfig;
|
|
|
|
private PotionConfig potionConfig;
|
|
|
|
private CoreSkillsConfig coreSkillsConfig;
|
|
|
|
private SoundConfig soundConfig;
|
|
|
|
private RankConfig rankConfig;
|
2019-03-21 23:54:55 -07:00
|
|
|
// private RepairConfig repairConfig;
|
2019-03-08 19:40:01 -08:00
|
|
|
private SalvageConfig salvageConfig;
|
2019-02-17 08:59:09 -08:00
|
|
|
|
2019-03-20 11:03:09 -07:00
|
|
|
private HashMap<Material, Integer> partyItemWeights;
|
|
|
|
private HashMap<PartyFeature, Integer> partyFeatureUnlocks;
|
2019-03-17 04:12:56 -07:00
|
|
|
|
2019-02-18 09:04:20 -08:00
|
|
|
/* CONFIG ERRORS */
|
|
|
|
|
|
|
|
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
public ConfigManager()
|
|
|
|
{
|
|
|
|
unloadables = new ArrayList<>();
|
2019-02-21 19:06:59 -08:00
|
|
|
userFiles = new ArrayList<>();
|
2019-02-26 11:26:06 -08:00
|
|
|
}
|
2019-02-17 08:59:09 -08:00
|
|
|
|
2019-02-26 11:26:06 -08:00
|
|
|
public void loadConfigs()
|
|
|
|
{
|
2019-02-17 08:59:09 -08:00
|
|
|
// Load Config Files
|
|
|
|
// I'm pretty these are supposed to be done in a specific order, so don't rearrange them willy nilly
|
2019-02-17 11:32:53 -08:00
|
|
|
|
2019-03-17 04:12:56 -07:00
|
|
|
//Register Custom Serializers
|
|
|
|
mcMMO.p.getLogger().info("Registering custom type serializers with Configurate...");
|
2019-03-20 11:03:09 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
TypeTokens are obtained in two ways
|
|
|
|
|
|
|
|
For Raw basic classes:
|
|
|
|
|
|
|
|
TypeToken<String> stringTok = TypeToken.of(String.class);
|
|
|
|
TypeToken<Integer> intTok = TypeToken.of(Integer.class);
|
|
|
|
|
|
|
|
For Generics:
|
|
|
|
|
|
|
|
TypeToken<List<String>> stringListTok = new TypeToken<List<String>>() {};
|
|
|
|
|
|
|
|
Wildcard example:
|
|
|
|
|
|
|
|
TypeToken<Map<?, ?>> wildMapTok = new TypeToken<Map<?, ?>>() {};
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2019-03-20 14:26:30 -07:00
|
|
|
/*
|
|
|
|
List of default serializers for reference
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(URI.class), new URISerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(URL.class), new URLSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(UUID.class), new UUIDSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerPredicate(input -> input.getRawType().isAnnotationPresent(ConfigSerializable.class), new AnnotatedObjectSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerPredicate(NumberSerializer.getPredicate(), new NumberSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(String.class), new StringSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(Boolean.class), new BooleanSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(new TypeToken<Map<?, ?>>() {}, new MapSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(new TypeToken<List<?>>() {}, new ListSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(new TypeToken<Enum<?>>() {}, new EnumValueSerializer());
|
|
|
|
DEFAULT_SERIALIZERS.registerType(TypeToken.of(Pattern.class), new PatternSerializer());
|
|
|
|
*/
|
|
|
|
|
2019-03-20 11:03:09 -07:00
|
|
|
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
|
|
|
|
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
|
2019-03-17 04:12:56 -07:00
|
|
|
|
|
|
|
mcMMO.p.getLogger().info("Deserializing configs...");
|
2019-02-17 11:32:53 -08:00
|
|
|
//TODO: Not sure about the order of MainConfig
|
2019-03-13 09:42:57 -07:00
|
|
|
//Serialized Configs
|
2019-03-21 17:31:57 -07:00
|
|
|
configDatabase = new SerializedConfigLoader<>(ConfigDatabase.class, "database_settings.conf", "Database", null);
|
|
|
|
configScoreboard = new SerializedConfigLoader<>(ConfigScoreboard.class, "scoreboard.conf", "Scoreboard", null);
|
|
|
|
configLeveling = new SerializedConfigLoader<>(ConfigLeveling.class, "player_leveling.conf", "Player-Leveling", null);
|
|
|
|
configWorldBlacklist = new SerializedConfigLoader<>(ConfigWorldBlacklist.class, "world_blacklist.conf", "World-Blacklist", null);
|
|
|
|
configExploitPrevention = new SerializedConfigLoader<>(ConfigExploitPrevention.class, "anti_exploit.conf", "Anti-Exploit", null);
|
|
|
|
configMOTD = new SerializedConfigLoader<>(ConfigMOTD.class, "message_of_the_day.conf", "MOTD", null);
|
|
|
|
configHardcore = new SerializedConfigLoader<>(ConfigHardcore.class, "hardcore_mode.conf", "Hardcore-Mode", null);
|
|
|
|
configMetrics = new SerializedConfigLoader<>(ConfigMetrics.class, "analytics_reporting.conf", "Analytic-Reporting", null);
|
|
|
|
configAuthorAdvertisements = new SerializedConfigLoader<>(ConfigAuthorAdvertisements.class, "author_support_advertisements.conf", "mcMMO", null);
|
|
|
|
configAutomatedBackups = new SerializedConfigLoader<>(ConfigAutomatedBackups.class, "automated_backups.conf", "Automated-Backups", null);
|
|
|
|
configCommands = new SerializedConfigLoader<>(ConfigCommands.class, "commands.conf", "Commands", null);
|
|
|
|
configItems = new SerializedConfigLoader<>(ConfigItems.class, "custom_items.conf", "Items", null);
|
|
|
|
configLanguage = new SerializedConfigLoader<>(ConfigLanguage.class, "language.conf", "Language", null);
|
|
|
|
configParticles = new SerializedConfigLoader<>(ConfigParticles.class, "particle_spawning.conf", "Particles", null);
|
|
|
|
configParty = new SerializedConfigLoader<>(ConfigParty.class, "party.conf", "Party", null);
|
|
|
|
configNotifications = new SerializedConfigLoader<>(ConfigNotifications.class, "alerts_and_notifications.conf", "Notifications", null);
|
|
|
|
configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", "Super-Abilities", null);
|
|
|
|
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", "Admin", null);
|
|
|
|
configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null);
|
|
|
|
|
|
|
|
configAcrobatics = new SerializedConfigLoader<>(ConfigAcrobatics.class, "acrobatics.conf", "Acrobatics", null);
|
|
|
|
configSalvage = new SerializedConfigLoader<>(ConfigSalvage.class, "salvage.conf", "Salvage", null);
|
|
|
|
configArchery = new SerializedConfigLoader<>(ConfigArchery.class, "archery.conf", "Archery", null);
|
|
|
|
configAxes = new SerializedConfigLoader<>(ConfigAxes.class, "axes.conf", "Axes", null);
|
|
|
|
configExcavation = new SerializedConfigLoader<>(ConfigExcavation.class, "excavation.conf", "Excavation", null);
|
|
|
|
configFishing = new SerializedConfigLoader<>(ConfigFishing.class, "fishing.conf", "Fishing", null);
|
|
|
|
configHerbalism = new SerializedConfigLoader<>(ConfigHerbalism.class, "herbalism.conf", "Herbalism", null);
|
|
|
|
configMining = new SerializedConfigLoader<>(ConfigMining.class, "mining.conf", "Mining", null);
|
|
|
|
configRepair = new SerializedConfigLoader<>(ConfigRepair.class, "repair.conf", "Repair", null);
|
|
|
|
configSwords = new SerializedConfigLoader<>(ConfigSwords.class, "swords.conf", "Swords", null);
|
|
|
|
configTaming = new SerializedConfigLoader<>(ConfigTaming.class, "taming.conf", "Taming", null);
|
|
|
|
configUnarmed = new SerializedConfigLoader<>(ConfigUnarmed.class, "unarmed.conf", "Unarmed", null);
|
|
|
|
configWoodcutting = new SerializedConfigLoader<>(ConfigWoodcutting.class, "woodcutting.conf", "Woodcutting", null);
|
|
|
|
configSmelting = new SerializedConfigLoader<>(ConfigSmelting.class, "smelting.conf", "Smelting", null);
|
2019-03-20 15:53:12 -07:00
|
|
|
|
2019-03-18 07:43:11 -07:00
|
|
|
//Serialized Data
|
2019-03-21 17:31:57 -07:00
|
|
|
partyData = new SerializedConfigLoader<>(ConfigPartyData.class, "partydata.conf", "PartyData", null);
|
2019-03-18 07:43:11 -07:00
|
|
|
|
2019-03-21 20:16:16 -07:00
|
|
|
skillPropertiesManager = new SkillPropertiesManager();
|
|
|
|
skillPropertiesManager.fillRegisters();
|
|
|
|
|
2019-03-17 04:12:56 -07:00
|
|
|
//Assign Maps
|
|
|
|
partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights
|
|
|
|
partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression
|
2019-03-13 09:42:57 -07:00
|
|
|
|
2019-03-17 04:12:56 -07:00
|
|
|
//YAML Configs
|
2019-02-17 11:32:53 -08:00
|
|
|
mainConfig = new MainConfig();
|
|
|
|
|
2019-02-21 19:06:59 -08:00
|
|
|
fishingTreasureConfig = new FishingTreasureConfig();
|
|
|
|
excavationTreasureConfig = new ExcavationTreasureConfig();
|
|
|
|
herbalismTreasureConfig = new HerbalismTreasureConfig();
|
2019-02-17 08:59:09 -08:00
|
|
|
|
|
|
|
advancedConfig = new AdvancedConfig();
|
|
|
|
|
2019-02-18 09:08:16 -08:00
|
|
|
//TODO: Not sure about the order of experience config
|
|
|
|
experienceConfig = new ExperienceConfig();
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
potionConfig = new PotionConfig();
|
|
|
|
|
|
|
|
coreSkillsConfig = new CoreSkillsConfig();
|
|
|
|
|
|
|
|
soundConfig = new SoundConfig();
|
|
|
|
|
|
|
|
rankConfig = new RankConfig();
|
|
|
|
|
2019-03-21 23:54:55 -07:00
|
|
|
// repairConfig = new RepairConfig();
|
2019-03-08 19:40:01 -08:00
|
|
|
|
|
|
|
salvageConfig = new SalvageConfig();
|
|
|
|
|
2019-03-06 16:50:38 -08:00
|
|
|
/*
|
|
|
|
* Managers
|
|
|
|
*/
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
// Register Managers
|
2019-03-06 16:50:38 -08:00
|
|
|
initMiscManagers();
|
2019-02-17 08:59:09 -08:00
|
|
|
initCollectionManagers();
|
|
|
|
}
|
|
|
|
|
2019-03-06 16:50:38 -08:00
|
|
|
/**
|
|
|
|
* Misc managers
|
|
|
|
*/
|
|
|
|
private void initMiscManagers()
|
|
|
|
{
|
|
|
|
experienceMapManager = new ExperienceMapManager();
|
|
|
|
}
|
|
|
|
|
2019-02-17 08:59:09 -08:00
|
|
|
/**
|
|
|
|
* Initializes all of our Multi Config Containers
|
|
|
|
*/
|
2019-03-08 19:40:01 -08:00
|
|
|
/*private void initMultiConfigContainers()
|
2019-02-17 08:59:09 -08:00
|
|
|
{
|
|
|
|
//Repair
|
|
|
|
repairableMultiConfigContainer = new MultiConfigContainer<>("repair", CollectionClassType.REPAIR);
|
|
|
|
unloadables.add(repairableMultiConfigContainer);
|
|
|
|
|
|
|
|
//Salvage
|
|
|
|
salvageableMultiConfigContainer = new MultiConfigContainer<>("salvage", CollectionClassType.SALVAGE);
|
|
|
|
unloadables.add(salvageableMultiConfigContainer);
|
2019-03-08 19:40:01 -08:00
|
|
|
}*/
|
2019-02-17 08:59:09 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes any managers related to config collections
|
|
|
|
*/
|
|
|
|
private void initCollectionManagers()
|
|
|
|
{
|
|
|
|
// Handles registration of repairables
|
|
|
|
simpleRepairableManager = new SimpleRepairableManager(getRepairables());
|
|
|
|
unloadables.add(simpleRepairableManager);
|
|
|
|
|
|
|
|
// Handles registration of salvageables
|
|
|
|
simpleSalvageableManager = new SimpleSalvageableManager(getSalvageables());
|
|
|
|
unloadables.add(simpleSalvageableManager);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all loaded repairables (loaded from all repairable configs)
|
|
|
|
* @return the currently loaded repairables
|
|
|
|
*/
|
2019-03-21 23:54:55 -07:00
|
|
|
public ArrayList<SimpleRepairable> getRepairables()
|
2019-02-17 08:59:09 -08:00
|
|
|
{
|
2019-03-21 23:54:55 -07:00
|
|
|
return getConfigRepair().getConfigRepairablesList();
|
2019-02-17 08:59:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all loaded salvageables (loaded from all salvageable configs)
|
|
|
|
* @return the currently loaded salvageables
|
|
|
|
*/
|
|
|
|
public ArrayList<Salvageable> getSalvageables()
|
|
|
|
{
|
2019-03-08 19:40:01 -08:00
|
|
|
return (ArrayList<Salvageable>) salvageConfig.genericCollection;
|
2019-02-17 08:59:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unloads all config options (prepares for reload)
|
|
|
|
*/
|
|
|
|
public void unloadAllConfigsAndRegisters()
|
|
|
|
{
|
|
|
|
//Unload
|
|
|
|
for(Unload unloadable : unloadables)
|
|
|
|
{
|
|
|
|
unloadable.unload();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Clear
|
|
|
|
unloadables.clear();
|
2019-02-21 19:06:59 -08:00
|
|
|
userFiles.clear();
|
2019-02-17 08:59:09 -08:00
|
|
|
}
|
2019-02-17 11:32:53 -08:00
|
|
|
|
2019-02-18 15:17:35 -08:00
|
|
|
/**
|
|
|
|
* Registers an unloadable
|
|
|
|
* Unloadables call unload() on plugin disable to cleanup registries
|
|
|
|
*/
|
|
|
|
public void registerUnloadable(Unload unload)
|
|
|
|
{
|
|
|
|
if(!unloadables.contains(unload))
|
|
|
|
unloadables.add(unload);
|
|
|
|
}
|
|
|
|
|
2019-02-21 19:06:59 -08:00
|
|
|
/**
|
|
|
|
* Registers an unloadable
|
|
|
|
* Unloadables call unload() on plugin disable to cleanup registries
|
|
|
|
*/
|
|
|
|
public void registerUserFile(File userFile)
|
|
|
|
{
|
|
|
|
if(!userFiles.contains(userFile))
|
|
|
|
userFiles.add(userFile);
|
|
|
|
}
|
|
|
|
|
2019-02-17 11:32:53 -08:00
|
|
|
/*
|
|
|
|
* GETTER BOILER PLATE
|
|
|
|
*/
|
|
|
|
|
2019-02-21 19:06:59 -08:00
|
|
|
/**
|
|
|
|
* Used to back up our zip files real easily
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public ArrayList<File> getConfigFiles()
|
|
|
|
{
|
|
|
|
return userFiles;
|
|
|
|
}
|
|
|
|
|
2019-02-17 11:32:53 -08:00
|
|
|
public SimpleRepairableManager getSimpleRepairableManager() {
|
|
|
|
return simpleRepairableManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SimpleSalvageableManager getSimpleSalvageableManager() {
|
|
|
|
return simpleSalvageableManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
public MainConfig getMainConfig() {
|
|
|
|
return mainConfig;
|
|
|
|
}
|
|
|
|
|
2019-02-21 19:06:59 -08:00
|
|
|
public FishingTreasureConfig getFishingTreasureConfig() {
|
|
|
|
return fishingTreasureConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ExcavationTreasureConfig getExcavationTreasureConfig() {
|
|
|
|
return excavationTreasureConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public HerbalismTreasureConfig getHerbalismTreasureConfig() {
|
|
|
|
return herbalismTreasureConfig;
|
2019-02-17 11:32:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public AdvancedConfig getAdvancedConfig() {
|
|
|
|
return advancedConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PotionConfig getPotionConfig() {
|
|
|
|
return potionConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public CoreSkillsConfig getCoreSkillsConfig() {
|
|
|
|
return coreSkillsConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SoundConfig getSoundConfig() {
|
|
|
|
return soundConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
public RankConfig getRankConfig() {
|
|
|
|
return rankConfig;
|
|
|
|
}
|
2019-02-18 09:08:16 -08:00
|
|
|
|
|
|
|
public ExperienceConfig getExperienceConfig() {
|
|
|
|
return experienceConfig;
|
|
|
|
}
|
2019-02-18 15:35:46 -08:00
|
|
|
|
2019-03-06 16:50:38 -08:00
|
|
|
public ExperienceMapManager getExperienceMapManager() {
|
|
|
|
return experienceMapManager;
|
|
|
|
}
|
2019-03-08 17:54:23 -08:00
|
|
|
|
2019-03-12 04:21:46 -07:00
|
|
|
public ConfigDatabase getConfigDatabase() { return configDatabase.getConfig(); }
|
2019-03-13 09:42:57 -07:00
|
|
|
|
|
|
|
public ConfigScoreboard getConfigScoreboard() { return configScoreboard.getConfig(); }
|
2019-03-13 13:09:27 -07:00
|
|
|
|
|
|
|
public ConfigLeveling getConfigLeveling() {
|
|
|
|
return configLeveling.getConfig();
|
|
|
|
}
|
2019-03-13 18:34:40 -07:00
|
|
|
|
|
|
|
public ConfigWorldBlacklist getConfigWorldBlacklist() {
|
|
|
|
return configWorldBlacklist.getConfig();
|
|
|
|
}
|
2019-03-14 17:34:13 -07:00
|
|
|
|
|
|
|
public ConfigExploitPrevention getConfigExploitPrevention() {
|
|
|
|
return configExploitPrevention.getConfig();
|
|
|
|
}
|
2019-03-14 18:14:08 -07:00
|
|
|
|
|
|
|
public ConfigMOTD getConfigMOTD() {
|
|
|
|
return configMOTD.getConfig();
|
|
|
|
}
|
2019-03-14 20:06:26 -07:00
|
|
|
|
|
|
|
public ConfigHardcore getConfigHardcore() {
|
|
|
|
return configHardcore.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigMetrics getConfigMetrics() {
|
|
|
|
return configMetrics.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigAuthorAdvertisements getConfigAds() {
|
|
|
|
return configAuthorAdvertisements.getConfig();
|
|
|
|
}
|
2019-03-14 20:30:20 -07:00
|
|
|
|
|
|
|
public ConfigAutomatedBackups getConfigAutomatedBackups() {
|
|
|
|
return configAutomatedBackups.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigCommands getConfigCommands() {
|
|
|
|
return configCommands.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigItems getConfigItems() {
|
|
|
|
return configItems.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigLanguage getConfigLanguage() {
|
|
|
|
return configLanguage.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigParticles getConfigParticles() {
|
|
|
|
return configParticles.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigParty getConfigParty() {
|
|
|
|
return configParty.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigNotifications getConfigNotifications() {
|
|
|
|
return configNotifications.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigSuperAbilities getConfigSuperAbilities() {
|
|
|
|
return configSuperAbilities.getConfig();
|
|
|
|
}
|
2019-03-17 04:44:06 -07:00
|
|
|
|
2019-03-20 11:03:09 -07:00
|
|
|
public HashMap<Material, Integer> getPartyItemWeights() {
|
2019-03-17 04:44:06 -07:00
|
|
|
return partyItemWeights;
|
|
|
|
}
|
|
|
|
|
2019-03-20 11:03:09 -07:00
|
|
|
public HashMap<PartyFeature, Integer> getPartyFeatureUnlocks() {
|
2019-03-17 04:44:06 -07:00
|
|
|
return partyFeatureUnlocks;
|
|
|
|
}
|
2019-03-19 08:56:48 -07:00
|
|
|
|
|
|
|
public ConfigAdmin getConfigAdmin() {
|
|
|
|
return configAdmin.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigMobs getConfigMobs() {
|
|
|
|
return configMobs.getConfig();
|
|
|
|
}
|
2019-03-20 15:53:12 -07:00
|
|
|
|
|
|
|
public ConfigAcrobatics getConfigAcrobatics() {
|
|
|
|
return configAcrobatics.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigAlchemy getConfigAlchemy() {
|
|
|
|
return configAlchemy.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigArchery getConfigArchery() {
|
|
|
|
return configArchery.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigAxes getConfigAxes() {
|
|
|
|
return configAxes.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigExcavation getConfigExcavation() {
|
|
|
|
return configExcavation.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigFishing getConfigFishing() {
|
|
|
|
return configFishing.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigHerbalism getConfigHerbalism() {
|
|
|
|
return configHerbalism.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigMining getConfigMining() {
|
|
|
|
return configMining.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigRepair getConfigRepair() {
|
|
|
|
return configRepair.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigSwords getConfigSwords() {
|
|
|
|
return configSwords.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigTaming getConfigTaming() {
|
|
|
|
return configTaming.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigUnarmed getConfigUnarmed() {
|
|
|
|
return configUnarmed.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigWoodcutting getConfigWoodcutting() {
|
|
|
|
return configWoodcutting.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigSmelting getConfigSmelting() {
|
|
|
|
return configSmelting.getConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ConfigSalvage getConfigSalvage() {
|
|
|
|
return configSalvage.getConfig();
|
|
|
|
}
|
2019-03-21 20:16:16 -07:00
|
|
|
|
|
|
|
public double getSkillMaxBonusLevel(SubSkillType subSkillType)
|
|
|
|
{
|
|
|
|
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
|
|
|
|
}
|
|
|
|
|
|
|
|
public double getSkillMaxChance(SubSkillType subSkillType)
|
|
|
|
{
|
|
|
|
return skillPropertiesManager.getMaxChance(subSkillType);
|
|
|
|
}
|
2019-02-17 08:59:09 -08:00
|
|
|
}
|