DynamicSettingsManager - Handles platform specific datasets

Converts datasets from the config into ready to use platform specific
ones
Currently only supports Bukkit, that will change later
Expect API breakages if you hook into this class
This commit is contained in:
nossr50 2019-05-13 00:53:29 -07:00
parent d614df65a7
commit 72fc3efa78
27 changed files with 177 additions and 312 deletions

View File

@ -1,49 +0,0 @@
package com.gmail.nossr50.config;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
/**
* Represents a config file that registers keys after its initialized
*/
public abstract class ConfigCollection<T> extends Config implements Registers, GenericCollectionContainer {
//The collection held by this class
protected Collection<T> genericCollection;
/**
* @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 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(String fileName, File pathToParentFolder, String relativePath, boolean generateDefaults, boolean mergeNewKeys, boolean copyDefaults, boolean removeOldKeys) {
super(fileName, pathToParentFolder, relativePath, generateDefaults, mergeNewKeys, copyDefaults, removeOldKeys);
//init
initCollection();
//DO NOT CALL THIS HERE
//register();
}
/**
* Initializes the generic collection held by this class
*/
private void initCollection() {
if (genericCollection == null)
genericCollection = new ArrayList<>();
}
@Override
public Collection<T> getLoadedCollection() {
return this.genericCollection;
}
@Override
public void unload() {
genericCollection.clear();
}
}

View File

@ -47,13 +47,9 @@ import com.gmail.nossr50.datatypes.experience.CustomXPPerk;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
import com.gmail.nossr50.util.experience.ExperienceMapManager;
import com.google.common.collect.Maps;
import com.google.common.reflect.TypeToken;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializerCollection;
@ -67,32 +63,15 @@ import java.util.HashMap;
/**
* 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
* <p>
* Config Manager also holds all of our MultiConfigContainers
* Settings in configs are sometimes not platform-ready, you can find platform ready implementations in the {@link com.gmail.nossr50.core.DynamicSettingsManager DynamicSettingsManager}
*/
public final class ConfigManager {
/* UNLOAD REGISTER */
private SkillPropertiesManager skillPropertiesManager;
private ArrayList<Unload> unloadables;
/* COLLECTION MANAGERS */
/* File array - Used for backups */
private ArrayList<File> userFiles;
private RepairableManager repairableManager;
private SalvageableManager salvageableManager;
/* CUSTOM SERIALIZERS */
private BonusDropManager bonusDropManager;
/* MOD MANAGERS */
//TODO: Add these back when modded servers become a thing again
/* MISC MANAGERS */
/* Custom Serialization */
private TypeSerializerCollection customSerializers;
private ExperienceMapManager experienceMapManager;
// private PotionManager potionManager;
/* CONFIG INSTANCES */
@ -134,7 +113,6 @@ public final class ConfigManager {
private ConfigSmelting configSmelting;
private ConfigSalvage configSalvage;
private HashMap<PrimarySkillType, SerializedConfigLoader<?>> skillConfigLoaders;
//Data
@ -160,7 +138,6 @@ public final class ConfigManager {
private ArrayList<String> configErrors; //Collect errors to whine about to server admins
public ConfigManager() {
unloadables = new ArrayList<>();
userFiles = new ArrayList<>();
}
@ -174,24 +151,12 @@ public final class ConfigManager {
//Serialized Data
initSerializedDataFiles();
//Skill Property Registers
skillPropertiesManager = new SkillPropertiesManager();
skillPropertiesManager.fillRegisters();
//Assign Maps
partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights
partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression
//YAML Configs
initYAMLConfigs();
/*
* Managers
*/
// Register Managers
initMiscManagers();
initCollectionManagers();
}
private void initYAMLConfigs() {
@ -323,79 +288,6 @@ public final class ConfigManager {
skillConfigLoaders.put(primarySkillType, SkillConfigFactory.initSkillConfig(primarySkillType, clazz));
}
/**
* Misc managers
*/
private void initMiscManagers() {
experienceMapManager = new ExperienceMapManager();
//Set the global XP val
experienceMapManager.setGlobalXpMult(getConfigExperience().getGlobalXPMultiplier());
experienceMapManager.buildBlockXPMaps(); //Block XP value maps
experienceMapManager.fillCombatXPMultiplierMap(getConfigExperience().getCombatExperienceMap());
// potionManager = new PotionManager();
}
/**
* Initializes any managers related to config collections
*/
private void initCollectionManagers() {
// Handles registration of repairables
repairableManager = new RepairableManager(getRepairables());
unloadables.add(repairableManager);
// Handles registration of salvageables
salvageableManager = new SalvageableManager(getSalvageables());
unloadables.add(salvageableManager);
// Handles registration of bonus drops
bonusDropManager = new BonusDropManager();
unloadables.add(bonusDropManager);
//Register Bonus Drops
registerBonusDrops();
}
/**
* Get all loaded repairables (loaded from all repairable configs)
*
* @return the currently loaded repairables
*/
public ArrayList<Repairable> getRepairables() {
return getConfigRepair().getConfigRepairablesList();
}
/**
* Get all loaded salvageables (loaded from all salvageable configs)
*
* @return the currently loaded salvageables
*/
public ArrayList<Salvageable> getSalvageables() {
return getConfigSalvage().getConfigSalvageablesList();
}
/**
* Unloads all config options (prepares for reload)
*/
public void unloadAllConfigsAndRegisters() {
//Unload
for (Unload unloadable : unloadables) {
unloadable.unload();
}
//Clear
unloadables.clear();
userFiles.clear();
}
/**
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
*/
public void registerUnloadable(Unload unload) {
if (!unloadables.contains(unload))
unloadables.add(unload);
}
/**
* Registers an unloadable
* Unloadables call unload() on plugin disable to cleanup registries
@ -405,15 +297,6 @@ public final class ConfigManager {
userFiles.add(userFile);
}
/**
* Registers bonus drops from several skill configs
*/
public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
}
public void validateConfigs() {
}
@ -424,7 +307,6 @@ public final class ConfigManager {
*/
public void reloadConfigs() {
mcMMO.p.getLogger().info("Reloading config values...");
unloadAllConfigsAndRegisters(); //Unload Everything
loadConfigs(); //Load everything again
}
@ -441,14 +323,6 @@ public final class ConfigManager {
return userFiles;
}
public RepairableManager getRepairableManager() {
return repairableManager;
}
public SalvageableManager getSalvageableManager() {
return salvageableManager;
}
public MainConfig getMainConfig() {
return mainConfig;
}
@ -489,10 +363,6 @@ public final class ConfigManager {
return experienceConfig;
}
public ExperienceMapManager getExperienceMapManager() {
return experienceMapManager;
}
public ConfigDatabase getConfigDatabase() {
return configDatabase.getConfig();
}
@ -637,10 +507,6 @@ public final class ConfigManager {
return configSalvage;
}
public BonusDropManager getBonusDropManager() {
return bonusDropManager;
}
/**
* Checks if this plugin is using retro mode
* Retro mode is a 0-1000 skill system
@ -652,23 +518,7 @@ public final class ConfigManager {
return getConfigLeveling().getConfigSectionLevelingGeneral().getConfigSectionLevelScaling().isRetroModeEnabled();
}
public boolean isBonusDropsEnabled(Material material) {
return getBonusDropManager().isBonusDropWhitelisted(material);
}
public double getSkillMaxBonusLevel(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
}
public double getSkillMaxChance(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxChance(subSkillType);
}
public ConfigExperience getConfigExperience() {
return configExperience.getConfig();
}
public SkillPropertiesManager getSkillPropertiesManager() {
return skillPropertiesManager;
}
}

View File

@ -1,17 +0,0 @@
package com.gmail.nossr50.config;
import java.util.Collection;
/**
* Represents a class that contains a generic collection
*
* @param <T>
*/
public interface GenericCollectionContainer<T> {
/**
* Grab the collection held by this class
*
* @return the collection held by this class
*/
Collection<T> getLoadedCollection();
}

View File

@ -1,11 +0,0 @@
package com.gmail.nossr50.config;
/**
* A class that is expected to register one thing into another thing
*/
public interface Registers extends Unload {
/**
* Register stuff
*/
void register();
}

View File

@ -1,11 +0,0 @@
package com.gmail.nossr50.config;
/**
* A class that registers keys
*/
public interface RegistersKeys {
/**
* Loads up keys
*/
void loadKeys();
}

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.treasure;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.Registers;
import com.gmail.nossr50.config.UnsafeValueValidation;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.mcMMO;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.treasure;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.Registers;
import com.gmail.nossr50.config.UnsafeValueValidation;
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.config.treasure;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.Registers;
import com.gmail.nossr50.config.UnsafeValueValidation;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
import com.gmail.nossr50.mcMMO;

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.config;
package com.gmail.nossr50.core;
import com.gmail.nossr50.config.Unload;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.config;
package com.gmail.nossr50.core;
/**
* This class is used to define settings for upgrading EXTREMELY OLD versions of mcMMO to newer versions

View File

@ -0,0 +1,140 @@
package com.gmail.nossr50.core;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
import com.gmail.nossr50.util.experience.ExperienceMapManager;
import org.bukkit.Material;
import java.util.ArrayList;
/**
* The DSM (Dynamic Settings Manager) is responsible for
* 1) Inits managers which convert platform generic settings from the configs (specifically pulling from ConfigManager) into usable data for this platform
* 2) Retrieving or Setting variables for core systems in mcMMO without permanent change (WIP)
*
* This class is a WIP, expect API breakages in the future
* Currently implementation of this class will only be friendly to Bukkit, this will change in the near future
*/
public class DynamicSettingsManager {
/* UNLOAD REGISTER */
private SkillPropertiesManager skillPropertiesManager;
/* COLLECTION MANAGERS */
private RepairableManager repairableManager;
private SalvageableManager salvageableManager;
/* Platform Ready Managers */
private BonusDropManager bonusDropManager;
private ExperienceMapManager experienceMapManager;
public DynamicSettingsManager() {
/*
* Managers
*/
// Register Managers
initSkillPropertiesManager();
initMiscManagers();
initCollectionManagers();
}
private void initSkillPropertiesManager() {
skillPropertiesManager = new SkillPropertiesManager();
skillPropertiesManager.fillRegisters();
}
/**
* Misc managers
*/
private void initMiscManagers() {
experienceMapManager = new ExperienceMapManager();
//Set the global XP val
experienceMapManager.setGlobalXpMult(mcMMO.getConfigManager().getConfigExperience().getGlobalXPMultiplier());
experienceMapManager.buildBlockXPMaps(); //Block XP value maps
experienceMapManager.fillCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getCombatExperienceMap());
// potionManager = new PotionManager();
}
/**
* Initializes any managers related to config collections
*/
private void initCollectionManagers() {
// Handles registration of repairables
repairableManager = new RepairableManager(getRepairables());
// Handles registration of salvageables
salvageableManager = new SalvageableManager(getSalvageables());
// Handles registration of bonus drops
bonusDropManager = new BonusDropManager();
//Register Bonus Drops
registerBonusDrops();
}
/**
* Get all loaded repairables (loaded from all repairable configs)
*
* @return the currently loaded repairables
*/
public ArrayList<Repairable> getRepairables() {
return mcMMO.getConfigManager().getConfigRepair().getConfigRepairablesList();
}
/**
* Get all loaded salvageables (loaded from all salvageable configs)
*
* @return the currently loaded salvageables
*/
public ArrayList<Salvageable> getSalvageables() {
return mcMMO.getConfigManager().getConfigSalvage().getConfigSalvageablesList();
}
/**
* Registers bonus drops from several skill configs
*/
public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
}
public RepairableManager getRepairableManager() {
return repairableManager;
}
public SalvageableManager getSalvageableManager() {
return salvageableManager;
}
public ExperienceMapManager getExperienceMapManager() {
return experienceMapManager;
}
public BonusDropManager getBonusDropManager() {
return bonusDropManager;
}
public boolean isBonusDropsEnabled(Material material) {
return getBonusDropManager().isBonusDropWhitelisted(material);
}
public double getSkillMaxBonusLevel(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxBonusLevel(subSkillType);
}
public double getSkillMaxChance(SubSkillType subSkillType) {
return skillPropertiesManager.getMaxChance(subSkillType);
}
public SkillPropertiesManager getSkillPropertiesManager() {
return skillPropertiesManager;
}
}

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.config;
package com.gmail.nossr50.core;
import com.gmail.nossr50.config.hocon.skills.ConfigSubSkillScalingRNG;
import com.gmail.nossr50.datatypes.skills.SubSkillType;

View File

@ -1,10 +1,10 @@
//package com.gmail.nossr50.util;
//
//import com.gmail.nossr50.config.MainConfig;
//import com.gmail.nossr50.config.mods.CustomArmorConfig;
//import com.gmail.nossr50.config.mods.CustomBlockConfig;
//import com.gmail.nossr50.config.mods.CustomEntityConfig;
//import com.gmail.nossr50.config.mods.CustomToolConfig;
//import com.gmail.nossr50.dumpster.mods.CustomArmorConfig;
//import com.gmail.nossr50.dumpster.mods.CustomBlockConfig;
//import com.gmail.nossr50.dumpster.mods.CustomEntityConfig;
//import com.gmail.nossr50.dumpster.mods.CustomToolConfig;
//import com.gmail.nossr50.datatypes.mods.CustomBlock;
//import com.gmail.nossr50.datatypes.mods.CustomEntity;
//import com.gmail.nossr50.datatypes.mods.CustomTool;

View File

@ -1,4 +1,4 @@
//package com.gmail.nossr50.config.mods;
//package com.gmail.nossr50.dumpster.mods;
//
//public class ArmorConfigManager {
// //TODO: Commented out until modded servers appear again

View File

@ -1,4 +1,4 @@
//package com.gmail.nossr50.config.mods;
//package com.gmail.nossr50.dumpster.mods;
//
//public class BlockConfigManager {
// //TODO: Commented out until modded servers appear again

View File

@ -1,4 +1,4 @@
//package com.gmail.nossr50.config.mods;
//package com.gmail.nossr50.dumpster.mods;
//
//import com.gmail.nossr50.config.ConfigCollection;
//import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;

View File

@ -1,4 +1,4 @@
//package com.gmail.nossr50.config.mods;
//package com.gmail.nossr50.dumpster.mods;
//
//import com.gmail.nossr50.config.ConfigCollection;
//import com.gmail.nossr50.datatypes.mods.CustomBlock;

View File

@ -1,5 +1,5 @@
//
//package com.gmail.nossr50.config.mods;
//package com.gmail.nossr50.dumpster.mods;
//
//import com.gmail.nossr50.config.Config;
//import com.gmail.nossr50.datatypes.mods.CustomEntity;

View File

@ -1,4 +1,4 @@
package com.gmail.nossr50.config.mods;
package com.gmail.nossr50.dumpster.mods;
/*
public class CustomToolConfig extends Config {

View File

@ -1,5 +1,5 @@
/*
package com.gmail.nossr50.config.mods;
package com.gmail.nossr50.dumpster.mods;
public class EntityConfigManager {

View File

@ -1,5 +1,5 @@
/*
package com.gmail.nossr50.config.mods;
package com.gmail.nossr50.dumpster.mods;
public class ToolConfigManager {

View File

@ -10,6 +10,7 @@ import com.gmail.nossr50.config.hocon.party.ConfigSectionPartyExperienceSharing;
import com.gmail.nossr50.config.hocon.party.ConfigSectionPartyLevel;
import com.gmail.nossr50.config.hocon.playerleveling.ConfigLeveling;
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
import com.gmail.nossr50.core.DynamicSettingsManager;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@ -81,6 +82,7 @@ public class mcMMO extends JavaPlugin {
/* Managers */
private static ChunkManager placeStore;
private static ConfigManager configManager;
private static DynamicSettingsManager dynamicSettingsManager;
private static DatabaseManager databaseManager;
private static FormulaManager formulaManager;
private static MaterialMapStore materialMapStore;
@ -128,11 +130,11 @@ public class mcMMO extends JavaPlugin {
}
public static RepairableManager getRepairableManager() {
return configManager.getRepairableManager();
return dynamicSettingsManager.getRepairableManager();
}
public static SalvageableManager getSalvageableManager() {
return configManager.getSalvageableManager();
return dynamicSettingsManager.getSalvageableManager();
}
public static DatabaseManager getDatabaseManager() {
@ -246,6 +248,7 @@ public class mcMMO extends JavaPlugin {
//modManager = new ModManager();
loadConfigFiles();
registerDynamicSettings(); //Do this after configs are loaded
if (healthBarPluginEnabled) {
getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
@ -429,8 +432,6 @@ public class mcMMO extends JavaPlugin {
}
databaseManager.onDisable();
//Unload configs last
configManager.unloadAllConfigsAndRegisters();
debug("Was disabled."); // How informative!
}
@ -551,6 +552,10 @@ public class mcMMO extends JavaPlugin {
localesDirectoryPath.mkdirs();
}
private void registerDynamicSettings() {
dynamicSettingsManager = new DynamicSettingsManager();
}
private void loadConfigFiles() {
configManager = new ConfigManager();
configManager.loadConfigs();
@ -595,28 +600,6 @@ public class mcMMO extends JavaPlugin {
}, 40);
}
/*private void checkModConfigs() {
if (!MainConfig.getInstance().getToolModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom tool config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml.");
}
if (!MainConfig.getInstance().getArmorModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom armor config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml.");
}
if (!MainConfig.getInstance().getBlockModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom block config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml.");
}
if (!MainConfig.getInstance().getEntityModsEnabled()) {
getLogger().warning("Cauldron implementation found, but the custom entity config for mcMMO is disabled!");
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
}
}*/
private void scheduleTasks() {
// Periodic save timer (Saves every 10 minutes by default)
long saveIntervalTicks = Math.max(1200, (getConfigManager().getConfigDatabase().getConfigSectionDatabaseGeneral().getSaveIntervalMinutes() * (20 * 60)));
@ -663,6 +646,10 @@ public class mcMMO extends JavaPlugin {
}
}
public static DynamicSettingsManager getDynamicSettingsManager() {
return dynamicSettingsManager;
}
private enum ServerSoftwareType {
PAPER,
SPIGOT,

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.skills.repair.repairables;
import com.gmail.nossr50.config.Unload;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.List;
public class RepairableManager implements Unload {
public class RepairableManager {
private HashMap<Material, Repairable> repairables;
public RepairableManager(List<Repairable> repairablesCollection) {
@ -15,11 +14,6 @@ public class RepairableManager implements Unload {
registerRepairables(repairablesCollection);
}
@Override
public void unload() {
repairables.clear();
}
public void registerRepairable(Repairable repairable) {
Material item = repairable.getItemMaterial();
repairables.put(item, repairable);

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.salvage.salvageables;
import com.gmail.nossr50.config.Unload;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@ -8,7 +7,7 @@ import java.util.HashMap;
import java.util.List;
public class SalvageableManager implements Unload {
public class SalvageableManager {
private HashMap<Material, Salvageable> salvageables;
/*public SalvageableManager() {
@ -20,11 +19,6 @@ public class SalvageableManager implements Unload {
registerSalvageables(salvageablesCollection);
}
@Override
public void unload() {
salvageables.clear();
}
public void registerSalvageable(Salvageable salvageable) {
Material item = salvageable.getItemMaterial();
salvageables.put(item, salvageable);

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.util.blockmeta.conversion;
import com.gmail.nossr50.config.ChunkConversionOptions;
import com.gmail.nossr50.core.ChunkConversionOptions;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitScheduler;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.util.blockmeta.conversion;
import com.gmail.nossr50.config.ChunkConversionOptions;
import com.gmail.nossr50.core.ChunkConversionOptions;
import com.gmail.nossr50.mcMMO;
import org.bukkit.scheduler.BukkitScheduler;

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.util.experience;
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
import com.gmail.nossr50.config.Unload;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
@ -12,7 +11,7 @@ import java.util.HashMap;
/**
* This class handles the XP for block break related XP
*/
public class ExperienceMapManager implements Unload {
public class ExperienceMapManager {
private HashMap<PrimarySkillType, HashMap<Material, String>> skillMaterialXPMap;
private HashMap<String, Integer> miningFullyQualifiedBlockXpMap;
private HashMap<String, Integer> herbalismFullyQualifiedBlockXpMap;
@ -28,7 +27,6 @@ public class ExperienceMapManager implements Unload {
initExperienceMaps();
//Register with unloader
mcMMO.getConfigManager().registerUnloadable(this);
}
private void initExperienceMaps() {
@ -314,12 +312,4 @@ public class ExperienceMapManager implements Unload {
public int getExcavationXp(Material material) {
return excavationFullyQualifiedBlockXpMap.get(material.getKey());
}
@Override
public void unload() {
miningFullyQualifiedBlockXpMap.clear();
woodcuttingFullyQualifiedBlockXpMap.clear();
herbalismFullyQualifiedBlockXpMap.clear();
excavationFullyQualifiedBlockXpMap.clear();
}
}