mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
rewire getInstance() for configs
This commit is contained in:
parent
f4ba472403
commit
d7e0c95984
@ -114,6 +114,17 @@ Version 2.1.17
|
|||||||
Version 2.1.16
|
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 will no longer shutdown if it finds invalid config entries
|
||||||
|
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)
|
||||||
|
Mycellium removed from woodcutting XP (whoops)
|
||||||
|
Optimized XP lookups for block breaking
|
||||||
|
Super Breaker will now break "Mining" blocks even if they have no XP entries
|
||||||
|
Tree Feller will now break "Woodcutting" blocks even if they have no XP entries
|
||||||
|
Giga Drill Breaker will now break "diggable" blocks even if they have no configured treasures
|
||||||
|
removed child.yml, child skills now have hard coded parents
|
||||||
|
removed the hardcore and vampirism commands, these are dangerous settings and should not be toggle-able (turn them on in your configs if you want to use them)
|
||||||
|
|
||||||
Version 2.1.15
|
Version 2.1.15
|
||||||
Fixed a bug where a max rank of Fuel Efficiency would cause its benefits to be lost
|
Fixed a bug where a max rank of Fuel Efficiency would cause its benefits to be lost
|
||||||
|
@ -129,15 +129,22 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "advanced.yml", true);
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "advanced.yml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
/*public static AdvancedConfig getInstance() {
|
//do nothing
|
||||||
if (instance == null) {
|
|
||||||
instance = new AdvancedConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
/**
|
||||||
}*/
|
* This grabs an instance of this config class from the Config Manager
|
||||||
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
|
* @return the instance of this config
|
||||||
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static AdvancedConfig getInstance() {
|
||||||
|
return mcMMO.getConfigManager().getAdvancedConfig();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of this config
|
* The version of this config
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.gmail.nossr50.config.collectionconfigs;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.*;
|
import com.gmail.nossr50.config.*;
|
||||||
|
import com.gmail.nossr50.config.collectionconfigs.CollectionClassType;
|
||||||
|
import com.gmail.nossr50.config.collectionconfigs.MultiConfigContainer;
|
||||||
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
||||||
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
||||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||||
@ -46,6 +48,7 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
/* CONFIG INSTANCES */
|
/* CONFIG INSTANCES */
|
||||||
|
|
||||||
|
private MainConfig mainConfig;
|
||||||
private TreasureConfig treasureConfig;
|
private TreasureConfig treasureConfig;
|
||||||
private AdvancedConfig advancedConfig;
|
private AdvancedConfig advancedConfig;
|
||||||
private PotionConfig potionConfig;
|
private PotionConfig potionConfig;
|
||||||
@ -59,6 +62,11 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
// Load Config Files
|
// Load Config Files
|
||||||
// I'm pretty these are supposed to be done in a specific order, so don't rearrange them willy nilly
|
// I'm pretty these are supposed to be done in a specific order, so don't rearrange them willy nilly
|
||||||
|
|
||||||
|
//TODO: Not sure about the order of MainConfig
|
||||||
|
mainConfig = new MainConfig();
|
||||||
|
unloadables.add(mainConfig);
|
||||||
|
|
||||||
treasureConfig = new TreasureConfig();
|
treasureConfig = new TreasureConfig();
|
||||||
unloadables.add(treasureConfig);
|
unloadables.add(treasureConfig);
|
||||||
|
|
||||||
@ -80,7 +88,7 @@ public final class ConfigManager {
|
|||||||
//TODO: This config serves no purpose so its getting removed
|
//TODO: This config serves no purpose so its getting removed
|
||||||
new ChildConfig();
|
new ChildConfig();
|
||||||
|
|
||||||
if (MainConfig.getInstance().getToolModsEnabled()) {
|
/*if (MainConfig.getInstance().getToolModsEnabled()) {
|
||||||
new ToolConfigManager();
|
new ToolConfigManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +102,7 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
if (MainConfig.getInstance().getEntityModsEnabled()) {
|
if (MainConfig.getInstance().getEntityModsEnabled()) {
|
||||||
new EntityConfigManager();
|
new EntityConfigManager();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Multi Config Containers
|
// Multi Config Containers
|
||||||
initMultiConfigContainers();
|
initMultiConfigContainers();
|
||||||
@ -163,4 +171,44 @@ public final class ConfigManager {
|
|||||||
//Clear
|
//Clear
|
||||||
unloadables.clear();
|
unloadables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GETTER BOILER PLATE
|
||||||
|
*/
|
||||||
|
|
||||||
|
public SimpleRepairableManager getSimpleRepairableManager() {
|
||||||
|
return simpleRepairableManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleSalvageableManager getSimpleSalvageableManager() {
|
||||||
|
return simpleSalvageableManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MainConfig getMainConfig() {
|
||||||
|
return mainConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreasureConfig getTreasureConfig() {
|
||||||
|
return treasureConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ public abstract class ConfigValidated extends Config implements DefaultKeys {
|
|||||||
{
|
{
|
||||||
for(String error : validKeyErrors)
|
for(String error : validKeyErrors)
|
||||||
{
|
{
|
||||||
McmmoCore.getLogger().severe(error);
|
mcMMO.p.getLogger().severe(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,17 @@ public class CoreSkillsConfig extends Config {
|
|||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(),"coreskills.yml", true);
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(),"coreskills.yml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static CoreSkillsConfig getInstance() {
|
/**
|
||||||
if (instance == null)
|
* This grabs an instance of the class from the Config Manager
|
||||||
return new CoreSkillsConfig();
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
return instance;
|
* @return the instance of this config
|
||||||
}*/
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static CoreSkillsConfig getInstance() {
|
||||||
|
return mcMMO.getConfigManager().getCoreSkillsConfig();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of this config
|
* The version of this config
|
||||||
@ -32,7 +37,7 @@ public class CoreSkillsConfig extends Config {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
instance = null;
|
//Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -16,24 +16,27 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MainConfig extends ConfigValidated {
|
public class MainConfig extends ConfigValidated {
|
||||||
private static MainConfig instance;
|
|
||||||
|
|
||||||
private 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);
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "config.yml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This grabs an instance of this config class from the Config Manager
|
||||||
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
|
* @return the instance of this config
|
||||||
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static MainConfig getInstance() {
|
public static MainConfig getInstance() {
|
||||||
if (instance == null) {
|
return mcMMO.getConfigManager().getMainConfig();
|
||||||
instance = new MainConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
instance = null;
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,18 @@ public class RankConfig extends ConfigValidated {
|
|||||||
//this.instance = this;
|
//this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This grabs an instance of this config class from the Config Manager
|
||||||
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
|
* @return the instance of this config
|
||||||
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static RankConfig getInstance() {
|
||||||
|
return mcMMO.getConfigManager().getRankConfig();
|
||||||
|
}
|
||||||
|
|
||||||
/*public static RankConfig getInstance() {
|
/*public static RankConfig getInstance() {
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
return new RankConfig();
|
return new RankConfig();
|
||||||
@ -25,7 +37,7 @@ public class RankConfig extends ConfigValidated {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
instance = null;
|
//Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,7 +96,7 @@ public class RankConfig extends ConfigValidated {
|
|||||||
* @return the level requirement for a subskill at this particular rank
|
* @return the level requirement for a subskill at this particular rank
|
||||||
*/
|
*/
|
||||||
private int findRankByRootAddress(int rank, String key) {
|
private int findRankByRootAddress(int rank, String key) {
|
||||||
String scalingKey = MainMainConfig.getInstance().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
String scalingKey = MainConfig.getInstance().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
||||||
|
|
||||||
String targetRank = "Rank_" + rank;
|
String targetRank = "Rank_" + rank;
|
||||||
|
|
||||||
@ -117,7 +129,7 @@ public class RankConfig extends ConfigValidated {
|
|||||||
|
|
||||||
if (prevRank > curRank) {
|
if (prevRank > curRank) {
|
||||||
//We're going to allow this but we're going to warn them
|
//We're going to allow this but we're going to warn them
|
||||||
plugin.getLogger().info("You have the ranks for the subskill " + subSkillType.toString() + " set up poorly, sequential ranks should have ascending requirements");
|
mcMMO.p.getLogger().info("You have the ranks for the subskill " + subSkillType.toString() + " set up poorly, sequential ranks should have ascending requirements");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,23 @@ 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);
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "sounds.yml", true);
|
||||||
this.instance = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static SoundConfig getInstance() {
|
/**
|
||||||
if (instance == null)
|
* This grabs an instance of this config class from the Config Manager
|
||||||
return new SoundConfig();
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
return instance;
|
* @return the instance of this config
|
||||||
}*/
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static SoundConfig getInstance() {
|
||||||
|
return mcMMO.getConfigManager().getSoundConfig();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
instance = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.config.treasure;
|
package com.gmail.nossr50.config.treasure;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
import com.gmail.nossr50.config.ConfigCollection;
|
||||||
import com.gmail.nossr50.datatypes.treasure.*;
|
import com.gmail.nossr50.datatypes.treasure.*;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -37,13 +38,27 @@ public class TreasureConfig extends ConfigCollection {
|
|||||||
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "treasures.yml", true);
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "treasures.yml", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static TreasureConfig getInstance() {
|
/**
|
||||||
if (instance == null) {
|
* This grabs an instance of this config class from the Config Manager
|
||||||
instance = new TreasureConfig();
|
* This method is deprecated and will be removed in the future
|
||||||
|
* @see mcMMO#getConfigManager()
|
||||||
|
* @return the instance of this config
|
||||||
|
* @deprecated Please use mcMMO.getConfigManager() to grab a specific config instead
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static TreasureConfig getInstance() {
|
||||||
|
return mcMMO.getConfigManager().getTreasureConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
/**
|
||||||
}*/
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
protected boolean validateKeys() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50;
|
package com.gmail.nossr50;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.*;
|
import com.gmail.nossr50.config.*;
|
||||||
import com.gmail.nossr50.config.collectionconfigs.ConfigManager;
|
import com.gmail.nossr50.config.ConfigManager;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.database.DatabaseManager;
|
import com.gmail.nossr50.database.DatabaseManager;
|
||||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||||
@ -314,11 +314,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RepairableManager getRepairableManager() {
|
public static RepairableManager getRepairableManager() {
|
||||||
return repairableManager;
|
return configManager.getSimpleRepairableManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SalvageableManager getSalvageableManager() {
|
public static SalvageableManager getSalvageableManager() {
|
||||||
return salvageableManager;
|
return configManager.getSimpleSalvageableManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DatabaseManager getDatabaseManager() {
|
public static DatabaseManager getDatabaseManager() {
|
||||||
@ -533,4 +533,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static WorldBlacklist getWorldBlacklist() {
|
public static WorldBlacklist getWorldBlacklist() {
|
||||||
return worldBlacklist;
|
return worldBlacklist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ConfigManager getConfigManager() {
|
||||||
|
return configManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public final class ShareHandler {
|
|||||||
|
|
||||||
switch (shareMode) {
|
switch (shareMode) {
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
int itemWeight = ItemWeightMainConfig.getInstance().getItemWeight(itemStack.getType());
|
int itemWeight = ItemWeightConfig.getInstance().getItemWeight(itemStack.getType());
|
||||||
|
|
||||||
for (int i = 0; i < itemStack.getAmount(); i++) {
|
for (int i = 0; i < itemStack.getAmount(); i++) {
|
||||||
int highestRoll = 0;
|
int highestRoll = 0;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.salvage;
|
package com.gmail.nossr50.skills.salvage;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
import com.gmail.nossr50.config.MainConfig;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
import com.gmail.nossr50.config.MainConfig;
|
||||||
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -716,7 +717,7 @@ public final class ItemUtils {
|
|||||||
* @return true if the item is a miscellaneous drop, false otherwise
|
* @return true if the item is a miscellaneous drop, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isMiscDrop(ItemStack item) {
|
public static boolean isMiscDrop(ItemStack item) {
|
||||||
return ItemWeightMainConfig.getInstance().getMiscItems().contains(item.getType());
|
return ItemWeightConfig.getInstance().getMiscItems().contains(item.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMcMMOItem(ItemStack item) {
|
public static boolean isMcMMOItem(ItemStack item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user