From 4fa3708c2f1d0d15f600eb1ee373fbb946600a39 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 26 Apr 2012 20:58:21 -0700 Subject: [PATCH] Well this should fix the issues with config, but I hate it. --- .../java/com/gmail/nossr50/BlockChecks.java | 2 +- src/main/java/com/gmail/nossr50/Combat.java | 38 +- src/main/java/com/gmail/nossr50/Database.java | 4 +- src/main/java/com/gmail/nossr50/Item.java | 14 +- .../java/com/gmail/nossr50/Leaderboard.java | 2 +- .../commands/general/MmoupdateCommand.java | 2 +- .../commands/general/XprateCommand.java | 14 +- .../nossr50/commands/mc/McmmoCommand.java | 4 +- .../nossr50/commands/mc/McremoveCommand.java | 6 +- .../nossr50/commands/mc/MctopCommand.java | 4 +- .../nossr50/commands/party/PtpCommand.java | 4 +- .../commands/skills/RepairCommand.java | 2 +- .../commands/skills/TamingCommand.java | 4 +- .../nossr50/commands/spout/MchudCommand.java | 2 +- .../nossr50/commands/spout/XplockCommand.java | 2 +- .../java/com/gmail/nossr50/config/Config.java | 457 +++++++++--------- .../gmail/nossr50/config/LoadTreasures.java | 10 +- .../gmail/nossr50/datatypes/AbilityType.java | 16 +- .../com/gmail/nossr50/datatypes/HUDmmo.java | 56 +-- .../nossr50/datatypes/PlayerProfile.java | 16 +- .../gmail/nossr50/datatypes/SkillType.java | 24 +- .../nossr50/listeners/BlockListener.java | 30 +- .../nossr50/listeners/EntityListener.java | 8 +- .../nossr50/listeners/PlayerListener.java | 16 +- .../nossr50/listeners/SpoutListener.java | 2 +- .../com/gmail/nossr50/locale/mcLocale.java | 2 +- src/main/java/com/gmail/nossr50/m.java | 4 +- src/main/java/com/gmail/nossr50/mcMMO.java | 48 +- .../nossr50/runnables/SQLConversionTask.java | 2 +- .../gmail/nossr50/runnables/SpoutStart.java | 6 +- .../com/gmail/nossr50/skills/Excavation.java | 6 +- .../com/gmail/nossr50/skills/Fishing.java | 12 +- .../com/gmail/nossr50/skills/Herbalism.java | 28 +- .../java/com/gmail/nossr50/skills/Mining.java | 32 +- .../java/com/gmail/nossr50/skills/Repair.java | 98 ++-- .../java/com/gmail/nossr50/skills/Skills.java | 18 +- .../java/com/gmail/nossr50/skills/Taming.java | 4 +- .../com/gmail/nossr50/skills/WoodCutting.java | 28 +- 38 files changed, 517 insertions(+), 510 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/BlockChecks.java b/src/main/java/com/gmail/nossr50/BlockChecks.java index 6972507f8..506790290 100644 --- a/src/main/java/com/gmail/nossr50/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/BlockChecks.java @@ -87,7 +87,7 @@ public class BlockChecks { break; } - if (Material.getMaterial(Config.getRepairAnvilId()).equals(material)) { + if (Material.getMaterial(Config.getInstance().getRepairAnvilId()).equals(material)) { return false; } else { diff --git a/src/main/java/com/gmail/nossr50/Combat.java b/src/main/java/com/gmail/nossr50/Combat.java index be1f5c4bb..d34324872 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -247,7 +247,7 @@ public class Combat { * @param cause DamageCause to pass to damage event */ private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) { - if (Config.getEventCallbackEnabled()) { + if (Config.getInstance().getEventCallbackEnabled()) { EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -270,7 +270,7 @@ public class Combat { * @param attacker Player to pass to event as damager */ private static void dealDamage(LivingEntity target, int dmg, Player attacker) { - if (Config.getEventCallbackEnabled()) { + if (Config.getInstance().getEventCallbackEnabled()) { EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -395,7 +395,7 @@ public class Combat { double baseXP = 0; if (target instanceof Player) { - if (!Config.getExperienceGainsPlayerVersusPlayerEnabled()) { + if (!Config.getInstance().getExperienceGainsPlayerVersusPlayerEnabled()) { return; } @@ -403,72 +403,72 @@ public class Combat { PlayerProfile PPd = Users.getProfile(defender); if (System.currentTimeMillis() >= (PPd.getRespawnATS() * 1000) + 5000 && ((PPd.getLastLogin() + 5) * 1000) < System.currentTimeMillis() && defender.getHealth() >= 1) { - baseXP = 20 * Config.getPlayerVersusPlayerXP(); + baseXP = 20 * Config.getInstance().getPlayerVersusPlayerXP(); } } else if (!target.hasMetadata("mcmmoFromMobSpawner")) { if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) { - baseXP = Config.getAnimalsXP(); + baseXP = Config.getInstance().getAnimalsXP(); } else { EntityType type = target.getType(); switch (type) { case BLAZE: - baseXP = Config.getBlazeXP(); + baseXP = Config.getInstance().getBlazeXP(); break; case CAVE_SPIDER: - baseXP = Config.getCaveSpiderXP(); + baseXP = Config.getInstance().getCaveSpiderXP(); break; case CREEPER: - baseXP = Config.getCreeperXP(); + baseXP = Config.getInstance().getCreeperXP(); break; case ENDER_DRAGON: - baseXP = Config.getEnderDragonXP(); + baseXP = Config.getInstance().getEnderDragonXP(); break; case ENDERMAN: - baseXP = Config.getEndermanXP(); + baseXP = Config.getInstance().getEndermanXP(); break; case GHAST: - baseXP = Config.getGhastXP(); + baseXP = Config.getInstance().getGhastXP(); break; case MAGMA_CUBE: - baseXP = Config.getMagmaCubeXP(); + baseXP = Config.getInstance().getMagmaCubeXP(); break; case IRON_GOLEM: if (!((IronGolem) target).isPlayerCreated()) - baseXP = Config.getIronGolemXP(); + baseXP = Config.getInstance().getIronGolemXP(); break; case PIG_ZOMBIE: - baseXP = Config.getPigZombieXP(); + baseXP = Config.getInstance().getPigZombieXP(); break; case SILVERFISH: - baseXP = Config.getSilverfishXP(); + baseXP = Config.getInstance().getSilverfishXP(); break; case SKELETON: - baseXP = Config.getSkeletonXP(); + baseXP = Config.getInstance().getSkeletonXP(); break; case SLIME: - baseXP = Config.getSlimeXP(); + baseXP = Config.getInstance().getSlimeXP(); break; case SPIDER: - baseXP = Config.getSpiderXP(); + baseXP = Config.getInstance().getSpiderXP(); break; case ZOMBIE: - baseXP = Config.getZombieXP(); + baseXP = Config.getInstance().getZombieXP(); break; default: diff --git a/src/main/java/com/gmail/nossr50/Database.java b/src/main/java/com/gmail/nossr50/Database.java index b3e34661a..d47dd7116 100644 --- a/src/main/java/com/gmail/nossr50/Database.java +++ b/src/main/java/com/gmail/nossr50/Database.java @@ -15,8 +15,8 @@ import com.gmail.nossr50.runnables.SQLReconnect; public class Database { - private static String connectionString = "jdbc:mysql://" + Config.getMySQLServerName() + ":" + Config.getMySQLServerPort() + "/" + Config.getMySQLDatabaseName() + "?user=" + Config.getMySQLUserName() + "&password=" + Config.getMySQLUserPassword(); - private static String tablePrefix = Config.getMySQLTablePrefix(); + private static String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName() + "?user=" + Config.getInstance().getMySQLUserName() + "&password=" + Config.getInstance().getMySQLUserPassword(); + private static String tablePrefix = Config.getInstance().getMySQLTablePrefix(); private static Connection conn = null; private static mcMMO plugin = null; private static long reconnectTimestamp = 0; diff --git a/src/main/java/com/gmail/nossr50/Item.java b/src/main/java/com/gmail/nossr50/Item.java index 025abf45f..c0165ddff 100644 --- a/src/main/java/com/gmail/nossr50/Item.java +++ b/src/main/java/com/gmail/nossr50/Item.java @@ -21,7 +21,7 @@ public class Item { public static void itemchecks(Player player) { ItemStack inhand = player.getItemInHand(); - if (Config.getChimaeraEnabled() && inhand.getTypeId() == Config.getChimaeraItemId()) { + if (Config.getInstance().getChimaeraEnabled() && inhand.getTypeId() == Config.getInstance().getChimaeraItemId()) { chimaerawing(player); } } @@ -32,9 +32,9 @@ public class Item { Block block = player.getLocation().getBlock(); int amount = is.getAmount(); - if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.getChimaeraItemId()) { - if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getChimaeraCost()) { - player.setItemInHand(new ItemStack(Config.getChimaeraItemId(), amount - Config.getChimaeraCost())); + if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.getInstance().getChimaeraItemId()) { + if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) { + player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost())); for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) { if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) { @@ -53,11 +53,11 @@ public class Item { player.sendMessage(mcLocale.getString("Item.ChimaeraWing.Pass")); } - else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.getChimaeraCost()) { + else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.getInstance().getChimaeraCost()) { player.sendMessage(mcLocale.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)})); } - else if (is.getAmount() <= Config.getChimaeraCost()) { - player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getChimaeraItemId())); + else if (is.getAmount() <= Config.getInstance().getChimaeraCost()) { + player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getChimaeraItemId())); } } } diff --git a/src/main/java/com/gmail/nossr50/Leaderboard.java b/src/main/java/com/gmail/nossr50/Leaderboard.java index 8e1b457a3..5aec88256 100644 --- a/src/main/java/com/gmail/nossr50/Leaderboard.java +++ b/src/main/java/com/gmail/nossr50/Leaderboard.java @@ -255,7 +255,7 @@ public class Leaderboard { * @param skillType Skill whose leaderboard is being updated. */ public static void updateLeaderboard(PlayerStat ps, SkillType skillType) { - if (Config.getUseMySQL()) { + if (Config.getInstance().getUseMySQL()) { return; } diff --git a/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java index 6f192d5cf..a2b1ffd02 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java @@ -42,7 +42,7 @@ public class MmoupdateCommand implements CommandExecutor { * Convert FlatFile data to MySQL data. */ private void convertToMySQL() { - if (!Config.getUseMySQL()) { + if (!Config.getInstance().getUseMySQL()) { return; } diff --git a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java index ae5c1afe0..591b5dce1 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java @@ -13,7 +13,7 @@ import com.gmail.nossr50.locale.mcLocale; public class XprateCommand implements CommandExecutor { private final mcMMO plugin; - private static int oldrate = Config.xpGainMultiplier; + private static int oldrate = Config.getInstance().xpGainMultiplier; public static boolean xpevent = false; public XprateCommand (mcMMO plugin) { @@ -39,10 +39,10 @@ public class XprateCommand implements CommandExecutor { } xpevent = !xpevent; - Config.xpGainMultiplier = oldrate; + Config.getInstance().xpGainMultiplier = oldrate; } else { - Config.xpGainMultiplier = oldrate; + Config.getInstance().xpGainMultiplier = oldrate; } } else if (m.isInt(args[0])) { @@ -56,7 +56,7 @@ public class XprateCommand implements CommandExecutor { case 2: if (m.isInt(args[0])) { - oldrate = Config.xpGainMultiplier; + oldrate = Config.getInstance().xpGainMultiplier; if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) { xpevent = Boolean.valueOf(args[1]); @@ -65,16 +65,16 @@ public class XprateCommand implements CommandExecutor { sender.sendMessage(usage3); } - Config.xpGainMultiplier = m.getInt(args[0]); + Config.getInstance().xpGainMultiplier = m.getInt(args[0]); if (xpevent) { for (Player x : plugin.getServer().getOnlinePlayers()) { x.sendMessage(mcLocale.getString("Commands.xprate.started.0")); - x.sendMessage(mcLocale.getString("Commands.xprate.started.1", new Object[] {Config.xpGainMultiplier})); + x.sendMessage(mcLocale.getString("Commands.xprate.started.1", new Object[] {Config.getInstance().xpGainMultiplier})); } } else { - sender.sendMessage("The XP RATE was modified to " + Config.xpGainMultiplier); //TODO: Locale + sender.sendMessage("The XP RATE was modified to " + Config.getInstance().xpGainMultiplier); //TODO: Locale } } else { diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java index fc3593c8c..87ec712ca 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java @@ -18,8 +18,8 @@ public class McmmoCommand implements CommandExecutor { String[] mcSplit = description.split(","); sender.sendMessage(mcSplit); - if (Config.getDonateMessageEnabled()) { - if (Config.spoutEnabled && sender instanceof SpoutPlayer) { + if (Config.getInstance().getDonateMessageEnabled()) { + if (Config.getInstance().spoutEnabled && sender instanceof SpoutPlayer) { SpoutPlayer sPlayer = (SpoutPlayer) sender; sPlayer.sendNotification(ChatColor.YELLOW + "[mcMMO]" + ChatColor.GOLD + " Donate!", ChatColor.GREEN + "nossr50@gmail.com", Material.DIAMOND); diff --git a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java index 89728bb0f..232ccc6be 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -27,8 +27,8 @@ public class McremoveCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String playerName; - String tablePrefix = Config.getMySQLTablePrefix(); - String databaseName = Config.getMySQLDatabaseName(); + String tablePrefix = Config.getInstance().getMySQLTablePrefix(); + String databaseName = Config.getInstance().getMySQLDatabaseName(); String usage = ChatColor.RED + "Proper usage is /mcremove "; //TODO: Needs more locale. String success; @@ -48,7 +48,7 @@ public class McremoveCommand implements CommandExecutor { } /* MySQL */ - if (Config.getUseMySQL()) { + if (Config.getInstance().getUseMySQL()) { int userId = 0; userId = mcMMO.database.getInt("SELECT id FROM " + tablePrefix + "users WHERE user = '" + playerName + "'"); diff --git a/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java index f80eb2694..b078adf53 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java @@ -20,7 +20,7 @@ public class MctopCommand implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String usage = ChatColor.RED + "Proper usage is /mctop [skill] [page]"; //TODO: Needs more locale. - if (!Config.getUseMySQL()) { + if (!Config.getInstance().getUseMySQL()) { switch (args.length) { case 0: @@ -132,7 +132,7 @@ public class MctopCommand implements CommandExecutor { } private void sqlDisplay(int page, String query, CommandSender sender) { - String tablePrefix = Config.getMySQLTablePrefix(); + String tablePrefix = Config.getInstance().getMySQLTablePrefix(); HashMap> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + tablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC "); if (query == "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing") { diff --git a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java index 3d3fcdc02..daf493b3b 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java @@ -44,8 +44,8 @@ public class PtpCommand implements CommandExecutor { return true; } - if (PP.getRecentlyHurt() + (Config.getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) { - player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.getPTPCommandCooldown() })); + if (PP.getRecentlyHurt() + (Config.getInstance().getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) { + player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.getInstance().getPTPCommandCooldown() })); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 0bcffbcae..5c84dcfb4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -45,7 +45,7 @@ public class RepairCommand implements CommandExecutor { player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.0"), mcLocale.getString("Repair.Effect.1") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.2"), mcLocale.getString("Repair.Effect.3") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.4"), mcLocale.getString("Repair.Effect.5") })); - player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.getRepairDiamondLevelRequirement() }), mcLocale.getString("Repair.Effect.7") })); + player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.getInstance().getRepairDiamondLevelRequirement() }), mcLocale.getString("Repair.Effect.7") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.8"), mcLocale.getString("Repair.Effect.9") })); player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 16bc4c0fd..4207668d4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -46,8 +46,8 @@ public class TamingCommand implements CommandExecutor { player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.10"), mcLocale.getString("Taming.Effect.11") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.12"), mcLocale.getString("Taming.Effect.13") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.16"), mcLocale.getString("Taming.Effect.17") })); - player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.getTamingCOTWOcelotCost() })); - player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.getTamingCOTWWolfCost() })); + player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() })); + player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() })); player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") })); diff --git a/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java b/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java index cfe576fac..1bce40301 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java @@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor { return true; } - if (!Config.spoutEnabled || !Config.getSpoutXPBarEnabled()) { + if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled()) { sender.sendMessage(mcLocale.getString("Commands.Disabled")); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java index ab874529c..003d8afc7 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java @@ -26,7 +26,7 @@ public class XplockCommand implements CommandExecutor { return true; } - if (!Config.spoutEnabled || !Config.getSpoutXPBarEnabled() || !Config.getCommandXPLockEnabled()) { + if (!Config.getInstance().spoutEnabled || !Config.getInstance().getSpoutXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) { sender.sendMessage(mcLocale.getString("Commands.Disabled")); return true; } diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 99552d587..7360b25b4 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -5,27 +5,34 @@ import com.gmail.nossr50.datatypes.HUDType; public class Config extends ConfigLoader{ - public static int xpGainMultiplier = 1; + public int xpGainMultiplier = 1; + public static Config instance = null; + + public static Config getInstance() { + if(instance == null) + instance = new Config(mcMMO.p); + return instance; + } /* * GENERAL SETTINGS */ /* General Settings */ - public static String getLocale() { return config.getString("General.Locale", "en_us"); } - public static boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } - public static int getSaveInterval() { return config.getInt("General.Save_Interval", 10); } - public static boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } - public static boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); } + public String getLocale() { return config.getString("General.Locale", "en_us"); } + public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } + public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); } + public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } + public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); } /* mySQL */ - public static boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); } - public static String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); } - public static String getMySQLDatabaseName() { return config.getString("MySQL.Database.Name", "DatabaseName"); } - public static String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead... - public static int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); } - public static String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); } - public static String getMySQLUserPassword() { + public boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); } + public String getMySQLTablePrefix() { return config.getString("MySQL.Database.TablePrefix", "mcmmo_"); } + public String getMySQLDatabaseName() { return config.getString("MySQL.Database.Name", "DatabaseName"); } + public String getMySQLUserName() { return config.getString("MySQL.Database.User_Name", "UserName"); } //Really should be labeled under MySQL.User_Name instead... + public int getMySQLServerPort() { return config.getInt("MySQL.Server.Port", 3306); } + public String getMySQLServerName() { return config.getString("MySQL.Server.Address", "localhost"); } + public String getMySQLUserPassword() { if (config.getString("MySQL.Database.User_Password", null) != null) { return config.getString("MySQL.Database.User_Password", null); } @@ -35,286 +42,286 @@ public class Config extends ConfigLoader{ } /* Commands */ - public static boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); } - public static boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); } - public static boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); } - public static boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); } - public static boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); } - public static boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); } - public static boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); } - public static boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); } - public static boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); } - public static boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); } - public static boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); } - public static boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); } - public static boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); } - public static boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); } - public static boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); } - public static boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); } - public static boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); } - public static boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); } - public static boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); } - public static boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); } + public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); } + public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); } + public boolean getCommandMCTopEnabled() { return config.getBoolean("Commands.mctop.Enabled", true); } + public boolean getCommandAddXPEnabled() { return config.getBoolean("Commands.addxp.Enabled", true); } + public boolean getCommandAddLevelsEnabled() { return config.getBoolean("Commands.addlevels.Enabled", true); } + public boolean getCommandMCAbilityEnabled() { return config.getBoolean("Commands.mcability.Enabled", true); } + public boolean getCommandMCRefreshEnabled() { return config.getBoolean("Commands.mcrefresh.Enabled", true); } + public boolean getCommandmcMMOEnabled() { return config.getBoolean("Commands.mcmmo.Enabled", true); } + public boolean getCommandMCCEnabled() { return config.getBoolean("Commands.mcc.Enabled", true); } + public boolean getCommandMCGodEnabled() { return config.getBoolean("Commands.mcgod.Enabled", true); } + public boolean getCommandMCStatsEnabled() { return config.getBoolean("Commands.mcstats.Enabled", true); } + public boolean getCommandMmoeditEnabled() { return config.getBoolean("Commands.mmoedit.Enabled", true); } + public boolean getCommandMCRemoveEnabled() { return config.getBoolean("Commands.mcremove.Enable", true); } + public boolean getCommandPTPEnabled() { return config.getBoolean("Commands.ptp.Enabled", true); } + public boolean getCommandPartyEnabled() { return config.getBoolean("Commands.party.Enabled", true); } + public boolean getCommandInspectEnabled() { return config.getBoolean("Commands.inspect.Enabled", true); } + public boolean getCommandInviteEnabled() { return config.getBoolean("Commands.invite.Enabled", true); } + public boolean getCommandAcceptEnabled() { return config.getBoolean("Commands.accept.Enabled", true); } + public boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); } + public boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); } - public static int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); } - public static boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); } + public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); } + public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); } /* Items */ - public static int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); } - public static int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); } - public static boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); } + public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); } + public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); } + public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); } /* * ABILITY SETTINGS */ /* General Settings */ - public static boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); } - public static boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); } - public static boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); } + public boolean getAbilityMessagesEnabled() { return config.getBoolean("Abilities.Messages", true); } + public boolean getAbilitiesEnabled() { return config.getBoolean("Abilities.Enabled", true); } + public boolean getAbilitiesOnlyActivateWhenSneaking() { return config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); } /* Durability Settings */ - public static boolean getAbilitiesDamageTools() { return config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); } - public static int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 2); } + public boolean getAbilitiesDamageTools() { return config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); } + public int getAbilityToolDamage() { return config.getInt("Abilities.Tools.Durability_Loss", 2); } /* Cooldowns */ - public static int getAbilityCooldownGreenTerra() { return config.getInt("Abilities.Cooldowns.Green_Terra", 240); } - public static int getAbilityCooldownSuperBreaker() { return config.getInt("Abilities.Cooldowns.Super_Breaker", 240); } - public static int getAbilityCooldownGigaDrillBreaker() { return config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); } - public static int getAbilityCooldownTreeFeller() { return config.getInt("Abilities.Cooldowns.Tree_Feller", 240); } - public static int getAbilityCooldownBerserk() { return config.getInt("Abilities.Cooldowns.Berserk", 240); } - public static int getAbilityCooldownSerratedStrikes() { return config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); } - public static int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); } - public static int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); } + public int getAbilityCooldownGreenTerra() { return config.getInt("Abilities.Cooldowns.Green_Terra", 240); } + public int getAbilityCooldownSuperBreaker() { return config.getInt("Abilities.Cooldowns.Super_Breaker", 240); } + public int getAbilityCooldownGigaDrillBreaker() { return config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); } + public int getAbilityCooldownTreeFeller() { return config.getInt("Abilities.Cooldowns.Tree_Feller", 240); } + public int getAbilityCooldownBerserk() { return config.getInt("Abilities.Cooldowns.Berserk", 240); } + public int getAbilityCooldownSerratedStrikes() { return config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); } + public int getAbilityCooldownSkullSplitter() { return config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); } + public int getAbilityCooldownBlastMining() { return config.getInt("Abilities.Cooldowns.Blast_Mining", 60); } /* Thresholds */ - public static int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); } + public int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); } /* * SKILL SETTINGS */ /* Tool Requirements */ - public static boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); } - public static boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); } - public static boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); } + public boolean getMiningRequiresTool() { return config.getBoolean("Skills.Mining.Requires_Pickaxe", true); } + public boolean getExcavationRequiresTool() { return config.getBoolean("Skills.Excavation.Requires_Shovel", true); } + public boolean getWoodcuttingRequiresTool() { return config.getBoolean("Skills.Woodcutting.Requires_Axe", true); } /* Excavation */ - public static int getExcavationBaseXP() { return config.getInt("Experience.Excavation.Base", 40); } + public int getExcavationBaseXP() { return config.getInt("Experience.Excavation.Base", 40); } /* Fishing */ - public static int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); } - public static boolean getFishingDropsEnabled() { return config.getBoolean("Fishing.Drops_Enabled", true); } - public static int getFishingTierLevelsTier1() { return config.getInt("Fishing.Tier_Levels.Tier1", 0); } - public static int getFishingTierLevelsTier2() { return config.getInt("Fishing.Tier_Levels.Tier2", 200); } - public static int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); } - public static int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); } - public static int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); } + public int getFishingBaseXP() { return config.getInt("Experience.Fishing.Base", 800); } + public boolean getFishingDropsEnabled() { return config.getBoolean("Fishing.Drops_Enabled", true); } + public int getFishingTierLevelsTier1() { return config.getInt("Fishing.Tier_Levels.Tier1", 0); } + public int getFishingTierLevelsTier2() { return config.getInt("Fishing.Tier_Levels.Tier2", 200); } + public int getFishingTierLevelsTier3() { return config.getInt("Fishing.Tier_Levels.Tier3", 400); } + public int getFishingTierLevelsTier4() { return config.getInt("Fishing.Tier_Levels.Tier4", 600); } + public int getFishingTierLevelsTier5() { return config.getInt("Fishing.Tier_Levels.Tier5", 800); } /* Herbalism */ - public static int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); } - public static int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); } - public static int getHerbalismXPCactus() { return config.getInt("Experience.Herbalism.Cactus", 30); } - public static int getHerbalismXPPumpkin() { return config.getInt("Experience.Herbalism.Pumpkin", 20); } - public static int getHerbalismXPFlowers() { return config.getInt("Experience.Herbalism.Flowers", 100); } - public static int getHerbalismXPMushrooms() { return config.getInt("Experience.Herbalism.Mushrooms", 150); } - public static int getHerbalismXPMelon() { return config.getInt("Experience.Herbalism.Melon", 20); } - public static int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); } - public static int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); } - public static int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); } - public static boolean getHerbalismHungerBonusEnabled() { return config.getBoolean("Skills.Herbalism.Hunger_Bonus", true); } - public static boolean getHerbalismWheatRegrowth() { return config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true); } - public static boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); } - public static boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); } - public static boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); } + public int getHerbalismXPSugarCane() { return config.getInt("Experience.Herbalism.Sugar_Cane", 30); } + public int getHerbalismXPWheat() { return config.getInt("Experience.Herbalism.Wheat", 50); } + public int getHerbalismXPCactus() { return config.getInt("Experience.Herbalism.Cactus", 30); } + public int getHerbalismXPPumpkin() { return config.getInt("Experience.Herbalism.Pumpkin", 20); } + public int getHerbalismXPFlowers() { return config.getInt("Experience.Herbalism.Flowers", 100); } + public int getHerbalismXPMushrooms() { return config.getInt("Experience.Herbalism.Mushrooms", 150); } + public int getHerbalismXPMelon() { return config.getInt("Experience.Herbalism.Melon", 20); } + public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); } + public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); } + public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); } + public boolean getHerbalismHungerBonusEnabled() { return config.getBoolean("Skills.Herbalism.Hunger_Bonus", true); } + public boolean getHerbalismWheatRegrowth() { return config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true); } + public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); } + public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); } + public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); } /* Mining */ - public static int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); } - public static int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); } - public static int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); } - public static int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); } - public static int getMiningXPLapisOre() { return config.getInt("Experience.Mining.Lapis", 400); } - public static int getMiningXPObsidian() { return config.getInt("Experience.Mining.Obsidian", 150); } - public static int getMiningXPNetherrack() { return config.getInt("Experience.Mining.Netherrack", 30); } - public static int getMiningXPGlowstone() { return config.getInt("Experience.Mining.Glowstone", 30); } - public static int getMiningXPCoalOre() { return config.getInt("Experience.Mining.Coal", 100); } - public static int getMiningXPStone() { return config.getInt("Experience.Mining.Stone", 30); } - public static int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); } - public static int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); } - public static int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); } + public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); } + public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); } + public int getMiningXPIronOre() { return config.getInt("Experience.Mining.Iron", 250); } + public int getMiningXPRedstoneOre() { return config.getInt("Experience.Mining.Redstone", 150); } + public int getMiningXPLapisOre() { return config.getInt("Experience.Mining.Lapis", 400); } + public int getMiningXPObsidian() { return config.getInt("Experience.Mining.Obsidian", 150); } + public int getMiningXPNetherrack() { return config.getInt("Experience.Mining.Netherrack", 30); } + public int getMiningXPGlowstone() { return config.getInt("Experience.Mining.Glowstone", 30); } + public int getMiningXPCoalOre() { return config.getInt("Experience.Mining.Coal", 100); } + public int getMiningXPStone() { return config.getInt("Experience.Mining.Stone", 30); } + public int getMiningXPSandstone() { return config.getInt("Experience.Mining.Sandstone", 30); } + public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); } + public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); } - public static int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); } + public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); } /* Repair */ - public static boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); } - public static int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); } + public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); } + public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); } - public static int getRepairGoldMaterial() { return config.getInt("Skills.Repair.Gold.ID", 266); } - public static int getRepairStoneMaterial() { return config.getInt("Skills.Repair.Stone.ID", 4); } - public static int getRepairWoodMaterial() { return config.getInt("Skills.Repair.Wood.ID", 5); } - public static int getRepairDiamondMaterial() { return config.getInt("Skills.Repair.Diamond.ID", 264); } - public static int getRepairIronMaterial() { return config.getInt("Skills.Repair.Iron.ID", 265); } - public static int getRepairStringMaterial() { return config.getInt("Skills.Repair.String.ID", 287); } - public static int getRepairLeatherMaterial() { return config.getInt("Skills.Repair.Leather.ID", 334); } + public int getRepairGoldMaterial() { return config.getInt("Skills.Repair.Gold.ID", 266); } + public int getRepairStoneMaterial() { return config.getInt("Skills.Repair.Stone.ID", 4); } + public int getRepairWoodMaterial() { return config.getInt("Skills.Repair.Wood.ID", 5); } + public int getRepairDiamondMaterial() { return config.getInt("Skills.Repair.Diamond.ID", 264); } + public int getRepairIronMaterial() { return config.getInt("Skills.Repair.Iron.ID", 265); } + public int getRepairStringMaterial() { return config.getInt("Skills.Repair.String.ID", 287); } + public int getRepairLeatherMaterial() { return config.getInt("Skills.Repair.Leather.ID", 334); } - public static boolean getRepairArmorAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Armor", true); } - public static boolean getRepairToolsAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Tools", true); } - public static int getRepairDiamondLevelRequirement() { return config.getInt("Skills.Repair.Diamond.Level_Required", 50); } - public static int getRepairIronLevelRequirement() { return config.getInt("Skills.Repair.Iron.Level_Required", 0); } - public static int getRepairGoldLevelRequirement() { return config.getInt("Skills.Repair.Gold.Level_Required", 0); } - public static int getRepairStoneLevelRequirement() { return config.getInt("Skills.Repair.Stone.Level_Required", 0); } - public static int getRepairStringLevelRequirement() { return config.getInt("Skills.Repair.String.Level_Required", 0); } + public boolean getRepairArmorAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Armor", true); } + public boolean getRepairToolsAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Tools", true); } + public int getRepairDiamondLevelRequirement() { return config.getInt("Skills.Repair.Diamond.Level_Required", 50); } + public int getRepairIronLevelRequirement() { return config.getInt("Skills.Repair.Iron.Level_Required", 0); } + public int getRepairGoldLevelRequirement() { return config.getInt("Skills.Repair.Gold.Level_Required", 0); } + public int getRepairStoneLevelRequirement() { return config.getInt("Skills.Repair.Stone.Level_Required", 0); } + public int getRepairStringLevelRequirement() { return config.getInt("Skills.Repair.String.Level_Required", 0); } /* Taming */ - public static int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); } - public static int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); } - public static int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); } - public static int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); } + public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); } + public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); } + public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); } + public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); } /* Woodcutting */ - public static int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); } - public static int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); } - public static int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); } - public static int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); } + public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); } + public int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); } + public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); } + public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); } /* Arcane Forging */ - public static boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); } - public static int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); } - public static int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); } - public static int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); } - public static int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); } - public static boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); } - public static int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); } - public static int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); } - public static int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); } - public static int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); } - public static int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); } - public static int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); } - public static int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); } - public static int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); } + public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); } + public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); } + public int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); } + public int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); } + public int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); } + public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); } + public int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); } + public int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); } + public int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); } + public int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); } + public int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); } + public int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); } + public int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); } + public int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); } /* Level Caps */ - public static int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); } - public static int getLevelCapArchery() { return config.getInt("Skills.Archery.Level_Cap", 0); } - public static int getLevelCapAxes() { return config.getInt("Skills.Axes.Level_Cap", 0); } - public static int getLevelCapExcavation() { return config.getInt("Skills.Excavation.Level_Cap", 0); } - public static int getLevelCapFishing() { return config.getInt("Skills.Fishing.Level_Cap", 0); } - public static int getLevelCapHerbalism() { return config.getInt("Skills.Herbalism.Level_Cap", 0); } - public static int getLevelCapMining() { return config.getInt("Skills.Mining.Level_Cap", 0); } - public static int getLevelCapRepair() { return config.getInt("Skills.Repair.Level_Cap", 0); } - public static int getLevelCapSwords() { return config.getInt("Skills.Swords.Level_Cap", 0); } - public static int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); } - public static int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); } - public static int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); } - public static int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); } + public int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); } + public int getLevelCapArchery() { return config.getInt("Skills.Archery.Level_Cap", 0); } + public int getLevelCapAxes() { return config.getInt("Skills.Axes.Level_Cap", 0); } + public int getLevelCapExcavation() { return config.getInt("Skills.Excavation.Level_Cap", 0); } + public int getLevelCapFishing() { return config.getInt("Skills.Fishing.Level_Cap", 0); } + public int getLevelCapHerbalism() { return config.getInt("Skills.Herbalism.Level_Cap", 0); } + public int getLevelCapMining() { return config.getInt("Skills.Mining.Level_Cap", 0); } + public int getLevelCapRepair() { return config.getInt("Skills.Repair.Level_Cap", 0); } + public int getLevelCapSwords() { return config.getInt("Skills.Swords.Level_Cap", 0); } + public int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); } + public int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); } + public int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); } + public int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); } /* * XP SETTINGS */ /* General Settings */ - public static boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); } - public static boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); } - public static int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); } + public boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); } + public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); } + public int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); } /* Combat XP Multipliers */ - public static double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); } + public double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); } - public static double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); } - public static double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); } - public static double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); } - public static double getSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); } - public static double getGhastXP() { return config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); } - public static double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); } - public static double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); } - public static double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); } - public static double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); } - public static double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); } - public static double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); } - public static double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); } - public static double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); } - public static double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); } - public static double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); } + public double getAnimalsXP() { return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); } + public double getCreeperXP() { return config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); } + public double getSkeletonXP() { return config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); } + public double getSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); } + public double getGhastXP() { return config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); } + public double getSlimeXP() { return config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); } + public double getZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); } + public double getPigZombieXP() { return config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); } + public double getEndermanXP() { return config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); } + public double getCaveSpiderXP() { return config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); } + public double getSilverfishXP() { return config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); } + public double getBlazeXP() { return config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); } + public double getMagmaCubeXP() { return config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); } + public double getEnderDragonXP() { return config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); } + public double getIronGolemXP() { return config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); } /* XP Formula Multiplier */ - public static double getFormulaMultiplierTaming() { return config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); } - public static double getFormulaMultiplierMining() { return config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); } - public static double getFormulaMultiplierRepair() { return config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); } - public static double getFormulaMultiplierWoodcutting() { return config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); } - public static double getFormulaMultiplierUnarmed() { return config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); } - public static double getFormulaMultiplierHerbalism() { return config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); } - public static double getFormulaMultiplierExcavation() { return config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); } - public static double getFormulaMultiplierArchery() { return config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); } - public static double getFormulaMultiplierSwords() { return config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); } - public static double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); } - public static double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); } - public static double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); } + public double getFormulaMultiplierTaming() { return config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); } + public double getFormulaMultiplierMining() { return config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); } + public double getFormulaMultiplierRepair() { return config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); } + public double getFormulaMultiplierWoodcutting() { return config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); } + public double getFormulaMultiplierUnarmed() { return config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); } + public double getFormulaMultiplierHerbalism() { return config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); } + public double getFormulaMultiplierExcavation() { return config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); } + public double getFormulaMultiplierArchery() { return config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); } + public double getFormulaMultiplierSwords() { return config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); } + public double getFormulaMultiplierAxes() { return config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); } + public double getFormulaMultiplierAcrobatics() { return config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); } + public double getFormulaMultiplierFishing() { return config.getDouble("Experience.Formula.Multiplier.Fishing", 1.0); } /* * SPOUT SETTINGS */ - public static boolean spoutEnabled; - public static boolean getShowPowerLevelForSpout() { return config.getBoolean("Spout.HUD.Show_Power_Level", true); } + public boolean spoutEnabled; + public boolean getShowPowerLevelForSpout() { return config.getBoolean("Spout.HUD.Show_Power_Level", true); } /* Spout XP Bar */ - public static boolean getSpoutXPBarEnabled() { return config.getBoolean("Spout.XP.Bar.Enabled", true); } - public static boolean getSpoutXPBarIconEnabled() { return config.getBoolean("Spout.XP.Icon.Enabled", true); } - public static int getSpoutXPBarXPosition() { return config.getInt("Spout.XP.Bar.X_POS", 95); } - public static int getSpoutXPBarYPosition() { return config.getInt("Spout.XP.Bar.Y_POS", 6); } - public static int getSpoutXPIconXPosition() { return config.getInt("Spout.XP.Icon.X_POS", 78); } - public static int getSpoutXPIconYPosition() { return config.getInt("Spout.XP.Icon.Y_POS", 2); } + public boolean getSpoutXPBarEnabled() { return config.getBoolean("Spout.XP.Bar.Enabled", true); } + public boolean getSpoutXPBarIconEnabled() { return config.getBoolean("Spout.XP.Icon.Enabled", true); } + public int getSpoutXPBarXPosition() { return config.getInt("Spout.XP.Bar.X_POS", 95); } + public int getSpoutXPBarYPosition() { return config.getInt("Spout.XP.Bar.Y_POS", 6); } + public int getSpoutXPIconXPosition() { return config.getInt("Spout.XP.Icon.X_POS", 78); } + public int getSpoutXPIconYPosition() { return config.getInt("Spout.XP.Icon.Y_POS", 2); } /* Spout HUD Colors */ - public static double getSpoutRetroHUDXPBorderRed() { return config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); } - public static double getSpoutRetroHUDXPBorderGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); } - public static double getSpoutRetroHUDXPBorderBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); } - public static double getSpoutRetroHUDXPBackgroundRed() { return config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); } - public static double getSpoutRetroHUDXPBackgroundGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); } - public static double getSpoutRetroHUDXPBackgroundBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); } + public double getSpoutRetroHUDXPBorderRed() { return config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); } + public double getSpoutRetroHUDXPBorderGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); } + public double getSpoutRetroHUDXPBorderBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); } + public double getSpoutRetroHUDXPBackgroundRed() { return config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); } + public double getSpoutRetroHUDXPBackgroundGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); } + public double getSpoutRetroHUDXPBackgroundBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); } - public static double getSpoutRetroHUDAcrobaticsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); } - public static double getSpoutRetroHUDAcrobaticsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); } - public static double getSpoutRetroHUDAcrobaticsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); } - public static double getSpoutRetroHUDArcheryRed() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); } - public static double getSpoutRetroHUDArcheryGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); } - public static double getSpoutRetroHUDArcheryBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); } - public static double getSpoutRetroHUDAxesRed() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); } - public static double getSpoutRetroHUDAxesGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); } - public static double getSpoutRetroHUDAxesBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); } - public static double getSpoutRetroHUDExcavationRed() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); } - public static double getSpoutRetroHUDExcavationGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); } - public static double getSpoutRetroHUDExcavationBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); } - public static double getSpoutRetroHUDHerbalismRed() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); } - public static double getSpoutRetroHUDHerbalismGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); } - public static double getSpoutRetroHUDHerbalismBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); } - public static double getSpoutRetroHUDMiningRed() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); } - public static double getSpoutRetroHUDMiningGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); } - public static double getSpoutRetroHUDMiningBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); } - public static double getSpoutRetroHUDRepairRed() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); } - public static double getSpoutRetroHUDRepairGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); } - public static double getSpoutRetroHUDRepairBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); } - public static double getSpoutRetroHUDSwordsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); } - public static double getSpoutRetroHUDSwordsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); } - public static double getSpoutRetroHUDSwordsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); } - public static double getSpoutRetroHUDTamingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); } - public static double getSpoutRetroHUDTamingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); } - public static double getSpoutRetroHUDTamingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); } - public static double getSpoutRetroHUDUnarmedRed() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); } - public static double getSpoutRetroHUDUnarmedGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); } - public static double getSpoutRetroHUDUnarmedBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); } - public static double getSpoutRetroHUDWoodcuttingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); } - public static double getSpoutRetroHUDWoodcuttingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); } - public static double getSpoutRetroHUDWoodcuttingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); } - public static double getSpoutRetroHUDFishingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); } - public static double getSpoutRetroHUDFishingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); } - public static double getSpoutRetroHUDFishingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); } + public double getSpoutRetroHUDAcrobaticsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); } + public double getSpoutRetroHUDAcrobaticsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); } + public double getSpoutRetroHUDAcrobaticsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); } + public double getSpoutRetroHUDArcheryRed() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); } + public double getSpoutRetroHUDArcheryGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); } + public double getSpoutRetroHUDArcheryBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); } + public double getSpoutRetroHUDAxesRed() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); } + public double getSpoutRetroHUDAxesGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); } + public double getSpoutRetroHUDAxesBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); } + public double getSpoutRetroHUDExcavationRed() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); } + public double getSpoutRetroHUDExcavationGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); } + public double getSpoutRetroHUDExcavationBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); } + public double getSpoutRetroHUDHerbalismRed() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); } + public double getSpoutRetroHUDHerbalismGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); } + public double getSpoutRetroHUDHerbalismBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); } + public double getSpoutRetroHUDMiningRed() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); } + public double getSpoutRetroHUDMiningGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); } + public double getSpoutRetroHUDMiningBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); } + public double getSpoutRetroHUDRepairRed() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); } + public double getSpoutRetroHUDRepairGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); } + public double getSpoutRetroHUDRepairBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); } + public double getSpoutRetroHUDSwordsRed() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); } + public double getSpoutRetroHUDSwordsGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); } + public double getSpoutRetroHUDSwordsBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); } + public double getSpoutRetroHUDTamingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); } + public double getSpoutRetroHUDTamingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); } + public double getSpoutRetroHUDTamingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); } + public double getSpoutRetroHUDUnarmedRed() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); } + public double getSpoutRetroHUDUnarmedGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); } + public double getSpoutRetroHUDUnarmedBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); } + public double getSpoutRetroHUDWoodcuttingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); } + public double getSpoutRetroHUDWoodcuttingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); } + public double getSpoutRetroHUDWoodcuttingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); } + public double getSpoutRetroHUDFishingRed() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); } + public double getSpoutRetroHUDFishingGreen() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); } + public double getSpoutRetroHUDFishingBlue() { return config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); } /* * CONFIG LOADING */ - public static HUDType defaulthud; + public HUDType defaulthud; public Config(mcMMO plugin) { super(plugin, "config.yml"); diff --git a/src/main/java/com/gmail/nossr50/config/LoadTreasures.java b/src/main/java/com/gmail/nossr50/config/LoadTreasures.java index f756bd186..492840677 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadTreasures.java +++ b/src/main/java/com/gmail/nossr50/config/LoadTreasures.java @@ -212,23 +212,23 @@ public class LoadTreasures extends ConfigLoader{ int dropLevel = fTreasure.getDropLevel(); int maxLevel = fTreasure.getMaxLevel(); - if(dropLevel <= Config.getFishingTierLevelsTier1() && maxLevel >= Config.getFishingTierLevelsTier1()) { + if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) { fishingRewardsTier1.add(fTreasure); } - if(dropLevel <= Config.getFishingTierLevelsTier2() && maxLevel >= Config.getFishingTierLevelsTier2()) { + if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) { fishingRewardsTier2.add(fTreasure); } - if (dropLevel <= Config.getFishingTierLevelsTier3() && maxLevel >= Config.getFishingTierLevelsTier3()) { + if (dropLevel <= Config.getInstance().getFishingTierLevelsTier3() && maxLevel >= Config.getInstance().getFishingTierLevelsTier3()) { fishingRewardsTier3.add(fTreasure); } - if (dropLevel <= Config.getFishingTierLevelsTier4() && maxLevel >= Config.getFishingTierLevelsTier4()) { + if (dropLevel <= Config.getInstance().getFishingTierLevelsTier4() && maxLevel >= Config.getInstance().getFishingTierLevelsTier4()) { fishingRewardsTier4.add(fTreasure); } - if (dropLevel <= Config.getFishingTierLevelsTier5() && maxLevel >= Config.getFishingTierLevelsTier5()) { + if (dropLevel <= Config.getInstance().getFishingTierLevelsTier5() && maxLevel >= Config.getInstance().getFishingTierLevelsTier5()) { fishingRewardsTier5.add(fTreasure); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java index 7c081628b..1debed68e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java @@ -12,7 +12,7 @@ import com.gmail.nossr50.skills.Mining; public enum AbilityType { BERSERK( - Config.getAbilityCooldownBerserk(), + Config.getInstance().getAbilityCooldownBerserk(), "Unarmed.Skills.Berserk.On", "Unarmed.Skills.Berserk.Off", "Unarmed.Skills.Berserk.Other.On", @@ -20,7 +20,7 @@ public enum AbilityType { "Unarmed.Skills.Berserk.Other.Off"), SUPER_BREAKER( - Config.getAbilityCooldownSuperBreaker(), + Config.getInstance().getAbilityCooldownSuperBreaker(), "Mining.Skills.SuperBreaker.On", "Mining.Skills.SuperBreaker.Off", "Mining.Skills.SuperBreaker.Other.On", @@ -28,7 +28,7 @@ public enum AbilityType { "Mining.Skills.SuperBreaker.Other.Off"), GIGA_DRILL_BREAKER( - Config.getAbilityCooldownGigaDrillBreaker(), + Config.getInstance().getAbilityCooldownGigaDrillBreaker(), "Excavation.Skills.GigaDrillBreaker.On", "Excavation.Skills.GigaDrillBreaker.Off", "Excavation.Skills.GigaDrillBreaker.Other.On", @@ -36,7 +36,7 @@ public enum AbilityType { "Excavation.Skills.GigaDrillBreaker.Other.Off"), GREEN_TERRA( - Config.getAbilityCooldownGreenTerra(), + Config.getInstance().getAbilityCooldownGreenTerra(), "Herbalism.Skills.GTe.On", "Herbalism.Skills.GTe.Off", "Herbalism.Skills.GTe.Other.On", @@ -44,7 +44,7 @@ public enum AbilityType { "Herbalism.Skills.GTe.Other.Off"), SKULL_SPLIITER( - Config.getAbilityCooldownSkullSplitter(), + Config.getInstance().getAbilityCooldownSkullSplitter(), "Axes.Skills.SS.On", "Axes.Skills.SS.Off", "Axes.Skills.SS.Other.On", @@ -52,7 +52,7 @@ public enum AbilityType { "Axes.Skills.SS.Other.Off"), TREE_FELLER( - Config.getAbilityCooldownTreeFeller(), + Config.getInstance().getAbilityCooldownTreeFeller(), "Woodcutting.Skills.TreeFeller.On", "Woodcutting.Skills.TreeFeller.Off", "Woodcutting.Skills.TreeFeller.Other.On", @@ -60,7 +60,7 @@ public enum AbilityType { "Woodcutting.Skills.TreeFeller.Other.Off"), SERRATED_STRIKES( - Config.getAbilityCooldownSerratedStrikes(), + Config.getInstance().getAbilityCooldownSerratedStrikes(), "Swords.Skills.SS.On", "Swords.Skills.SS.Off", "Swords.Skills.SS.Other.On", @@ -68,7 +68,7 @@ public enum AbilityType { "Swords.Skills.SS.Other.Off"), BLAST_MINING( - Config.getAbilityCooldownBlastMining(), + Config.getInstance().getAbilityCooldownBlastMining(), null, null, "Mining.Blast.Other.On", diff --git a/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java b/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java index 29bd3274e..da29a3ba5 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java +++ b/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java @@ -119,9 +119,9 @@ public class HUDmmo { * @param sPlayer Player to initialize XP bar for */ private void initializeXpBarDisplayRetro(SpoutPlayer sPlayer) { - Color border = new Color((float) Config.getSpoutRetroHUDXPBorderRed(), (float) Config.getSpoutRetroHUDXPBorderGreen(), (float) Config.getSpoutRetroHUDXPBorderBlue(), 1f); + Color border = new Color((float) Config.getInstance().getSpoutRetroHUDXPBorderRed(), (float) Config.getInstance().getSpoutRetroHUDXPBorderGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBorderBlue(), 1f); Color green = new Color(0f, 1f, 0f, 1f); - Color background = new Color((float) Config.getSpoutRetroHUDXPBackgroundRed(), (float) Config.getSpoutRetroHUDXPBackgroundGreen(), (float) Config.getSpoutRetroHUDXPBackgroundBlue(), 1f); + Color background = new Color((float) Config.getInstance().getSpoutRetroHUDXPBackgroundRed(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundGreen(), (float) Config.getInstance().getSpoutRetroHUDXPBackgroundBlue(), 1f); Color darkbg = new Color(0.2f, 0.2f, 0.2f, 1f); xpicon = new GenericTexture(); @@ -185,12 +185,12 @@ public class HUDmmo { xpbg.setPriority(RenderPriority.Low); xpbg.setDirty(true); - if (Config.getSpoutXPBarEnabled()) { + if (Config.getInstance().getSpoutXPBarEnabled()) { sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpfill); sPlayer.getMainScreen().attachWidget(plugin, xpbg); - if (Config.getSpoutXPBarIconEnabled()) { + if (Config.getInstance().getSpoutXPBarIconEnabled()) { sPlayer.getMainScreen().attachWidget(plugin, xpicon); sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg); sPlayer.getMainScreen().attachWidget(plugin, xpicon_border); @@ -206,26 +206,26 @@ public class HUDmmo { * @param sPlayer Player to initialize XP bar for */ public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) { - if (Config.getSpoutXPBarEnabled()) { + if (Config.getInstance().getSpoutXPBarEnabled()) { xpbar = new GenericTexture(); ((GenericTexture) xpbar).setUrl("xpbar_inc000.png"); - xpbar.setX(Config.getSpoutXPBarXPosition()); - xpbar.setY(Config.getSpoutXPBarYPosition()); + xpbar.setX(Config.getInstance().getSpoutXPBarXPosition()); + xpbar.setY(Config.getInstance().getSpoutXPBarYPosition()); xpbar.setHeight(8); xpbar.setWidth(256); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (Config.getSpoutXPBarIconEnabled()) { + if (Config.getInstance().getSpoutXPBarIconEnabled()) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(16); xpicon.setWidth(32); - xpicon.setX(Config.getSpoutXPIconXPosition()); - xpicon.setY(Config.getSpoutXPIconYPosition()); + xpicon.setX(Config.getInstance().getSpoutXPIconXPosition()); + xpicon.setY(Config.getInstance().getSpoutXPIconYPosition()); xpicon.setDirty(true); sPlayer.getMainScreen().attachWidget(plugin, xpicon); @@ -241,25 +241,25 @@ public class HUDmmo { * @param sPlayer Player to initialize XP bar for */ private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) { - if (Config.getSpoutXPBarEnabled()) { + if (Config.getInstance().getSpoutXPBarEnabled()) { xpbar = new GenericTexture(); ((GenericTexture)xpbar).setUrl("xpbar_inc000.png"); xpbar.setX(center_x - 64); - xpbar.setY(Config.getSpoutXPBarYPosition()); + xpbar.setY(Config.getInstance().getSpoutXPBarYPosition()); xpbar.setHeight(4); xpbar.setWidth(128); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (Config.getSpoutXPBarIconEnabled()) { + if (Config.getInstance().getSpoutXPBarIconEnabled()) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(8); xpicon.setWidth(16); xpicon.setX(center_x - (8 + 64)); - xpicon.setY(Config.getSpoutXPIconYPosition() + 2); + xpicon.setY(Config.getInstance().getSpoutXPIconYPosition() + 2); xpicon.setDirty(true); sPlayer.getMainScreen().attachWidget(plugin, xpicon); @@ -276,7 +276,7 @@ public class HUDmmo { * @param PP Profile of the given player */ private void updateXpBarStandard(Player player, PlayerProfile PP) { - if (!Config.getSpoutXPBarEnabled()) { + if (!Config.getInstance().getSpoutXPBarEnabled()) { return; } @@ -302,7 +302,7 @@ public class HUDmmo { * @param PP Profile of the given player */ private void updateXpBarRetro(Player player, PlayerProfile PP) { - if (!Config.getSpoutXPBarEnabled()) { + if (!Config.getInstance().getSpoutXPBarEnabled()) { return; } @@ -327,40 +327,40 @@ public class HUDmmo { private static Color getRetroColor(SkillType type) { switch (type) { case ACROBATICS: - return new Color((float) Config.getSpoutRetroHUDAcrobaticsRed(), (float) Config.getSpoutRetroHUDAcrobaticsGreen(), (float) Config.getSpoutRetroHUDAcrobaticsBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDAcrobaticsRed(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsGreen(), (float) Config.getInstance().getSpoutRetroHUDAcrobaticsBlue(), 1f); case ARCHERY: - return new Color((float) Config.getSpoutRetroHUDArcheryRed(), (float) Config.getSpoutRetroHUDArcheryGreen(), (float) Config.getSpoutRetroHUDArcheryBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDArcheryRed(), (float) Config.getInstance().getSpoutRetroHUDArcheryGreen(), (float) Config.getInstance().getSpoutRetroHUDArcheryBlue(), 1f); case AXES: - return new Color((float) Config.getSpoutRetroHUDAxesRed(), (float) Config.getSpoutRetroHUDAxesGreen(), (float) Config.getSpoutRetroHUDAxesBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDAxesRed(), (float) Config.getInstance().getSpoutRetroHUDAxesGreen(), (float) Config.getInstance().getSpoutRetroHUDAxesBlue(), 1f); case EXCAVATION: - return new Color((float) Config.getSpoutRetroHUDExcavationRed(), (float) Config.getSpoutRetroHUDExcavationGreen(), (float) Config.getSpoutRetroHUDExcavationBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDExcavationRed(), (float) Config.getInstance().getSpoutRetroHUDExcavationGreen(), (float) Config.getInstance().getSpoutRetroHUDExcavationBlue(), 1f); case HERBALISM: - return new Color((float) Config.getSpoutRetroHUDHerbalismRed(), (float) Config.getSpoutRetroHUDHerbalismGreen(), (float) Config.getSpoutRetroHUDHerbalismBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDHerbalismRed(), (float) Config.getInstance().getSpoutRetroHUDHerbalismGreen(), (float) Config.getInstance().getSpoutRetroHUDHerbalismBlue(), 1f); case MINING: - return new Color((float) Config.getSpoutRetroHUDMiningRed(), (float) Config.getSpoutRetroHUDMiningGreen(), (float) Config.getSpoutRetroHUDMiningBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDMiningRed(), (float) Config.getInstance().getSpoutRetroHUDMiningGreen(), (float) Config.getInstance().getSpoutRetroHUDMiningBlue(), 1f); case REPAIR: - return new Color((float) Config.getSpoutRetroHUDRepairRed(), (float) Config.getSpoutRetroHUDRepairGreen(), (float) Config.getSpoutRetroHUDRepairBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDRepairRed(), (float) Config.getInstance().getSpoutRetroHUDRepairGreen(), (float) Config.getInstance().getSpoutRetroHUDRepairBlue(), 1f); case SWORDS: - return new Color((float) Config.getSpoutRetroHUDSwordsRed(), (float) Config.getSpoutRetroHUDSwordsGreen(), (float) Config.getSpoutRetroHUDSwordsBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDSwordsRed(), (float) Config.getInstance().getSpoutRetroHUDSwordsGreen(), (float) Config.getInstance().getSpoutRetroHUDSwordsBlue(), 1f); case TAMING: - return new Color((float) Config.getSpoutRetroHUDTamingRed(), (float) Config.getSpoutRetroHUDTamingGreen(), (float) Config.getSpoutRetroHUDTamingBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDTamingRed(), (float) Config.getInstance().getSpoutRetroHUDTamingGreen(), (float) Config.getInstance().getSpoutRetroHUDTamingBlue(), 1f); case UNARMED: - return new Color((float) Config.getSpoutRetroHUDUnarmedRed(), (float) Config.getSpoutRetroHUDUnarmedGreen(), (float) Config.getSpoutRetroHUDUnarmedBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDUnarmedRed(), (float) Config.getInstance().getSpoutRetroHUDUnarmedGreen(), (float) Config.getInstance().getSpoutRetroHUDUnarmedBlue(), 1f); case WOODCUTTING: - return new Color((float) Config.getSpoutRetroHUDWoodcuttingRed(), (float) Config.getSpoutRetroHUDWoodcuttingGreen(), (float) Config.getSpoutRetroHUDWoodcuttingBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDWoodcuttingRed(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingGreen(), (float) Config.getInstance().getSpoutRetroHUDWoodcuttingBlue(), 1f); case FISHING: - return new Color((float) Config.getSpoutRetroHUDFishingRed(), (float) Config.getSpoutRetroHUDFishingGreen(), (float) Config.getSpoutRetroHUDFishingBlue(), 1f); + return new Color((float) Config.getInstance().getSpoutRetroHUDFishingRed(), (float) Config.getInstance().getSpoutRetroHUDFishingGreen(), (float) Config.getInstance().getSpoutRetroHUDFishingBlue(), 1f); default: return new Color(0.3f, 0.3f, 0.75f, 1f); diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index ebd751865..1c7b574fc 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -30,7 +30,7 @@ public class PlayerProfile { /* Party Stuff */ private String party; private String invite; - private String tablePrefix = Config.getMySQLTablePrefix(); + private String tablePrefix = Config.getInstance().getMySQLTablePrefix(); /* Toggles */ private boolean loaded = false; @@ -64,7 +64,7 @@ public class PlayerProfile { private String location = mcMMO.usersFile; public PlayerProfile(String name, boolean addNew) { - hud = Config.defaulthud; + hud = Config.getInstance().defaulthud; playerName = name; for (AbilityType abilityType : AbilityType.values()) { @@ -78,7 +78,7 @@ public class PlayerProfile { } } - if (Config.getUseMySQL()) { + if (Config.getInstance().getUseMySQL()) { if (!loadMySQL() && addNew) { addMySQLPlayer(); } @@ -121,7 +121,7 @@ public class PlayerProfile { } } } else { - hud = Config.defaulthud; + hud = Config.getInstance().defaulthud; } } HashMap> users = mcMMO.database.read("SELECT lastlogin, party FROM "+tablePrefix+"users WHERE id = " + id); @@ -299,7 +299,7 @@ public class PlayerProfile { { Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds // if we are using mysql save to database - if (Config.getUseMySQL()) + if (Config.getInstance().getUseMySQL()) { mcMMO.database.write("UPDATE "+tablePrefix+"huds SET " +" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid); @@ -477,7 +477,7 @@ public class PlayerProfile { out.append(0+":"); //DATS out.append(0+":"); //DATS out.append(0+":"); //DATS - out.append(Config.defaulthud.toString()+":");//HUD + out.append(Config.getInstance().defaulthud.toString()+":");//HUD out.append(0+":"); //Fishing out.append(0+":"); //FishingXP out.append(0+":"); //Blast Mining @@ -1023,7 +1023,7 @@ public class PlayerProfile { * @param newValue The amount of XP to add */ public void addXPOverrideBonus(SkillType skillType, int newValue) { - int xp = newValue * Config.xpGainMultiplier; + int xp = newValue * Config.getInstance().xpGainMultiplier; addXPOverride(skillType, xp); } @@ -1048,7 +1048,7 @@ public class PlayerProfile { bonusModifier = partyModifier(skillType); } - int xp = (int) (newValue / skillType.getXpModifier()) * Config.xpGainMultiplier; + int xp = (int) (newValue / skillType.getXpModifier()) * Config.getInstance().xpGainMultiplier; if (bonusModifier > 0) { if (bonusModifier >= 2) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/SkillType.java b/src/main/java/com/gmail/nossr50/datatypes/SkillType.java index f2ff7e36b..155112860 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/SkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/SkillType.java @@ -7,19 +7,19 @@ import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.config.Config; public enum SkillType { - ACROBATICS(Config.getLevelCapAcrobatics(), Config.getFormulaMultiplierAcrobatics()), + ACROBATICS(Config.getInstance().getLevelCapAcrobatics(), Config.getInstance().getFormulaMultiplierAcrobatics()), ALL, //This one is just for convenience - ARCHERY(Config.getLevelCapArchery(), Config.getFormulaMultiplierArchery()), - AXES(AbilityType.SKULL_SPLIITER, Config.getLevelCapAxes(), ToolType.AXE, Config.getFormulaMultiplierAxes()), - EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getLevelCapExcavation(), ToolType.SHOVEL, Config.getFormulaMultiplierExcavation()), - FISHING(Config.getLevelCapFishing(), Config.getFormulaMultiplierFishing()), - HERBALISM(AbilityType.GREEN_TERRA, Config.getLevelCapHerbalism(), ToolType.HOE, Config.getFormulaMultiplierHerbalism()), - MINING(AbilityType.SUPER_BREAKER, Config.getLevelCapMining(), ToolType.PICKAXE, Config.getFormulaMultiplierMining()), - REPAIR(Config.getLevelCapRepair(), Config.getFormulaMultiplierRepair()), - SWORDS(AbilityType.SERRATED_STRIKES, Config.getLevelCapSwords(), ToolType.SWORD, Config.getFormulaMultiplierSwords()), - TAMING(Config.getLevelCapTaming(), Config.getFormulaMultiplierTaming()), - UNARMED(AbilityType.BERSERK, Config.getLevelCapUnarmed(), ToolType.FISTS, Config.getFormulaMultiplierUnarmed()), - WOODCUTTING(AbilityType.TREE_FELLER, Config.getLevelCapWoodcutting(), ToolType.AXE, Config.getFormulaMultiplierWoodcutting()); + ARCHERY(Config.getInstance().getLevelCapArchery(), Config.getInstance().getFormulaMultiplierArchery()), + AXES(AbilityType.SKULL_SPLIITER, Config.getInstance().getLevelCapAxes(), ToolType.AXE, Config.getInstance().getFormulaMultiplierAxes()), + EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, Config.getInstance().getLevelCapExcavation(), ToolType.SHOVEL, Config.getInstance().getFormulaMultiplierExcavation()), + FISHING(Config.getInstance().getLevelCapFishing(), Config.getInstance().getFormulaMultiplierFishing()), + HERBALISM(AbilityType.GREEN_TERRA, Config.getInstance().getLevelCapHerbalism(), ToolType.HOE, Config.getInstance().getFormulaMultiplierHerbalism()), + MINING(AbilityType.SUPER_BREAKER, Config.getInstance().getLevelCapMining(), ToolType.PICKAXE, Config.getInstance().getFormulaMultiplierMining()), + REPAIR(Config.getInstance().getLevelCapRepair(), Config.getInstance().getFormulaMultiplierRepair()), + SWORDS(AbilityType.SERRATED_STRIKES, Config.getInstance().getLevelCapSwords(), ToolType.SWORD, Config.getInstance().getFormulaMultiplierSwords()), + TAMING(Config.getInstance().getLevelCapTaming(), Config.getInstance().getFormulaMultiplierTaming()), + UNARMED(AbilityType.BERSERK, Config.getInstance().getLevelCapUnarmed(), ToolType.FISTS, Config.getInstance().getFormulaMultiplierUnarmed()), + WOODCUTTING(AbilityType.TREE_FELLER, Config.getInstance().getLevelCapWoodcutting(), ToolType.AXE, Config.getInstance().getFormulaMultiplierWoodcutting()); private AbilityType ability; private int maxLevel; diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 6be80c4da..71c765cb9 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -118,7 +118,7 @@ public class BlockListener implements Listener { block.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true)); } - if (id == Config.getRepairAnvilId() && Config.getRepairAnvilMessagesEnabled()) { + if (id == Config.getInstance().getRepairAnvilId() && Config.getInstance().getRepairAnvilMessagesEnabled()) { Repair.placedAnvilCheck(player, id); } } @@ -163,10 +163,10 @@ public class BlockListener implements Listener { */ if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) { - if (Config.getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { + if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { Mining.miningBlockCheck(player, block); } - else if (!Config.getMiningRequiresTool()) { + else if (!Config.getInstance().getMiningRequiresTool()) { Mining.miningBlockCheck(player, block); } } @@ -176,10 +176,10 @@ public class BlockListener implements Listener { */ if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) { - if (Config.getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { + if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { WoodCutting.woodcuttingBlockCheck(player, block); } - else if (!Config.getWoodcuttingRequiresTool()) { + else if (!Config.getInstance().getWoodcuttingRequiresTool()) { WoodCutting.woodcuttingBlockCheck(player, block); } } @@ -193,10 +193,10 @@ public class BlockListener implements Listener { */ if (Excavation.canBeGigaDrillBroken(mat) && mcPermissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) { - if (Config.getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { + if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { Excavation.excavationProcCheck(block, player); } - else if (!Config.getExcavationRequiresTool()) { + else if (!Config.getInstance().getExcavationRequiresTool()) { Excavation.excavationProcCheck(block, player); } } @@ -244,7 +244,7 @@ public class BlockListener implements Listener { } /* TREE FELLER SOUNDS */ - if (Config.spoutEnabled && mat.equals(Material.LOG) && PP.getAbilityMode(AbilityType.TREE_FELLER)) { + if (Config.getInstance().spoutEnabled && mat.equals(Material.LOG) && PP.getAbilityMode(AbilityType.TREE_FELLER)) { SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation()); } @@ -255,11 +255,11 @@ public class BlockListener implements Listener { Herbalism.greenTerra(player, block); } else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) { - if (Config.getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { + if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } - else if (!Config.getExcavationRequiresTool()) { + else if (!Config.getInstance().getExcavationRequiresTool()) { event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } @@ -272,28 +272,28 @@ public class BlockListener implements Listener { event.setInstaBreak(true); } - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } } else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) { - if (Config.getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { + if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) { event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block); } - else if (!Config.getMiningRequiresTool()) { + else if (!Config.getInstance().getMiningRequiresTool()) { event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block); } } else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) { - if (Config.getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { + if (Config.getInstance().getWoodcuttingRequiresTool() && ItemChecks.isAxe(inhand)) { if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) { event.setInstaBreak(true); WoodCutting.leafBlower(player, block); } } - else if (!Config.getWoodcuttingRequiresTool() && !inhand.getType().equals(Material.SHEARS)) { + else if (!Config.getInstance().getWoodcuttingRequiresTool() && !inhand.getType().equals(Material.SHEARS)) { if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) { event.setInstaBreak(true); WoodCutting.leafBlower(player, block); diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 44048bfea..6a9842532 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -165,7 +165,7 @@ public class EntityListener implements Listener { public void onCreatureSpawn(CreatureSpawnEvent event) { SpawnReason reason = event.getSpawnReason(); - if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getExperienceGainsMobspawnersEnabled()) { + if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getInstance().getExperienceGainsMobspawnersEnabled()) { event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true)); } } @@ -219,7 +219,7 @@ public class EntityListener implements Listener { */ @EventHandler (priority = EventPriority.LOW) public void onFoodLevelChange(FoodLevelChangeEvent event) { - if (Config.getHerbalismHungerBonusEnabled()) { + if (Config.getInstance().getHerbalismHungerBonusEnabled()) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); PlayerProfile PP = Users.getProfile(player); @@ -299,11 +299,11 @@ public class EntityListener implements Listener { switch (type) { case WOLF: - xp = Config.getTamingXPWolf(); + xp = Config.getInstance().getTamingXPWolf(); break; case OCELOT: - xp = Config.getTamingXPOcelot(); + xp = Config.getInstance().getTamingXPOcelot(); break; default: diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 94a99f2dd..a46ff1bdc 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -145,7 +145,7 @@ public class PlayerListener implements Listener { /* GARBAGE COLLECTION */ //Remove Spout Stuff - if (Config.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) { + if (Config.getInstance().spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) { SpoutStuff.playerHUDs.remove(player); } @@ -167,14 +167,14 @@ public class PlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (mcPermissions.getInstance().motd(player) && Config.getMOTDEnabled()) { + if (mcPermissions.getInstance().motd(player) && Config.getInstance().getMOTDEnabled()) { player.sendMessage(mcLocale.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()})); player.sendMessage(mcLocale.getString("mcMMO.Wiki")); } //THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY if (XprateCommand.xpevent) { - player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {Config.xpGainMultiplier})); + player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier})); } } @@ -204,14 +204,14 @@ public class PlayerListener implements Listener { case RIGHT_CLICK_BLOCK: /* REPAIR CHECKS */ - if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.getRepairAnvilId() && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { + if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.getInstance().getRepairAnvilId() && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { Repair.repairCheck(player, is); event.setCancelled(true); player.updateInventory(); } /* ACTIVATION CHECKS */ - if (Config.getAbilitiesEnabled() && BlockChecks.abilityBlockCheck(mat)) { + if (Config.getInstance().getAbilitiesEnabled() && BlockChecks.abilityBlockCheck(mat)) { if (!mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) { Skills.activationCheck(player, SkillType.HERBALISM); } @@ -235,7 +235,7 @@ public class PlayerListener implements Listener { } /* BLAST MINING CHECK */ - if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getDetonatorItemID()) { + if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) { BlastMining.remoteDetonation(player, plugin); } @@ -244,7 +244,7 @@ public class PlayerListener implements Listener { case RIGHT_CLICK_AIR: /* ACTIVATION CHECKS */ - if (Config.getAbilitiesEnabled()) { + if (Config.getInstance().getAbilitiesEnabled()) { Skills.activationCheck(player, SkillType.AXES); Skills.activationCheck(player, SkillType.EXCAVATION); Skills.activationCheck(player, SkillType.HERBALISM); @@ -258,7 +258,7 @@ public class PlayerListener implements Listener { Item.itemchecks(player); /* BLAST MINING CHECK */ - if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getDetonatorItemID()) { + if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) { BlastMining.remoteDetonation(player, plugin); } diff --git a/src/main/java/com/gmail/nossr50/listeners/SpoutListener.java b/src/main/java/com/gmail/nossr50/listeners/SpoutListener.java index 517fcf7e4..5d2f31d68 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SpoutListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SpoutListener.java @@ -32,7 +32,7 @@ public class SpoutListener implements Listener { PlayerProfile PPs = Users.getProfile(sPlayer); //TODO: Add custom titles based on skills - if (Config.getShowPowerLevelForSpout()) { + if (Config.getInstance().getShowPowerLevelForSpout()) { sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE+"." + ChatColor.GREEN + String.valueOf(PPs.getPowerLevel())); } diff --git a/src/main/java/com/gmail/nossr50/locale/mcLocale.java b/src/main/java/com/gmail/nossr50/locale/mcLocale.java index d40f94e67..1eb9f7dac 100644 --- a/src/main/java/com/gmail/nossr50/locale/mcLocale.java +++ b/src/main/java/com/gmail/nossr50/locale/mcLocale.java @@ -29,7 +29,7 @@ public class mcLocale { if (RESOURCE_BUNDLE == null) { Locale.setDefault(new Locale("en", "US")); Locale locale = null; - String[] myLocale = Config.getLocale().split("[-_ ]"); + String[] myLocale = Config.getInstance().getLocale().split("[-_ ]"); if (myLocale.length == 1) { locale = new Locale(myLocale[0]); diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index ccff36753..2584e1b3b 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -261,8 +261,8 @@ public class m { } public static int getPowerLevelCap() { - if (Config.getPowerLevelCap() > 0) { - return Config.getPowerLevelCap(); + if (Config.getInstance().getPowerLevelCap() > 0) { + return Config.getInstance().getPowerLevelCap(); } else { return Integer.MAX_VALUE; diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 07a22d06d..03ddc24a0 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -76,7 +76,7 @@ public class mcMMO extends JavaPlugin { new Party(this).loadParties(); - if (!Config.getUseMySQL()) { + if (!Config.getInstance().getUseMySQL()) { Users.loadUsers(); } @@ -90,7 +90,7 @@ public class mcMMO extends JavaPlugin { PluginDescriptionFile pdfFile = this.getDescription(); //Setup the leaderboards - if (Config.getUseMySQL()) { + if (Config.getInstance().getUseMySQL()) { database = new Database(this); database.createStructure(); } @@ -109,7 +109,7 @@ public class mcMMO extends JavaPlugin { //Schedule Spout Activation 1 second after start-up scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20); //Periodic save timer (Saves every 10 minutes) - scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, Config.getSaveInterval() * 1200); + scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, Config.getInstance().getSaveInterval() * 1200); //Regen & Cooldown timer (Runs every second) scheduler.scheduleSyncRepeatingTask(this, new mcTimer(this), 0, 20); //Bleed timer (Runs every two seconds) @@ -117,7 +117,7 @@ public class mcMMO extends JavaPlugin { registerCommands(); - if (Config.getStatsTrackingEnabled()) { + if (Config.getInstance().getStatsTrackingEnabled()) { try { Metrics metrics = new Metrics(this); metrics.start(); @@ -215,88 +215,88 @@ public class mcMMO extends JavaPlugin { getCommand("woodcutting").setExecutor(new WoodcuttingCommand()); //mc* commands - if (Config.getCommandMCRemoveEnabled()) { + if (Config.getInstance().getCommandMCRemoveEnabled()) { getCommand("mcremove").setExecutor(new McremoveCommand(this)); } - if (Config.getCommandMCAbilityEnabled()) { + if (Config.getInstance().getCommandMCAbilityEnabled()) { getCommand("mcability").setExecutor(new McabilityCommand()); } - if (Config.getCommandMCCEnabled()) { + if (Config.getInstance().getCommandMCCEnabled()) { getCommand("mcc").setExecutor(new MccCommand()); } - if (Config.getCommandMCGodEnabled()) { + if (Config.getInstance().getCommandMCGodEnabled()) { getCommand("mcgod").setExecutor(new McgodCommand()); } - if (Config.getCommandmcMMOEnabled()) { + if (Config.getInstance().getCommandmcMMOEnabled()) { getCommand("mcmmo").setExecutor(new McmmoCommand()); } - if (Config.getCommandMCRefreshEnabled()) { + if (Config.getInstance().getCommandMCRefreshEnabled()) { getCommand("mcrefresh").setExecutor(new McrefreshCommand(this)); } - if (Config.getCommandMCTopEnabled()) { + if (Config.getInstance().getCommandMCTopEnabled()) { getCommand("mctop").setExecutor(new MctopCommand()); } - if (Config.getCommandMCStatsEnabled()) { + if (Config.getInstance().getCommandMCStatsEnabled()) { getCommand("mcstats").setExecutor(new McstatsCommand()); } //Party commands - if (Config.getCommandAcceptEnabled()) { + if (Config.getInstance().getCommandAcceptEnabled()) { getCommand("accept").setExecutor(new AcceptCommand(this)); } - if (Config.getCommandAdminChatAEnabled()) { + if (Config.getInstance().getCommandAdminChatAEnabled()) { getCommand("a").setExecutor(new ACommand(this)); } - if (Config.getCommandInviteEnabled()) { + if (Config.getInstance().getCommandInviteEnabled()) { getCommand("invite").setExecutor(new InviteCommand(this)); } - if (Config.getCommandPartyEnabled()) { + if (Config.getInstance().getCommandPartyEnabled()) { getCommand("party").setExecutor(new PartyCommand(this)); } - if (Config.getCommandPartyChatPEnabled()) { + if (Config.getInstance().getCommandPartyChatPEnabled()) { getCommand("p").setExecutor(new PCommand(this)); } - if (Config.getCommandPTPEnabled()) { + if (Config.getInstance().getCommandPTPEnabled()) { getCommand("ptp").setExecutor(new PtpCommand(this)); } //Other commands - if (Config.getCommandAddXPEnabled()) { + if (Config.getInstance().getCommandAddXPEnabled()) { getCommand("addxp").setExecutor(new AddxpCommand(this)); } - if (Config.getCommandAddLevelsEnabled()) { + if (Config.getInstance().getCommandAddLevelsEnabled()) { getCommand("addlevels").setExecutor(new AddlevelsCommand(this)); } - if (Config.getCommandMmoeditEnabled()) { + if (Config.getInstance().getCommandMmoeditEnabled()) { getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); } - if (Config.getCommandInspectEnabled()) { + if (Config.getInstance().getCommandInspectEnabled()) { getCommand("inspect").setExecutor(new InspectCommand(this)); } - if (Config.getCommandXPRateEnabled()) { + if (Config.getInstance().getCommandXPRateEnabled()) { getCommand("xprate").setExecutor(new XprateCommand(this)); } getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this)); //Spout commands - if (Config.getCommandXPLockEnabled()) { + if (Config.getInstance().getCommandXPLockEnabled()) { getCommand("xplock").setExecutor(new XplockCommand()); } diff --git a/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java b/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java index 373a0b86c..d1f0c02e6 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java @@ -9,7 +9,7 @@ import com.gmail.nossr50.config.Config; public class SQLConversionTask implements Runnable { private final mcMMO plugin; - private String tablePrefix = Config.getMySQLTablePrefix(); + private String tablePrefix = Config.getInstance().getMySQLTablePrefix(); public SQLConversionTask(mcMMO plugin) { this.plugin = plugin; diff --git a/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java b/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java index e23ae154d..88522203a 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java +++ b/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java @@ -17,14 +17,14 @@ public class SpoutStart implements Runnable{ @Override public void run() { if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) { - Config.spoutEnabled = true; + Config.getInstance().spoutEnabled = true; } else { - Config.spoutEnabled = false; + Config.getInstance().spoutEnabled = false; } //Spout Stuff - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutStuff.setupSpoutConfigs(); SpoutStuff.registerCustomEvent(); SpoutStuff.extractFiles(); //Extract source materials diff --git a/src/main/java/com/gmail/nossr50/skills/Excavation.java b/src/main/java/com/gmail/nossr50/skills/Excavation.java index 9c34aa389..f5c91d1aa 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -66,7 +66,7 @@ public class Excavation { List treasures = new ArrayList(); - int xp = Config.getExcavationBaseXP(); + int xp = Config.getInstance().getExcavationBaseXP(); if (mcPermissions.getInstance().excavationTreasures(player)) { switch (type) { @@ -131,7 +131,7 @@ public class Excavation { * @param block The block to check */ public static void gigaDrillBreaker(Player player, Block block) { - Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getAbilityToolDamage()); + Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage()); if (!block.hasMetadata("mcmmoPlacedBlock")) { FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); @@ -141,7 +141,7 @@ public class Excavation { Excavation.excavationProcCheck(block, player); } - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } } diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index b127117df..b86fb50a6 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -42,16 +42,16 @@ public class Fishing { int level = PP.getSkillLevel(SkillType.FISHING); int fishingTier; - if (level >= Config.getFishingTierLevelsTier5()) { + if (level >= Config.getInstance().getFishingTierLevelsTier5()) { fishingTier = 5; } - else if (level >= Config.getFishingTierLevelsTier4()) { + else if (level >= Config.getInstance().getFishingTierLevelsTier4()) { fishingTier = 4; } - else if (level >= Config.getFishingTierLevelsTier3()) { + else if (level >= Config.getInstance().getFishingTierLevelsTier3()) { fishingTier = 3; } - else if (level >= Config.getFishingTierLevelsTier2()) { + else if (level >= Config.getInstance().getFishingTierLevelsTier2()) { fishingTier = 2; } else { @@ -97,7 +97,7 @@ public class Fishing { break; } - if (Config.getFishingDropsEnabled() && rewards.size() > 0) { + if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0) { FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); if (random.nextDouble() * 100 <= treasure.getDropChance()) { @@ -115,7 +115,7 @@ public class Fishing { theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value } - PP.addXP(SkillType.FISHING, Config.getFishingBaseXP()); + PP.addXP(SkillType.FISHING, Config.getInstance().getFishingBaseXP()); Skills.XpCheckSkill(SkillType.FISHING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/Herbalism.java index f869aae4b..b4df2d864 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -45,13 +45,13 @@ public class Herbalism { player.updateInventory(); if (m.blockBreakSimulate(block, player, false)) { - if (Config.getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { + if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { block.setData((byte) 0x1); //Set type of the brick to mossy } - else if (Config.getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) { + else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) { block.setType(Material.GRASS); } - else if (Config.getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) { + else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) { block.setType(Material.MOSSY_COBBLESTONE); } } @@ -132,7 +132,7 @@ public class Herbalism { case RED_MUSHROOM: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.getMaterial(id); - xp = Config.getHerbalismXPMushrooms(); + xp = Config.getInstance().getHerbalismXPMushrooms(); } break; @@ -145,7 +145,7 @@ public class Herbalism { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) { catciDrops++; } - xp += Config.getHerbalismXPCactus(); + xp += Config.getInstance().getHerbalismXPCactus(); } } } @@ -154,9 +154,9 @@ public class Herbalism { case CROPS: if (data == CropState.RIPE.getData()) { mat = Material.WHEAT; - xp = Config.getHerbalismXPWheat(); + xp = Config.getInstance().getHerbalismXPWheat(); - if (Config.getHerbalismWheatRegrowth() && mcPermissions.getInstance().greenThumbWheat(player)) { + if (Config.getInstance().getHerbalismWheatRegrowth() && mcPermissions.getInstance().greenThumbWheat(player)) { greenThumbWheat(block, player, event, plugin); } } @@ -165,14 +165,14 @@ public class Herbalism { case MELON_BLOCK: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.MELON; - xp = Config.getHerbalismXPMelon(); + xp = Config.getInstance().getHerbalismXPMelon(); } break; case NETHER_WARTS: if (data == (byte) 0x3) { mat = Material.NETHER_STALK; - xp = Config.getHerbalismXPNetherWart(); + xp = Config.getInstance().getHerbalismXPNetherWart(); } break; @@ -180,7 +180,7 @@ public class Herbalism { case JACK_O_LANTERN: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.getMaterial(id); - xp = Config.getHerbalismXPPumpkin(); + xp = Config.getInstance().getHerbalismXPPumpkin(); } break; @@ -188,7 +188,7 @@ public class Herbalism { case YELLOW_FLOWER: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.getMaterial(id); - xp = Config.getHerbalismXPFlowers(); + xp = Config.getInstance().getHerbalismXPFlowers(); } break; @@ -201,7 +201,7 @@ public class Herbalism { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) { caneDrops++; } - xp += Config.getHerbalismXPSugarCane(); + xp += Config.getInstance().getHerbalismXPSugarCane(); } } } @@ -210,14 +210,14 @@ public class Herbalism { case VINE: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = type; - xp = Config.getHerbalismXPVines(); + xp = Config.getInstance().getHerbalismXPVines(); } break; case WATER_LILY: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = type; - xp = Config.getHerbalismXPLilyPads(); + xp = Config.getInstance().getHerbalismXPLilyPads(); } break; diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index 87192beda..c263fa5db 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -15,8 +15,8 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutSounds; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; @@ -89,56 +89,56 @@ public class Mining { switch (type) { case COAL_ORE: - xp += Config.getMiningXPCoalOre(); + xp += Config.getInstance().getMiningXPCoalOre(); break; case DIAMOND_ORE: - xp += Config.getMiningXPDiamondOre(); + xp += Config.getInstance().getMiningXPDiamondOre(); break; case ENDER_STONE: - xp += Config.getMiningXPEndStone(); + xp += Config.getInstance().getMiningXPEndStone(); break; case GLOWING_REDSTONE_ORE: case REDSTONE_ORE: - xp += Config.getMiningXPRedstoneOre(); + xp += Config.getInstance().getMiningXPRedstoneOre(); break; case GLOWSTONE: - xp += Config.getMiningXPGlowstone(); + xp += Config.getInstance().getMiningXPGlowstone(); break; case GOLD_ORE: - xp += Config.getMiningXPGoldOre(); + xp += Config.getInstance().getMiningXPGoldOre(); break; case IRON_ORE: - xp += Config.getMiningXPIronOre(); + xp += Config.getInstance().getMiningXPIronOre(); break; case LAPIS_ORE: - xp += Config.getMiningXPLapisOre(); + xp += Config.getInstance().getMiningXPLapisOre(); break; case MOSSY_COBBLESTONE: - xp += Config.getMiningXPMossyStone(); + xp += Config.getInstance().getMiningXPMossyStone(); break; case NETHERRACK: - xp += Config.getMiningXPNetherrack(); + xp += Config.getInstance().getMiningXPNetherrack(); break; case OBSIDIAN: - xp += Config.getMiningXPObsidian(); + xp += Config.getInstance().getMiningXPObsidian(); break; case SANDSTONE: - xp += Config.getMiningXPSandstone(); + xp += Config.getInstance().getMiningXPSandstone(); break; case STONE: - xp += Config.getMiningXPStone(); + xp += Config.getInstance().getMiningXPStone(); break; default: @@ -216,7 +216,7 @@ public class Mining { public static void SuperBreakerBlockCheck(Player player, Block block) { Material type = block.getType(); int tier = m.getTier(player.getItemInHand()); - int durabilityLoss = Config.getAbilityToolDamage(); + int durabilityLoss = Config.getInstance().getAbilityToolDamage(); FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); switch (type) { @@ -259,7 +259,7 @@ public class Mining { miningBlockCheck(player, block); - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } } diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index 1e1ef73af..493f96036 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -47,21 +47,21 @@ public class Repair { /* * REPAIR ARMOR */ - if (ItemChecks.isArmor(is) && Config.getRepairArmorAllowed() && mcPermissions.getInstance().armorRepair(player)) { - if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.getRepairDiamondMaterial()) && skillLevel >= Config.getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairDiamondMaterial())); + if (ItemChecks.isArmor(is) && Config.getInstance().getRepairArmorAllowed() && mcPermissions.getInstance().armorRepair(player)) { + if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial())); xpHandler(player, PP, is, durabilityBefore, 6, true); } - else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.getRepairIronMaterial()) && skillLevel >= Config.getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairIronMaterial())); + else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, true); } - else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.getRepairGoldMaterial()) && skillLevel >= Config.getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairGoldMaterial())); + else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial())); xpHandler(player, PP, is, durabilityBefore, 4, true); } - else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.getRepairLeatherMaterial()) && mcPermissions.getInstance().leatherRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairLeatherMaterial())); + else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.getInstance().getRepairLeatherMaterial()) && mcPermissions.getInstance().leatherRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairLeatherMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } else { @@ -72,29 +72,29 @@ public class Repair { /* * REPAIR TOOLS */ - else if (ItemChecks.isTool(is) && Config.getRepairToolsAllowed() && mcPermissions.getInstance().toolRepair(player)) { - if (ItemChecks.isStoneTool(is) && inventory.contains(Config.getRepairStoneMaterial()) && skillLevel >= Config.getRepairStoneLevelRequirement() && mcPermissions.getInstance().stoneRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairStoneMaterial())); + else if (ItemChecks.isTool(is) && Config.getInstance().getRepairToolsAllowed() && mcPermissions.getInstance().toolRepair(player)) { + if (ItemChecks.isStoneTool(is) && inventory.contains(Config.getInstance().getRepairStoneMaterial()) && skillLevel >= Config.getInstance().getRepairStoneLevelRequirement() && mcPermissions.getInstance().stoneRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairStoneMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.getRepairWoodMaterial()) && mcPermissions.getInstance().woodRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairWoodMaterial())); + else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.getInstance().getRepairWoodMaterial()) && mcPermissions.getInstance().woodRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairWoodMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isIronTool(is) && inventory.contains(Config.getRepairIronMaterial()) && skillLevel >= Config.getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairIronMaterial())); + else if (ItemChecks.isIronTool(is) && inventory.contains(Config.getInstance().getRepairIronMaterial()) && skillLevel >= Config.getInstance().getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairIronMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.getRepairDiamondMaterial()) && skillLevel >= Config.getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairDiamondMaterial())); + else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.getInstance().getRepairDiamondMaterial()) && skillLevel >= Config.getInstance().getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairDiamondMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.getRepairGoldMaterial()) && skillLevel >= Config.getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(Config.getRepairGoldMaterial())); + else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.getInstance().getRepairGoldMaterial()) && skillLevel >= Config.getInstance().getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.getInstance().getRepairGoldMaterial())); xpHandler(player, PP, is, durabilityBefore, 8, true); } - else if (ItemChecks.isStringTool(is) && inventory.contains(Config.getRepairStringMaterial()) && skillLevel >= Config.getRepairStringLevelRequirement() && mcPermissions.getInstance().stringRepair(player)){ - repairItem(player, is, new ItemStack(Config.getRepairStringMaterial())); + else if (ItemChecks.isStringTool(is) && inventory.contains(Config.getInstance().getRepairStringMaterial()) && skillLevel >= Config.getInstance().getRepairStringLevelRequirement() && mcPermissions.getInstance().stringRepair(player)){ + repairItem(player, is, new ItemStack(Config.getInstance().getRepairStringMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } else { @@ -142,7 +142,7 @@ public class Repair { Skills.XpCheckSkill(SkillType.REPAIR, player); //CLANG CLANG - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutSounds.playRepairNoise(player, mcMMO.p); } } @@ -156,16 +156,16 @@ public class Repair { public static int getArcaneForgingRank(PlayerProfile PP) { int skillLevel = PP.getSkillLevel(SkillType.REPAIR); - if (skillLevel >= Config.getArcaneForgingRankLevels4()) { + if (skillLevel >= Config.getInstance().getArcaneForgingRankLevels4()) { return 4; } - else if (skillLevel >= Config.getArcaneForgingRankLevels3()) { + else if (skillLevel >= Config.getInstance().getArcaneForgingRankLevels3()) { return 3; } - else if (skillLevel >= Config.getArcaneForgingRankLevels2()) { + else if (skillLevel >= Config.getInstance().getArcaneForgingRankLevels2()) { return 2; } - else if (skillLevel >= Config.getArcaneForgingRankLevels1()) { + else if (skillLevel >= Config.getInstance().getArcaneForgingRankLevels1()) { return 1; } else { @@ -204,7 +204,7 @@ public class Repair { if (random.nextInt(100) <= getEnchantChance(rank)) { int enchantLevel = enchant.getValue(); - if (Config.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { + if (Config.getInstance().getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { if (random.nextInt(100) <= getDowngradeChance(rank)) { is.addEnchantment(enchantment, enchantLevel--); downgraded = true; @@ -238,16 +238,16 @@ public class Repair { public static int getEnchantChance(int rank) { switch (rank) { case 4: - return Config.getArcaneForgingKeepEnchantsChanceRank4(); + return Config.getInstance().getArcaneForgingKeepEnchantsChanceRank4(); case 3: - return Config.getArcaneForgingKeepEnchantsChanceRank3(); + return Config.getInstance().getArcaneForgingKeepEnchantsChanceRank3(); case 2: - return Config.getArcaneForgingKeepEnchantsChanceRank2(); + return Config.getInstance().getArcaneForgingKeepEnchantsChanceRank2(); case 1: - return Config.getArcaneForgingKeepEnchantsChanceRank1(); + return Config.getInstance().getArcaneForgingKeepEnchantsChanceRank1(); default: return 0; @@ -263,16 +263,16 @@ public class Repair { public static int getDowngradeChance(int rank) { switch (rank) { case 4: - return Config.getArcaneForgingDowngradeChanceRank4(); + return Config.getInstance().getArcaneForgingDowngradeChanceRank4(); case 3: - return Config.getArcaneForgingDowngradeChanceRank3(); + return Config.getInstance().getArcaneForgingDowngradeChanceRank3(); case 2: - return Config.getArcaneForgingDowngradeChanceRank2(); + return Config.getInstance().getArcaneForgingDowngradeChanceRank2(); case 1: - return Config.getArcaneForgingDowngradeChanceRank1(); + return Config.getInstance().getArcaneForgingDowngradeChanceRank1(); default: return 100; @@ -356,45 +356,45 @@ public class Repair { } else { if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) { - if (skillLevel < Config.getRepairDiamondLevelRequirement()) { + if (skillLevel < Config.getInstance().getRepairDiamondLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptDiamond")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.getRepairDiamondMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.getInstance().getRepairDiamondMaterial())); } } else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) { - if (skillLevel < Config.getRepairIronLevelRequirement()) { + if (skillLevel < Config.getInstance().getRepairIronLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptIron")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getRepairIronMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getRepairIronMaterial())); } } else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) { - if (skillLevel < Config.getRepairGoldLevelRequirement()) { + if (skillLevel < Config.getInstance().getRepairGoldLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptGold")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.getRepairGoldMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.getInstance().getRepairGoldMaterial())); } } else if (ItemChecks.isStoneTool(is)) { - if (skillLevel < Config.getRepairStoneLevelRequirement()) { + if (skillLevel < Config.getInstance().getRepairStoneLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptStone")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.getRepairStoneMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.getInstance().getRepairStoneMaterial())); } } else if (ItemChecks.isWoodTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.getRepairWoodMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.getInstance().getRepairWoodMaterial())); } else if (ItemChecks.isLeatherArmor(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getRepairLeatherMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getInstance().getRepairLeatherMaterial())); } else if (ItemChecks.isStringTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getRepairStringMaterial())); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getInstance().getRepairStringMaterial())); } } } @@ -445,7 +445,7 @@ public class Repair { } /* Handle the enchants */ - if (Config.getArcaneForgingEnchantLossEnabled() && !mcPermissions.getInstance().arcaneBypass(player)) { + if (Config.getInstance().getArcaneForgingEnchantLossEnabled() && !mcPermissions.getInstance().arcaneBypass(player)) { addEnchants(player, item); } @@ -462,7 +462,7 @@ public class Repair { PlayerProfile PP = Users.getProfile(player); if (!PP.getPlacedAnvil()) { - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutPlayer sPlayer = SpoutManager.getPlayer(player); if (sPlayer.isSpoutCraftEnabled()) { diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index c8e5c1cb5..e1b31de8d 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -80,7 +80,7 @@ public class Skills { * @param skill The skill the ability is tied to */ public static void activationCheck(Player player, SkillType skill) { - if (Config.getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) { + if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) { return; } @@ -111,7 +111,7 @@ public class Skills { } } - if (Config.getAbilityMessagesEnabled()) { + if (Config.getInstance().getAbilityMessagesEnabled()) { player.sendMessage(tool.getRaiseTool()); } @@ -201,7 +201,7 @@ public class Skills { } } - if (!Config.getUseMySQL()) { + if (!Config.getInstance().getUseMySQL()) { ProcessLeaderboardUpdate(skillType, player); ProcessLeaderboardUpdate(SkillType.ALL, player); } @@ -209,18 +209,18 @@ public class Skills { String capitalized = m.getCapitalized(skillType.toString()); /* Spout Stuff */ - if (Config.spoutEnabled && player instanceof SpoutPlayer) { + if (Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) { SpoutPlayer sPlayer = SpoutManager.getPlayer(player); if (sPlayer.isSpoutCraftEnabled()) { - if (Config.getSpoutXPBarEnabled()) { + if (Config.getInstance().getSpoutXPBarEnabled()) { SpoutStuff.updateXpBar(player); } SpoutStuff.levelUpNotification(skillType, sPlayer); /* Update custom titles */ - if (Config.getShowPowerLevelForSpout()) { + if (Config.getInstance().getShowPowerLevelForSpout()) { sPlayer.setTitle(sPlayer.getName()+ "\n" + ChatColor.YELLOW + "P" + ChatColor.GOLD + "lvl" + ChatColor.WHITE + "." + ChatColor.GREEN + String.valueOf(PP.getPowerLevel())); } } @@ -234,10 +234,10 @@ public class Skills { } /* Always update XP Bar (Check if no levels were gained first to remove redundancy) */ - if (skillups == 0 && Config.spoutEnabled && player instanceof SpoutPlayer) { + if (skillups == 0 && Config.getInstance().spoutEnabled && player instanceof SpoutPlayer) { SpoutPlayer sPlayer = (SpoutPlayer) player; if (sPlayer.isSpoutCraftEnabled()) { - if (Config.getSpoutXPBarEnabled()) { + if (Config.getInstance().getSpoutXPBarEnabled()) { SpoutStuff.updateXpBar(player); } } @@ -349,7 +349,7 @@ public class Skills { * @param durabilityLoss The durability to remove from the item */ public static void abilityDurabilityLoss(ItemStack inhand, int durabilityLoss) { - if (Config.getAbilitiesDamageTools()) { + if (Config.getInstance().getAbilitiesDamageTools()) { if (!inhand.containsEnchantment(Enchantment.DURABILITY)) { inhand.setDurability((short) (inhand.getDurability() + durabilityLoss)); } diff --git a/src/main/java/com/gmail/nossr50/skills/Taming.java b/src/main/java/com/gmail/nossr50/skills/Taming.java index 76b9b1620..a1180053d 100644 --- a/src/main/java/com/gmail/nossr50/skills/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/Taming.java @@ -214,12 +214,12 @@ public class Taming { switch (type) { case WOLF: summonItem = Material.BONE; - summonAmount = Config.getTamingCOTWWolfCost(); + summonAmount = Config.getInstance().getTamingCOTWWolfCost(); break; case OCELOT: summonItem = Material.RAW_FISH; - summonAmount = Config.getTamingCOTWOcelotCost(); + summonAmount = Config.getInstance().getTamingCOTWOcelotCost(); break; default: diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index a4a020a3b..58e436c12 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -53,7 +53,7 @@ public class WoodCutting { * @param PP The PlayerProfile of the player */ private static void removeBlocks(ArrayList toBeFelled, Player player, PlayerProfile PP) { - if (toBeFelled.size() >= Config.getTreeFellerThreshold()) { + if (toBeFelled.size() >= Config.getInstance().getTreeFellerThreshold()) { player.sendMessage(mcLocale.getString("Woodcutting.Skills.TreeFellerThreshold")); return; } @@ -116,19 +116,19 @@ public class WoodCutting { switch (species) { case GENERIC: - xp += Config.getWoodcuttingXPOak(); + xp += Config.getInstance().getWoodcuttingXPOak(); break; case REDWOOD: - xp += Config.getWoodcuttingXPSpruce(); + xp += Config.getInstance().getWoodcuttingXPSpruce(); break; case BIRCH: - xp += Config.getWoodcuttingXPBirch(); + xp += Config.getInstance().getWoodcuttingXPBirch(); break; case JUNGLE: - xp += Config.getWoodcuttingXPJungle() / 4; //Nerf XP from Jungle Trees when using Tree Feller + xp += Config.getInstance().getWoodcuttingXPJungle() / 4; //Nerf XP from Jungle Trees when using Tree Feller break; default: @@ -187,7 +187,7 @@ public class WoodCutting { private static void processTreeFelling(Block currentBlock, ArrayList toBeFelled) { Material type = currentBlock.getType(); - if(toBeFelled.size() >= Config.getTreeFellerThreshold()) { + if(toBeFelled.size() >= Config.getInstance().getTreeFellerThreshold()) { return; } @@ -281,19 +281,19 @@ public class WoodCutting { switch (species) { case GENERIC: - xp += Config.getWoodcuttingXPOak(); + xp += Config.getInstance().getWoodcuttingXPOak(); break; case REDWOOD: - xp += Config.getWoodcuttingXPSpruce(); + xp += Config.getInstance().getWoodcuttingXPSpruce(); break; case BIRCH: - xp += Config.getWoodcuttingXPBirch(); + xp += Config.getInstance().getWoodcuttingXPBirch(); break; case JUNGLE: - xp += Config.getWoodcuttingXPJungle(); + xp += Config.getInstance().getWoodcuttingXPJungle(); break; default: @@ -315,11 +315,11 @@ public class WoodCutting { FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); mcMMO.p.getServer().getPluginManager().callEvent(armswing); - if (Config.getWoodcuttingRequiresTool()) { - Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getAbilityToolDamage()); + if (Config.getInstance().getWoodcuttingRequiresTool()) { + Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage()); } - if (Config.spoutEnabled) { + if (Config.getInstance().spoutEnabled) { SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } } @@ -329,7 +329,7 @@ public class WoodCutting { for (Block x : toBeFelled) { if (x.getType().equals(Material.LOG)) { durabilityLoss++; - durabilityLoss = durabilityLoss + Config.getAbilityToolDamage(); + durabilityLoss = durabilityLoss + Config.getInstance().getAbilityToolDamage(); } }