From 9606dd3501644365f3b3430bebaa5069365988fe Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 26 Apr 2012 07:27:57 -0700 Subject: [PATCH] Part 1 of refactoring/config overhaul --- Changelog.txt | 1 + .../java/com/gmail/nossr50/BlockChecks.java | 4 +- src/main/java/com/gmail/nossr50/Combat.java | 40 +- src/main/java/com/gmail/nossr50/Database.java | 25 +- src/main/java/com/gmail/nossr50/Item.java | 16 +- .../java/com/gmail/nossr50/Leaderboard.java | 4 +- .../commands/general/MmoupdateCommand.java | 4 +- .../commands/general/XprateCommand.java | 16 +- .../nossr50/commands/mc/McmmoCommand.java | 6 +- .../nossr50/commands/mc/McremoveCommand.java | 38 +- .../nossr50/commands/mc/MctopCommand.java | 12 +- .../nossr50/commands/party/PtpCommand.java | 6 +- .../commands/skills/RepairCommand.java | 4 +- .../commands/skills/TamingCommand.java | 6 +- .../nossr50/commands/spout/MchudCommand.java | 4 +- .../nossr50/commands/spout/XplockCommand.java | 4 +- .../gmail/nossr50/config/LoadProperties.java | 482 ------------------ .../gmail/nossr50/config/LoadTreasures.java | 10 +- .../gmail/nossr50/datatypes/AbilityType.java | 18 +- .../com/gmail/nossr50/datatypes/HUDmmo.java | 58 +-- .../nossr50/datatypes/PlayerProfile.java | 55 +- .../gmail/nossr50/datatypes/SkillType.java | 26 +- .../nossr50/datatypes/popups/PopupMMO.java | 4 +- .../nossr50/listeners/mcBlockListener.java | 32 +- .../nossr50/listeners/mcEntityListener.java | 10 +- .../nossr50/listeners/mcPlayerListener.java | 18 +- .../nossr50/listeners/mcSpoutListener.java | 4 +- .../com/gmail/nossr50/locale/mcLocale.java | 4 +- src/main/java/com/gmail/nossr50/m.java | 6 +- src/main/java/com/gmail/nossr50/mcMMO.java | 52 +- .../nossr50/runnables/SQLConversionTask.java | 27 +- .../gmail/nossr50/runnables/SpoutStart.java | 8 +- .../com/gmail/nossr50/skills/Excavation.java | 8 +- .../com/gmail/nossr50/skills/Fishing.java | 14 +- .../com/gmail/nossr50/skills/Herbalism.java | 30 +- .../java/com/gmail/nossr50/skills/Mining.java | 32 +- .../java/com/gmail/nossr50/skills/Repair.java | 100 ++-- .../java/com/gmail/nossr50/skills/Skills.java | 20 +- .../java/com/gmail/nossr50/skills/Taming.java | 6 +- .../com/gmail/nossr50/skills/WoodCutting.java | 30 +- 40 files changed, 385 insertions(+), 859 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/config/LoadProperties.java diff --git a/Changelog.txt b/Changelog.txt index a3c6818ac..e663a77b9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -23,6 +23,7 @@ Version 1.3.06-dev = Fixed bug with only getting one level when there was enough XP for multiple levels. = Fixed bugs with the way /mctop displayed = Fixed issues with custom characters & locale files. + ! Changed how we handled the config file to prevent any bugs when returning values ! Changed default locale name to en-US rather than en_us for the sake of compliance ! Changed locale files to use a new naming scheme. This breaks ALL old locale files. If you want to assist with re-translating anything, go to getlocalization.com/mcMMO ! Changed mcremove to check for users in the MySQL DB before sending queries to remove them diff --git a/src/main/java/com/gmail/nossr50/BlockChecks.java b/src/main/java/com/gmail/nossr50/BlockChecks.java index a58c8c5ab..ede564920 100644 --- a/src/main/java/com/gmail/nossr50/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/BlockChecks.java @@ -2,7 +2,7 @@ package com.gmail.nossr50; import org.bukkit.Material; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; public class BlockChecks { @@ -87,7 +87,7 @@ public class BlockChecks { break; } - if (Material.getMaterial(LoadProperties.anvilID).equals(material)) { + if (Material.getMaterial(Config.anvilID).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 81c7512a4..e81d1c47c 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -15,7 +15,7 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -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 (LoadProperties.eventCallback) { + if (Config.eventCallback) { 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 (LoadProperties.eventCallback) { + if (Config.eventCallback) { 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 (!LoadProperties.pvpxp) { + if (!Config.pvpxp) { 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 * LoadProperties.pvpxprewardmodifier; + baseXP = 20 * Config.getPlayerVersusPlayerXP(); } } else if (!target.hasMetadata("mcmmoFromMobSpawner")) { if (target instanceof Animals && !target.hasMetadata("mcmmoSummoned")) { - baseXP = LoadProperties.animalXP; + baseXP = Config.getAnimalsXP(); } else { EntityType type = target.getType(); switch (type) { case BLAZE: - baseXP = LoadProperties.blazeXP; + baseXP = Config.getBlazeXP(); break; case CAVE_SPIDER: - baseXP = LoadProperties.cavespiderXP; + baseXP = Config.getCaveSpiderXP(); break; case CREEPER: - baseXP = LoadProperties.creeperXP; + baseXP = Config.getCreeperXP(); break; case ENDER_DRAGON: - baseXP = LoadProperties.enderdragonXP; + baseXP = Config.getEnderDragonXP(); break; case ENDERMAN: - baseXP = LoadProperties.endermanXP; + baseXP = Config.getEndermanXP(); break; case GHAST: - baseXP = LoadProperties.ghastXP; + baseXP = Config.getGhastXP(); break; case MAGMA_CUBE: - baseXP = LoadProperties.magmacubeXP; + baseXP = Config.getMagmaCubeXP(); break; case IRON_GOLEM: if (!((IronGolem) target).isPlayerCreated()) - baseXP = LoadProperties.irongolemXP; + baseXP = Config.getIronGolemXP(); break; case PIG_ZOMBIE: - baseXP = LoadProperties.pigzombieXP; + baseXP = Config.getPigZombieXP(); break; case SILVERFISH: - baseXP = LoadProperties.silverfishXP; + baseXP = Config.getSilverfishXP(); break; case SKELETON: - baseXP = LoadProperties.skeletonXP; + baseXP = Config.getSkeletonXP(); break; case SLIME: - baseXP = LoadProperties.slimeXP; + baseXP = Config.getSlimeXP(); break; case SPIDER: - baseXP = LoadProperties.spiderXP; + baseXP = Config.getSpiderXP(); break; case ZOMBIE: - baseXP = LoadProperties.zombieXP; + baseXP = Config.getZombieXP(); break; default: diff --git a/src/main/java/com/gmail/nossr50/Database.java b/src/main/java/com/gmail/nossr50/Database.java index 08c33c2ad..b3e34661a 100644 --- a/src/main/java/com/gmail/nossr50/Database.java +++ b/src/main/java/com/gmail/nossr50/Database.java @@ -9,13 +9,14 @@ import java.util.HashMap; import java.util.ArrayList; import java.util.Properties; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.DatabaseUpdate; import com.gmail.nossr50.runnables.SQLReconnect; public class Database { - private static String connectionString = "jdbc:mysql://" + LoadProperties.MySQLserverName + ":" + LoadProperties.MySQLport + "/" + LoadProperties.MySQLdbName + "?user=" + LoadProperties.MySQLuserName + "&password=" + LoadProperties.MySQLdbPass; + 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 Connection conn = null; private static mcMMO plugin = null; private static long reconnectTimestamp = 0; @@ -61,16 +62,16 @@ public class Database { * Attempt to create the database structure. */ public void createStructure() { - write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL," + write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` (`user_id` int(10) unsigned NOT NULL," + "`hudtype` varchar(50) NOT NULL DEFAULT ''," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); - write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "users` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT," + "`user` varchar(40) NOT NULL," + "`lastlogin` int(32) unsigned NOT NULL," + "`party` varchar(100) NOT NULL DEFAULT ''," + "PRIMARY KEY (`id`)," + "UNIQUE KEY `user` (`user`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"); - write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL," + write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "cooldowns` (`user_id` int(10) unsigned NOT NULL," + "`taming` int(32) unsigned NOT NULL DEFAULT '0'," + "`mining` int(32) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(32) unsigned NOT NULL DEFAULT '0'," @@ -84,7 +85,7 @@ public class Database { + "`acrobatics` int(32) unsigned NOT NULL DEFAULT '0'," + "`blast_mining` int(32) unsigned NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); - write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL," + write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` (`user_id` int(10) unsigned NOT NULL," + "`taming` int(10) unsigned NOT NULL DEFAULT '0'," + "`mining` int(10) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," @@ -97,7 +98,7 @@ public class Database { + "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); - write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL," + write("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL," + "`taming` int(10) unsigned NOT NULL DEFAULT '0'," + "`mining` int(10) unsigned NOT NULL DEFAULT '0'," + "`woodcutting` int(10) unsigned NOT NULL DEFAULT '0'," @@ -127,10 +128,10 @@ public class Database { switch (update) { case BLAST_MINING: - sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"cooldowns` ORDER BY `"+LoadProperties.MySQLtablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30"; + sql = "SELECT * FROM `"+tablePrefix+"cooldowns` ORDER BY `"+tablePrefix+"cooldowns`.`blast_mining` ASC LIMIT 0 , 30"; break; case FISHING: - sql = "SELECT * FROM `"+LoadProperties.MySQLtablePrefix+"experience` ORDER BY `"+LoadProperties.MySQLtablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30"; + sql = "SELECT * FROM `"+tablePrefix+"experience` ORDER BY `"+tablePrefix+"experience`.`fishing` ASC LIMIT 0 , 30"; break; default: break; @@ -153,12 +154,12 @@ public class Database { catch (SQLException ex) { if (update.equals(DatabaseUpdate.BLAST_MINING)) { System.out.println("Updating mcMMO MySQL tables for Blast Mining..."); - write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;"); + write("ALTER TABLE `"+tablePrefix + "cooldowns` ADD `blast_mining` int(32) NOT NULL DEFAULT '0' ;"); } else if (update.equals(DatabaseUpdate.FISHING)) { System.out.println("Updating mcMMO MySQL tables for Fishing..."); - write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); - write("ALTER TABLE `"+LoadProperties.MySQLtablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); + write("ALTER TABLE `"+tablePrefix + "skills` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); + write("ALTER TABLE `"+tablePrefix + "experience` ADD `fishing` int(10) NOT NULL DEFAULT '0' ;"); } } } diff --git a/src/main/java/com/gmail/nossr50/Item.java b/src/main/java/com/gmail/nossr50/Item.java index 1dc461d7d..dc501983a 100644 --- a/src/main/java/com/gmail/nossr50/Item.java +++ b/src/main/java/com/gmail/nossr50/Item.java @@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.Skills; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; public class Item { @@ -21,7 +21,7 @@ public class Item { public static void itemchecks(Player player) { ItemStack inhand = player.getItemInHand(); - if (LoadProperties.chimaeraWingEnable && inhand.getTypeId() == LoadProperties.chimaeraId) { + if (Config.chimaeraWingEnable && inhand.getTypeId() == Config.chimaeraId) { 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() == LoadProperties.chimaeraId) { - if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= LoadProperties.feathersConsumedByChimaeraWing) { - player.setItemInHand(new ItemStack(LoadProperties.chimaeraId, amount - LoadProperties.feathersConsumedByChimaeraWing)); + if (mcPermissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.chimaeraId) { + if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.feathersConsumedByChimaeraWing) { + player.setItemInHand(new ItemStack(Config.chimaeraId, amount - Config.feathersConsumedByChimaeraWing)); 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() >= LoadProperties.feathersConsumedByChimaeraWing) { + else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.feathersConsumedByChimaeraWing) { player.sendMessage(mcLocale.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)})); } - else if (is.getAmount() <= LoadProperties.feathersConsumedByChimaeraWing) { - player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.chimaeraId)); + else if (is.getAmount() <= Config.feathersConsumedByChimaeraWing) { + player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.chimaeraId)); } } } diff --git a/src/main/java/com/gmail/nossr50/Leaderboard.java b/src/main/java/com/gmail/nossr50/Leaderboard.java index d71c3fdde..f6f320e6f 100644 --- a/src/main/java/com/gmail/nossr50/Leaderboard.java +++ b/src/main/java/com/gmail/nossr50/Leaderboard.java @@ -7,7 +7,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerStat; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.Tree; @@ -255,7 +255,7 @@ public class Leaderboard { * @param skillType Skill whose leaderboard is being updated. */ public static void updateLeaderboard(PlayerStat ps, SkillType skillType) { - if (LoadProperties.useMySQL) { + if (Config.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 02fd5f241..6f192d5cf 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/MmoupdateCommand.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.runnables.SQLConversionTask; public class MmoupdateCommand implements CommandExecutor { @@ -42,7 +42,7 @@ public class MmoupdateCommand implements CommandExecutor { * Convert FlatFile data to MySQL data. */ private void convertToMySQL() { - if (!LoadProperties.useMySQL) { + if (!Config.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 944e281e5..ae5c1afe0 100644 --- a/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/general/XprateCommand.java @@ -8,12 +8,12 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.mcLocale; public class XprateCommand implements CommandExecutor { private final mcMMO plugin; - private static int oldrate = LoadProperties.xpGainMultiplier; + private static int oldrate = Config.xpGainMultiplier; public static boolean xpevent = false; public XprateCommand (mcMMO plugin) { @@ -39,10 +39,10 @@ public class XprateCommand implements CommandExecutor { } xpevent = !xpevent; - LoadProperties.xpGainMultiplier = oldrate; + Config.xpGainMultiplier = oldrate; } else { - LoadProperties.xpGainMultiplier = oldrate; + Config.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 = LoadProperties.xpGainMultiplier; + oldrate = Config.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); } - LoadProperties.xpGainMultiplier = m.getInt(args[0]); + Config.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[] {LoadProperties.xpGainMultiplier})); + x.sendMessage(mcLocale.getString("Commands.xprate.started.1", new Object[] {Config.xpGainMultiplier})); } } else { - sender.sendMessage("The XP RATE was modified to " + LoadProperties.xpGainMultiplier); //TODO: Locale + sender.sendMessage("The XP RATE was modified to " + Config.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 32abace56..8cf98f7ff 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java @@ -7,7 +7,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.getspout.spoutapi.player.SpoutPlayer; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.mcLocale; public class McmmoCommand implements CommandExecutor { @@ -18,8 +18,8 @@ public class McmmoCommand implements CommandExecutor { String[] mcSplit = description.split(","); sender.sendMessage(mcSplit); - if (LoadProperties.donateMessage) { - if (LoadProperties.spoutEnabled && sender instanceof SpoutPlayer) { + if (Config.donateMessage) { + if (Config.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 5c7ba0277..89728bb0f 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McremoveCommand.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.mcLocale; public class McremoveCommand implements CommandExecutor { @@ -27,6 +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 usage = ChatColor.RED + "Proper usage is /mcremove "; //TODO: Needs more locale. String success; @@ -46,35 +48,35 @@ public class McremoveCommand implements CommandExecutor { } /* MySQL */ - if (LoadProperties.useMySQL) { + if (Config.getUseMySQL()) { int userId = 0; - userId = mcMMO.database.getInt("SELECT id FROM " + LoadProperties.MySQLtablePrefix + "users WHERE user = '" + playerName + "'"); + userId = mcMMO.database.getInt("SELECT id FROM " + tablePrefix + "users WHERE user = '" + playerName + "'"); if (userId > 0) { mcMMO.database.write("DELETE FROM " - + LoadProperties.MySQLdbName + "." - + LoadProperties.MySQLtablePrefix + "users WHERE " - + LoadProperties.MySQLtablePrefix + "users.id=" + userId); + + databaseName + "." + + tablePrefix + "users WHERE " + + tablePrefix + "users.id=" + userId); mcMMO.database.write("DELETE FROM " - + LoadProperties.MySQLdbName + "." - + LoadProperties.MySQLtablePrefix + "cooldowns WHERE " - + LoadProperties.MySQLtablePrefix + "cooldowns.user_id=" + userId); + + databaseName + "." + + tablePrefix + "cooldowns WHERE " + + tablePrefix + "cooldowns.user_id=" + userId); mcMMO.database.write("DELETE FROM " - + LoadProperties.MySQLdbName + "." - + LoadProperties.MySQLtablePrefix + "huds WHERE " - + LoadProperties.MySQLtablePrefix + "huds.user_id=" + userId); + + databaseName + "." + + tablePrefix + "huds WHERE " + + tablePrefix + "huds.user_id=" + userId); mcMMO.database.write("DELETE FROM " - + LoadProperties.MySQLdbName + "." - + LoadProperties.MySQLtablePrefix + "skills WHERE " - + LoadProperties.MySQLtablePrefix + "skills.user_id=" + userId); + + databaseName + "." + + tablePrefix + "skills WHERE " + + tablePrefix + "skills.user_id=" + userId); mcMMO.database.write("DELETE FROM " - + LoadProperties.MySQLdbName + "." - + LoadProperties.MySQLtablePrefix + "experience WHERE " - + LoadProperties.MySQLtablePrefix + "experience.user_id=" + userId); + + databaseName + "." + + tablePrefix + "experience WHERE " + + tablePrefix + "experience.user_id=" + userId); sender.sendMessage(success); 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 8105ff0d6..f80eb2694 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/MctopCommand.java @@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender; import com.gmail.nossr50.Leaderboard; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.Skills; @@ -19,7 +19,8 @@ public class MctopCommand implements CommandExecutor { @Override 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 (!LoadProperties.useMySQL) { + + if (!Config.getUseMySQL()) { switch (args.length) { case 0: @@ -131,7 +132,8 @@ public class MctopCommand implements CommandExecutor { } private void sqlDisplay(int page, String query, CommandSender sender) { - HashMap> userslist = mcMMO.database.read("SELECT " + query + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + query + " > 0 ORDER BY " + query + " DESC "); + String tablePrefix = Config.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") { sender.sendMessage(mcLocale.getString("Commands.PowerLevel.Leaderboard")); @@ -141,11 +143,11 @@ public class MctopCommand implements CommandExecutor { } for (int i = (page * 10) - 9; i <= (page * 10); i++) { - if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) { + if (i > userslist.size() || mcMMO.database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) { break; } - HashMap> username = mcMMO.database.read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); + HashMap> username = mcMMO.database.read("SELECT user FROM " + tablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); sender.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); } } 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 9eee81314..b6f3b99c7 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent; import com.gmail.nossr50.locale.mcLocale; @@ -44,8 +44,8 @@ public class PtpCommand implements CommandExecutor { return true; } - if (PP.getRecentlyHurt() + (LoadProperties.ptpCommandCooldown * 1000) > System.currentTimeMillis()) { - player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { LoadProperties.ptpCommandCooldown })); + if (PP.getRecentlyHurt() + (Config.ptpCommandCooldown * 1000) > System.currentTimeMillis()) { + player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.ptpCommandCooldown })); 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 c081045d2..fb4d5aadb 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -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[] { LoadProperties.repairDiamondLevel }), mcLocale.getString("Repair.Effect.7") })); + player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.repairDiamondLevel }), 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 2468eea66..9246157ef 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -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[] { LoadProperties.fishConsumedByCOTW })); - player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { LoadProperties.bonesConsumedByCOTW })); + player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.fishConsumedByCOTW })); + player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.bonesConsumedByCOTW })); 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 ba7ce7c6f..d18aed526 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.HUDType; import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.PlayerProfile; @@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor { return true; } - if (!LoadProperties.spoutEnabled || !LoadProperties.xpbar) { + if (!Config.spoutEnabled || !Config.xpbar) { 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 ab4a3e3ba..65c4514a1 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java @@ -10,7 +10,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.CommandHelper; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -26,7 +26,7 @@ public class XplockCommand implements CommandExecutor { return true; } - if (!LoadProperties.spoutEnabled || !LoadProperties.xpbar || !LoadProperties.xplockEnable) { + if (!Config.spoutEnabled || !Config.xpbar || !Config.xplockEnable) { sender.sendMessage(mcLocale.getString("Commands.Disabled")); return true; } diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java deleted file mode 100644 index 81557a7bb..000000000 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ /dev/null @@ -1,482 +0,0 @@ -package com.gmail.nossr50.config; - -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.datatypes.HUDType; - -public class LoadProperties extends ConfigLoader{ - - /* - * GENERAL SETTINGS - */ - - /* General Settings */ - public static String locale; - public static Boolean enableMotd, statsTracking, eventCallback; - public static int saveInterval; - - /* mySQL */ - public static Boolean useMySQL; - public static String MySQLtablePrefix, MySQLuserName, MySQLserverName, MySQLdbName, MySQLdbPass; - public static int MySQLport; - - /* Commands */ - public static Boolean xplockEnable, xprateEnable, mccEnable, mcmmoEnable, - partyEnable, inviteEnable, acceptEnable, inspectEnable, - mcstatsEnable, addxpEnable, ptpEnable, mmoeditEnable, - mcremoveEnable, mcgodEnable, mcabilityEnable, mctopEnable, - addlevelsEnable, mcrefreshEnable, aEnable, pEnable; - public static int ptpCommandCooldown; - public static Boolean donateMessage; - - /* Tool Level Requirements */ - public static Boolean perLevelTools; - public static int sAxe, sHoe, sShovel, sSword, sPickaxe; - public static int iAxe, iHoe, iShovel, iSword, iPickaxe; - public static int gAxe, gHoe, gShovel, gSword, gPickaxe; - public static int dAxe, dHoe, dShovel, dSword, dPickaxe; - - /* Items */ - public static Boolean chimaeraWingEnable; - public static int chimaeraId, feathersConsumedByChimaeraWing; - - /* - * ABILITY SETTINGS - */ - - /* General Settings */ - public static Boolean enableOnlyActivateWhenSneaking, enableAbilityMessages, enableAbilities; - - /* Durability Settings */ - public static Boolean toolsLoseDurabilityFromAbilities; - public static int abilityDurabilityLoss; - - /* Cooldowns */ - public static int superBreakerCooldown, blastMiningCooldown, greenTerraCooldown, - gigaDrillBreakerCooldown, treeFellerCooldown, berserkCooldown, - serratedStrikeCooldown, skullSplitterCooldown; - - /* Thresholds */ - public static int treeFellerThreshold; - - /* - * SKILL SETTINGS - */ - - /* Tool Requirements */ - public static Boolean miningrequirespickaxe, excavationRequiresShovel, woodcuttingrequiresaxe; - - /* Excavation */ - public static int mbase; - - /* Fishing */ - public static Boolean fishingDrops; - public static int fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5; - public static int mfishing; - - /* Herbalism */ - public static Boolean herbalismHungerBonus, wheatRegrowth; - public static int mmelon, mcactus, mmushroom, mflower, msugar, mpumpkin, mwheat, mvines, mlilypad, mnetherwart; - public static Boolean enableCobbleToMossy, enableSmoothToMossy, enableDirtToGrass; - - /* Mining */ - public static int msandstone, mgold, mdiamond, miron, mredstone, mlapis, mobsidian, mnetherrack, mglowstone, mcoal, mstone, mendstone, mmossstone; - public static int detonatorID; - - /* Repair */ - public static Boolean repairArmor, repairTools; - public static Boolean anvilmessages; - public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather; - public static int anvilID; - public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairDiamondLevel, repairStringLevel; - - /* Taming */ - public static int mtameWolf, mtameOcelot; - public static int bonesConsumedByCOTW, fishConsumedByCOTW; - - /* Woodcutting */ - public static int moak, mbirch, mspruce, mjungle; - - /* Arcane Forging */ - public static Boolean mayDowngradeEnchants, mayLoseEnchants; - public static int arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4; - public static int downgradeRank1, downgradeRank2, downgradeRank3, downgradeRank4; - public static int keepEnchantsRank1, keepEnchantsRank2, keepEnchantsRank3, keepEnchantsRank4; - - /* Level Caps */ - public static int levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation, - levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair, - levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting, - powerLevelCap; - - /* - * XP SETTINGS - */ - - /* General Settings */ - public static Boolean xpGainsMobSpawners, pvpxp; - public static int xpGainMultiplier; - - /* Combat XP Multipliers */ - public static double pvpxprewardmodifier; - public static double animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP, - zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP, - blazeXP, magmacubeXP, enderdragonXP, irongolemXP; - - /* XP Formula Multiplier */ - public static double tamingxpmodifier, miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, - fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, - archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier; - - /* - * SPOUT SETTINGS - */ - - public static boolean spoutEnabled; - public static boolean showPowerLevel; - - /* Spout Party HUD */ - public static Boolean showDisplayName, showFaces, partybar; - - /* Spout XP Bar */ - public static Boolean xpbar, xpicon; - public static int xpbar_x, xpbar_y, xpicon_x, xpicon_y; - - /* Spout HUD Colors */ - public static double xpbackground_r, xpbackground_g, xpbackground_b; - public static double xpborder_r, xpborder_g, xpborder_b; - public static double fishing_r, fishing_g, fishing_b; - public static double acrobatics_r, acrobatics_g, acrobatics_b; - public static double archery_r, archery_g, archery_b; - public static double axes_r, axes_g, axes_b; - public static double excavation_r, excavation_g, excavation_b; - public static double herbalism_r, herbalism_g, herbalism_b; - public static double mining_r, mining_g, mining_b; - public static double repair_r, repair_g, repair_b; - public static double swords_r, swords_g, swords_b; - public static double taming_r, taming_g, taming_b; - public static double unarmed_r, unarmed_g, unarmed_b; - public static double woodcutting_r, woodcutting_g, woodcutting_b; - - /* - * CONFIG LOADING - */ - - public static HUDType defaulthud; - - public LoadProperties(mcMMO plugin) { - super(plugin, "config.yml"); - config = plugin.getConfig(); - } - - @Override - public void load() { - - // If it doesn't exist, copy it from the .jar - if (!configFile.exists()) { - dataFolder.mkdir(); - plugin.saveDefaultConfig(); - } - - addDefaults(); - loadKeys(); - } - - @Override - protected void loadKeys() { - plugin.getLogger().info("Loading mcMMO config.yml File..."); - - // Setup default HUD - String temp = config.getString("Spout.HUD.Default", "STANDARD"); - for (HUDType x : HUDType.values()) { - if (x.toString().equalsIgnoreCase(temp)) { - defaulthud = x; - } - } - - enableAbilityMessages = config.getBoolean("Abilities.Messages", true); - enableAbilities = config.getBoolean("Abilities.Enabled", true); - - donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true); - xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); - - bonesConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); - fishConsumedByCOTW = config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); - - xpbar = config.getBoolean("Spout.XP.Bar.Enabled", true); - xpicon = config.getBoolean("Spout.XP.Icon.Enabled", true); - xpbar_x = config.getInt("Spout.XP.Bar.X_POS", 95); - xpbar_y = config.getInt("Spout.XP.Bar.Y_POS", 6); - xpicon_x = config.getInt("Spout.XP.Icon.X_POS", 78); - xpicon_y = config.getInt("Spout.XP.Icon.Y_POS", 2); - - showFaces = config.getBoolean("Spout.Party.HUD.Show_Faces", true); - showDisplayName = config.getBoolean("Spout.Party.HUD.Show_Display_Name", false); - partybar = config.getBoolean("Spout.Party.HUD.Enabled", true); - - showPowerLevel = config.getBoolean("Spout.HUD.Show_Power_Level", true); - - acrobatics_r = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3); - acrobatics_g = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3); - acrobatics_b = config.getDouble("Spout.HUD.Retro.Colors.Acrobatics.BLUE", 0.75); - archery_r = config.getDouble("Spout.HUD.Retro.Colors.Archery.RED", 0.3); - archery_g = config.getDouble("Spout.HUD.Retro.Colors.Archery.GREEN", 0.3); - archery_b = config.getDouble("Spout.HUD.Retro.Colors.Archery.BLUE", 0.75); - axes_r = config.getDouble("Spout.HUD.Retro.Colors.Axes.RED", 0.3); - axes_g = config.getDouble("Spout.HUD.Retro.Colors.Axes.GREEN", 0.3); - axes_b = config.getDouble("Spout.HUD.Retro.Colors.Axes.BLUE", 0.75); - excavation_r = config.getDouble("Spout.HUD.Retro.Colors.Excavation.RED", 0.3); - excavation_g = config.getDouble("Spout.HUD.Retro.Colors.Excavation.GREEN", 0.3); - excavation_b = config.getDouble("Spout.HUD.Retro.Colors.Excavation.BLUE", 0.75); - herbalism_r = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.RED", 0.3); - herbalism_g = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.GREEN", 0.3); - herbalism_b = config.getDouble("Spout.HUD.Retro.Colors.Herbalism.BLUE", 0.75); - mining_r = config.getDouble("Spout.HUD.Retro.Colors.Mining.RED", 0.3); - mining_g = config.getDouble("Spout.HUD.Retro.Colors.Mining.GREEN", 0.3); - mining_b = config.getDouble("Spout.HUD.Retro.Colors.Mining.BLUE", 0.75); - repair_r = config.getDouble("Spout.HUD.Retro.Colors.Repair.RED", 0.3); - repair_g = config.getDouble("Spout.HUD.Retro.Colors.Repair.GREEN", 0.3); - repair_b = config.getDouble("Spout.HUD.Retro.Colors.Repair.BLUE", 0.75); - swords_r = config.getDouble("Spout.HUD.Retro.Colors.Swords.RED", 0.3); - swords_g = config.getDouble("Spout.HUD.Retro.Colors.Swords.GREEN", 0.3); - swords_b = config.getDouble("Spout.HUD.Retro.Colors.Swords.BLUE", 0.75); - taming_r = config.getDouble("Spout.HUD.Retro.Colors.Taming.RED", 0.3); - taming_g = config.getDouble("Spout.HUD.Retro.Colors.Taming.GREEN", 0.3); - taming_b = config.getDouble("Spout.HUD.Retro.Colors.Taming.BLUE", 0.75); - unarmed_r = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.RED", 0.3); - unarmed_g = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.GREEN", 0.3); - unarmed_b = config.getDouble("Spout.HUD.Retro.Colors.Unarmed.BLUE", 0.75); - woodcutting_r = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.RED", 0.3); - woodcutting_g = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.GREEN", 0.3); - woodcutting_b = config.getDouble("Spout.HUD.Retro.Colors.Woodcutting.BLUE", 0.75); - fishing_r = config.getDouble("Spout.HUD.Retro.Colors.Fishing.RED", 0.3); - fishing_g = config.getDouble("Spout.HUD.Retro.Colors.Fishing.GREEN", 0.3); - fishing_b = config.getDouble("Spout.HUD.Retro.Colors.Fishing.BLUE", 0.75); - - xpborder_r = config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); - xpborder_g = config.getDouble("Spout.HUD.Retro.Colors.Border.GREEN", 0.0); - xpborder_b = config.getDouble("Spout.HUD.Retro.Colors.Border.BLUE", 0.0); - xpbackground_r = config.getDouble("Spout.HUD.Retro.Colors.Background.RED", 0.75); - xpbackground_g = config.getDouble("Spout.HUD.Retro.Colors.Background.GREEN", 0.75); - xpbackground_b = config.getDouble("Spout.HUD.Retro.Colors.Background.BLUE", 0.75); - - mbase = config.getInt("Experience.Excavation.Base", 40); - - msugar = config.getInt("Experience.Herbalism.Sugar_Cane", 30); - mwheat = config.getInt("Experience.Herbalism.Wheat", 50); - mcactus = config.getInt("Experience.Herbalism.Cactus", 30); - mpumpkin = config.getInt("Experience.Herbalism.Pumpkin", 20); - mflower = config.getInt("Experience.Herbalism.Flowers", 100); - mmushroom = config.getInt("Experience.Herbalism.Mushrooms", 150); - mmelon = config.getInt("Experience.Herbalism.Melon", 20); - mnetherwart = config.getInt("Experience.Herbalism.Nether_Wart", 50); - mlilypad = config.getInt("Experience.Herbalism.Lily_Pads", 100); - mvines = config.getInt("Experience.Herbalism.Vines", 10); - herbalismHungerBonus = config.getBoolean("Skills.Herbalism.Hunger_Bonus", true); - wheatRegrowth = config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true); - - moak = config.getInt("Experience.Woodcutting.Oak", 70); - mbirch = config.getInt("Experience.Woodcutting.Birch", 90); - mspruce = config.getInt("Experience.Woodcutting.Spruce", 80); - mjungle = config.getInt("Experience.Woodcutting.Jungle", 100); - - mgold = config.getInt("Experience.Mining.Gold", 250); - mdiamond = config.getInt("Experience.Mining.Diamond", 750); - miron = config.getInt("Experience.Mining.Iron", 250); - mredstone = config.getInt("Experience.Mining.Redstone", 150); - mlapis = config.getInt("Experience.Mining.Lapis", 400); - mobsidian = config.getInt("Experience.Mining.Obsidian", 150); - mnetherrack = config.getInt("Experience.Mining.Netherrack", 30); - mglowstone = config.getInt("Experience.Mining.Glowstone", 30); - mcoal = config.getInt("Experience.Mining.Coal", 100); - mstone = config.getInt("Experience.Mining.Stone", 30); - msandstone = config.getInt("Experience.Mining.Sandstone", 30); - mendstone = config.getInt("Experience.Mining.End_Stone", 150); - mmossstone = config.getInt("Experience.Mining.Moss_Stone", 30); - - mtameWolf = config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); - mtameOcelot = config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); - - mfishing = config.getInt("Experience.Fishing.Base", 800); - - enableOnlyActivateWhenSneaking = config.getBoolean("Abilities.Activation.Only_Activate_When_Sneaking", false); - - greenTerraCooldown = config.getInt("Abilities.Cooldowns.Green_Terra", 240); - superBreakerCooldown = config.getInt("Abilities.Cooldowns.Super_Breaker", 240); - gigaDrillBreakerCooldown = config.getInt("Abilities.Cooldowns.Giga_Drill_Breaker", 240); - treeFellerThreshold = config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); - treeFellerCooldown = config.getInt("Abilities.Cooldowns.Tree_Feller", 240); - berserkCooldown = config.getInt("Abilities.Cooldowns.Berserk", 240); - serratedStrikeCooldown = config.getInt("Abilities.Cooldowns.Serrated_Strikes", 240); - skullSplitterCooldown = config.getInt("Abilities.Cooldowns.Skull_Splitter", 240); - blastMiningCooldown = config.getInt("Abilities.Cooldowns.Blast_Mining", 60); - - MySQLserverName = config.getString("MySQL.Server.Address", "localhost"); - - if (config.getString("MySQL.Database.User_Password", null) != null) { - MySQLdbPass = config.getString("MySQL.Database.User_Password", null); - } - else { - MySQLdbPass = ""; - } - - MySQLdbName = config.getString("MySQL.Database.Name", "DatabaseName"); - MySQLuserName = config.getString("MySQL.Database.User_Name", "UserName"); - MySQLtablePrefix = config.getString("MySQL.Database.TablePrefix", "mcmmo_"); - MySQLport = config.getInt("MySQL.Server.Port", 3306); - useMySQL = config.getBoolean("MySQL.Enabled", false); - - locale = config.getString("General.Locale", "en_us"); - enableMotd = config.getBoolean("General.MOTD_Enabled", true); - saveInterval = config.getInt("General.Save_Interval", 10); - statsTracking = config.getBoolean("General.Stats_Tracking", true); - eventCallback = config.getBoolean("General.Event_Callback", true); - perLevelTools = config.getBoolean("General.Per_Level_Tools", false); - powerLevelCap = config.getInt("General.Power_Level_Cap", 0); - - enableCobbleToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); - enableSmoothToMossy = config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); - enableDirtToGrass = config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); - - xpGainMultiplier = config.getInt("Experience.Gains.Multiplier.Global", 1); - toolsLoseDurabilityFromAbilities = config.getBoolean("Abilities.Tools.Durability_Loss_Enabled", true); - abilityDurabilityLoss = config.getInt("Abilities.Tools.Durability_Loss", 2); - - feathersConsumedByChimaeraWing = config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); - chimaeraId = config.getInt("Items.Chimaera_Wing.Item_ID", 288); - chimaeraWingEnable = config.getBoolean("Items.Chimaera_Wing.Enabled", true); - dAxe = config.getInt("Items.Diamond.Axe", 750); - dHoe = config.getInt("Items.Diamond.Hoe", 750); - dShovel = config.getInt("Items.Diamond.Shovel", 750); - dSword = config.getInt("Items.Diamond.Sword", 750); - dPickaxe = config.getInt("Items.Diamond.Pickaxe", 750); - gAxe = config.getInt("Items.Gold.Axe", 500); - gHoe = config.getInt("Items.Gold.Hoe", 500); - gShovel = config.getInt("Items.Gold.Shovel", 500); - gSword = config.getInt("Items.Gold.Sword", 500); - gPickaxe = config.getInt("Items.Gold.Pickaxe", 500); - iAxe = config.getInt("Items.Iron.Axe", 250); - iHoe = config.getInt("Items.Iron.Hoe", 250); - iShovel = config.getInt("Items.Iron.Shovel", 250); - iSword = config.getInt("Items.Iron.Sword", 250); - iPickaxe = config.getInt("Items.Iron.Pickaxe", 250); - sAxe = config.getInt("Items.Stone.Axe", 0); - sHoe = config.getInt("Items.Stone.Hoe", 0); - sShovel = config.getInt("Items.Stone.Shovel", 0); - sSword = config.getInt("Items.Stone.Sword", 0); - sPickaxe = config.getInt("Items.Stone.Pickaxe", 0); - - pvpxp = config.getBoolean("Experience.PVP.Rewards", true); - pvpxprewardmodifier = config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); - - miningrequirespickaxe = config.getBoolean("Skills.Mining.Requires_Pickaxe", true); - excavationRequiresShovel = config.getBoolean("Skills.Excavation.Requires_Shovel", true); - woodcuttingrequiresaxe = config.getBoolean("Skills.Woodcutting.Requires_Axe", true); - repairArmor = config.getBoolean("Skills.Repair.Can_Repair_Armor", true); - repairTools = config.getBoolean("Skills.Repair.Can_Repair_Tools", true); - repairDiamondLevel = config.getInt("Skills.Repair.Diamond.Level_Required", 50); - repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0); - repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0); - repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0); - repairStringLevel = config.getInt("Skills.Repair.String.Level_Required", 0); - - tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); - miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); - repairxpmodifier = config.getDouble("Experience.Formula.Multiplier.Repair", 1.0); - woodcuttingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Woodcutting", 1.0); - unarmedxpmodifier = config.getDouble("Experience.Formula.Multiplier.Unarmed", 1.0); - herbalismxpmodifier = config.getDouble("Experience.Formula.Multiplier.Herbalism", 1.0); - excavationxpmodifier = config.getDouble("Experience.Formula.Multiplier.Excavation", 1.0); - archeryxpmodifier = config.getDouble("Experience.Formula.Multiplier.Archery", 1.0); - swordsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Swords", 1.0); - axesxpmodifier = config.getDouble("Experience.Formula.Multiplier.Axes", 1.0); - acrobaticsxpmodifier = config.getDouble("Experience.Formula.Multiplier.Acrobatics", 1.0); - fishingxpmodifier = config.getDouble("Experience.Forumla.Multiplier.Fishing", 1.0); - - anvilmessages = config.getBoolean("Skills.Repair.Anvil_Messages", true); - anvilID = config.getInt("Skills.Repair.Anvil_ID", 42); - - rGold = config.getInt("Skills.Repair.Gold.ID", 266); - rStone = config.getInt("Skills.Repair.Stone.ID", 4); - rWood = config.getInt("Skills.Repair.Wood.ID", 5); - rDiamond = config.getInt("Skills.Repair.Diamond.ID", 264); - rIron = config.getInt("Skills.Repair.Iron.ID", 265); - rString = config.getInt("Skills.Repair.String.ID", 287); - rLeather = config.getInt("Skills.Repair.Leather.ID", 334); - - levelCapAcrobatics = config.getInt("Skills.Acrobatics.Level_Cap", 0); - levelCapArchery = config.getInt("Skills.Archery.Level_Cap", 0); - levelCapAxes = config.getInt("Skills.Axes.Level_Cap", 0); - levelCapExcavation = config.getInt("Skills.Excavation.Level_Cap", 0); - levelCapFishing = config.getInt("Skills.Fishing.Level_Cap", 0); - levelCapHerbalism = config.getInt("Skills.Herbalism.Level_Cap", 0); - levelCapMining = config.getInt("Skills.Mining.Level_Cap", 0); - levelCapRepair = config.getInt("Skills.Repair.Level_Cap", 0); - levelCapSwords = config.getInt("Skills.Swords.Level_Cap", 0); - levelCapTaming = config.getInt("Skills.Taming.Level_Cap", 0); - levelCapUnarmed = config.getInt("Skills.Unarmed.Level_Cap", 0); - levelCapWoodcutting = config.getInt("Skills.Woodcutting.Level_Cap", 0); - - mayDowngradeEnchants = config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); - downgradeRank1 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); - downgradeRank2 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); - downgradeRank3 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); - downgradeRank4 = config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); - mayLoseEnchants = config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); - keepEnchantsRank1 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); - keepEnchantsRank2 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); - keepEnchantsRank3 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); - keepEnchantsRank4 = config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); - arcaneRank1 = config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); - arcaneRank2 = config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); - arcaneRank3 = config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); - arcaneRank4 = config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); - - fishingDrops = config.getBoolean("Fishing.Drops_Enabled", true); - fishingTier1 = config.getInt("Fishing.Tier_Levels.Tier1", 0); - fishingTier2 = config.getInt("Fishing.Tier_Levels.Tier2", 200); - fishingTier3 = config.getInt("Fishing.Tier_Levels.Tier3", 400); - fishingTier4 = config.getInt("Fishing.Tier_Levels.Tier4", 600); - fishingTier5 = config.getInt("Fishing.Tier_Levels.Tier5", 800); - - xplockEnable = config.getBoolean("Commands.xplock.Enabled", true); - xprateEnable = config.getBoolean("Commands.xprate.Enabled", true); - mctopEnable = config.getBoolean("Commands.mctop.Enabled", true); - addxpEnable = config.getBoolean("Commands.addxp.Enabled", true); - addlevelsEnable = config.getBoolean("Commands.addlevels.Enabled", true); - mcabilityEnable = config.getBoolean("Commands.mcability.Enabled", true); - mcrefreshEnable = config.getBoolean("Commands.mcrefresh.Enabled", true); - mcmmoEnable = config.getBoolean("Commands.mcmmo.Enabled", true); - mccEnable = config.getBoolean("Commands.mcc.Enabled", true); - mcgodEnable = config.getBoolean("Commands.mcgod.Enabled", true); - mcstatsEnable = config.getBoolean("Commands.mcstats.Enabled", true); - mmoeditEnable = config.getBoolean("Commands.mmoedit.Enabled", true); - mcremoveEnable = config.getBoolean("Commands.mcremove.Enable", true); - ptpEnable = config.getBoolean("Commands.ptp.Enabled", true); - partyEnable = config.getBoolean("Commands.party.Enabled", true); - inspectEnable = config.getBoolean("Commands.inspect.Enabled", true); - inviteEnable = config.getBoolean("Commands.invite.Enabled", true); - acceptEnable = config.getBoolean("Commands.accept.Enabled", true); - aEnable = config.getBoolean("Commands.a.Enabled", true); - pEnable = config.getBoolean("Commands.p.Enabled", true); - - ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30); - - animalXP = config.getDouble("Experience.Combat.Multiplier.Animals", 1.0); - creeperXP = config.getDouble("Experience.Combat.Multiplier.Creeper", 4.0); - skeletonXP = config.getDouble("Experience.Combat.Multiplier.Skeleton", 2.0); - spiderXP = config.getDouble("Experience.Combat.Multiplier.Spider", 3.0); - ghastXP = config.getDouble("Experience.Combat.Multiplier.Ghast", 3.0); - slimeXP = config.getDouble("Experience.Combat.Multiplier.Slime", 2.0); - zombieXP = config.getDouble("Experience.Combat.Multiplier.Zombie", 2.0); - pigzombieXP = config.getDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); - endermanXP = config.getDouble("Experience.Combat.Multiplier.Enderman", 2.0); - cavespiderXP = config.getDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); - silverfishXP = config.getDouble("Experience.Combat.Multiplier.Silverfish", 3.0); - blazeXP = config.getDouble("Experience.Combat.Multiplier.Blaze", 3.0); - magmacubeXP = config.getDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); - enderdragonXP = config.getDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); - irongolemXP = config.getDouble("Experience.Combat.Multiplier.Iron_Golem", 2.0); - - detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259); - } -} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/LoadTreasures.java b/src/main/java/com/gmail/nossr50/config/LoadTreasures.java index f7d42d147..b9f23c9de 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 <= LoadProperties.fishingTier1 && maxLevel >= LoadProperties.fishingTier1) { + if(dropLevel <= Config.fishingTier1 && maxLevel >= Config.fishingTier1) { fishingRewardsTier1.add(fTreasure); } - if(dropLevel <= LoadProperties.fishingTier2 && maxLevel >= LoadProperties.fishingTier2) { + if(dropLevel <= Config.fishingTier2 && maxLevel >= Config.fishingTier2) { fishingRewardsTier2.add(fTreasure); } - if (dropLevel <= LoadProperties.fishingTier3 && maxLevel >= LoadProperties.fishingTier3) { + if (dropLevel <= Config.fishingTier3 && maxLevel >= Config.fishingTier3) { fishingRewardsTier3.add(fTreasure); } - if (dropLevel <= LoadProperties.fishingTier4 && maxLevel >= LoadProperties.fishingTier4) { + if (dropLevel <= Config.fishingTier4 && maxLevel >= Config.fishingTier4) { fishingRewardsTier4.add(fTreasure); } - if (dropLevel <= LoadProperties.fishingTier5 && maxLevel >= LoadProperties.fishingTier5) { + if (dropLevel <= Config.fishingTier5 && maxLevel >= Config.fishingTier5) { 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 32ee9f856..b65e30479 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/AbilityType.java @@ -4,7 +4,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.Excavation; import com.gmail.nossr50.skills.Herbalism; @@ -12,7 +12,7 @@ import com.gmail.nossr50.skills.Mining; public enum AbilityType { BERSERK( - LoadProperties.berserkCooldown, + Config.berserkCooldown, "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( - LoadProperties.superBreakerCooldown, + Config.superBreakerCooldown, "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( - LoadProperties.gigaDrillBreakerCooldown, + Config.gigaDrillBreakerCooldown, "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( - LoadProperties.greenTerraCooldown, + Config.greenTerraCooldown, "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( - LoadProperties.skullSplitterCooldown, + Config.skullSplitterCooldown, "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( - LoadProperties.treeFellerCooldown, + Config.treeFellerCooldown, "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( - LoadProperties.serratedStrikeCooldown, + Config.serratedStrikeCooldown, "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( - LoadProperties.blastMiningCooldown, + Config.blastMiningCooldown, 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 bf9fe778f..15913d4f3 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java +++ b/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java @@ -12,7 +12,7 @@ import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutStuff; public class HUDmmo { @@ -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) LoadProperties.xpborder_r, (float) LoadProperties.xpborder_g, (float) LoadProperties.xpborder_b, 1f); + Color border = new Color((float) Config.getSpoutRetroHUDXPBorderRed(), (float) Config.getSpoutRetroHUDXPBorderGreen(), (float) Config.getSpoutRetroHUDXPBorderBlue(), 1f); Color green = new Color(0f, 1f, 0f, 1f); - Color background = new Color((float) LoadProperties.xpbackground_r, (float) LoadProperties.xpbackground_g, (float) LoadProperties.xpbackground_b, 1f); + Color background = new Color((float) Config.getSpoutRetroHUDXPBackgroundRed(), (float) Config.getSpoutRetroHUDXPBackgroundGreen(), (float) Config.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 (LoadProperties.xpbar) { + if (Config.xpbar) { sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpfill); sPlayer.getMainScreen().attachWidget(plugin, xpbg); - if (LoadProperties.xpicon) { + if (Config.xpicon) { 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 (LoadProperties.xpbar) { + if (Config.xpbar) { xpbar = new GenericTexture(); ((GenericTexture) xpbar).setUrl("xpbar_inc000.png"); - xpbar.setX(LoadProperties.xpbar_x); - xpbar.setY(LoadProperties.xpbar_y); + xpbar.setX(Config.xpbar_x); + xpbar.setY(Config.xpbar_y); xpbar.setHeight(8); xpbar.setWidth(256); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (LoadProperties.xpicon) { + if (Config.xpicon) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(16); xpicon.setWidth(32); - xpicon.setX(LoadProperties.xpicon_x); - xpicon.setY(LoadProperties.xpicon_y); + xpicon.setX(Config.xpicon_x); + xpicon.setY(Config.xpicon_y); 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 (LoadProperties.xpbar) { + if (Config.xpbar) { xpbar = new GenericTexture(); ((GenericTexture)xpbar).setUrl("xpbar_inc000.png"); xpbar.setX(center_x - 64); - xpbar.setY(LoadProperties.xpbar_y); + xpbar.setY(Config.xpbar_y); xpbar.setHeight(4); xpbar.setWidth(128); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (LoadProperties.xpicon) { + if (Config.xpicon) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(8); xpicon.setWidth(16); xpicon.setX(center_x - (8 + 64)); - xpicon.setY(LoadProperties.xpicon_y + 2); + xpicon.setY(Config.xpicon_y + 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 (!LoadProperties.xpbar) { + if (!Config.xpbar) { return; } @@ -302,7 +302,7 @@ public class HUDmmo { * @param PP Profile of the given player */ private void updateXpBarRetro(Player player, PlayerProfile PP) { - if (!LoadProperties.xpbar) { + if (!Config.xpbar) { return; } @@ -327,40 +327,40 @@ public class HUDmmo { private static Color getRetroColor(SkillType type) { switch (type) { case ACROBATICS: - return new Color((float) LoadProperties.acrobatics_r, (float) LoadProperties.acrobatics_g, (float) LoadProperties.acrobatics_b, 1f); + return new Color((float) Config.getSpoutRetroHUDAcrobaticsRed(), (float) Config.getSpoutRetroHUDAcrobaticsGreen(), (float) Config.getSpoutRetroHUDAcrobaticsBlue(), 1f); case ARCHERY: - return new Color((float) LoadProperties.archery_r, (float) LoadProperties.archery_g, (float) LoadProperties.archery_b, 1f); + return new Color((float) Config.getSpoutRetroHUDArcheryRed(), (float) Config.getSpoutRetroHUDArcheryGreen(), (float) Config.getSpoutRetroHUDArcheryBlue(), 1f); case AXES: - return new Color((float) LoadProperties.axes_r, (float) LoadProperties.axes_g, (float) LoadProperties.axes_b, 1f); + return new Color((float) Config.getSpoutRetroHUDAxesRed(), (float) Config.getSpoutRetroHUDAxesGreen(), (float) Config.getSpoutRetroHUDAxesBlue(), 1f); case EXCAVATION: - return new Color((float) LoadProperties.excavation_r, (float) LoadProperties.excavation_g, (float) LoadProperties.excavation_b, 1f); + return new Color((float) Config.getSpoutRetroHUDExcavationRed(), (float) Config.getSpoutRetroHUDExcavationGreen(), (float) Config.getSpoutRetroHUDExcavationBlue(), 1f); case HERBALISM: - return new Color((float) LoadProperties.herbalism_r, (float) LoadProperties.herbalism_g, (float) LoadProperties.herbalism_b, 1f); + return new Color((float) Config.getSpoutRetroHUDHerbalismRed(), (float) Config.getSpoutRetroHUDHerbalismGreen(), (float) Config.getSpoutRetroHUDHerbalismBlue(), 1f); case MINING: - return new Color((float) LoadProperties.mining_r, (float) LoadProperties.mining_g, (float) LoadProperties.mining_b, 1f); + return new Color((float) Config.getSpoutRetroHUDMiningRed(), (float) Config.getSpoutRetroHUDMiningGreen(), (float) Config.getSpoutRetroHUDMiningBlue(), 1f); case REPAIR: - return new Color((float) LoadProperties.repair_r, (float) LoadProperties.repair_g, (float) LoadProperties.repair_b, 1f); + return new Color((float) Config.getSpoutRetroHUDRepairRed(), (float) Config.getSpoutRetroHUDRepairGreen(), (float) Config.getSpoutRetroHUDRepairBlue(), 1f); case SWORDS: - return new Color((float) LoadProperties.swords_r, (float) LoadProperties.swords_g, (float) LoadProperties.swords_b, 1f); + return new Color((float) Config.getSpoutRetroHUDSwordsRed(), (float) Config.getSpoutRetroHUDSwordsGreen(), (float) Config.getSpoutRetroHUDSwordsBlue(), 1f); case TAMING: - return new Color((float) LoadProperties.taming_r, (float) LoadProperties.taming_g, (float) LoadProperties.taming_b, 1f); + return new Color((float) Config.getSpoutRetroHUDTamingRed(), (float) Config.getSpoutRetroHUDTamingGreen(), (float) Config.getSpoutRetroHUDTamingBlue(), 1f); case UNARMED: - return new Color((float) LoadProperties.unarmed_r, (float) LoadProperties.unarmed_g, (float) LoadProperties.unarmed_b, 1f); + return new Color((float) Config.getSpoutRetroHUDUnarmedRed(), (float) Config.getSpoutRetroHUDUnarmedGreen(), (float) Config.getSpoutRetroHUDUnarmedBlue(), 1f); case WOODCUTTING: - return new Color((float) LoadProperties.woodcutting_r, (float) LoadProperties.woodcutting_g, (float) LoadProperties.woodcutting_b, 1f); + return new Color((float) Config.getSpoutRetroHUDWoodcuttingRed(), (float) Config.getSpoutRetroHUDWoodcuttingGreen(), (float) Config.getSpoutRetroHUDWoodcuttingBlue(), 1f); case FISHING: - return new Color((float) LoadProperties.fishing_r, (float) LoadProperties.fishing_g, (float) LoadProperties.fishing_b, 1f); + return new Color((float) Config.getSpoutRetroHUDFishingRed(), (float) Config.getSpoutRetroHUDFishingGreen(), (float) Config.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 7f43f8747..ebd751865 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -10,7 +10,7 @@ import java.util.ArrayList; import org.bukkit.GameMode; import org.bukkit.entity.Player; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.Users; @@ -30,6 +30,7 @@ public class PlayerProfile { /* Party Stuff */ private String party; private String invite; + private String tablePrefix = Config.getMySQLTablePrefix(); /* Toggles */ private boolean loaded = false; @@ -63,7 +64,7 @@ public class PlayerProfile { private String location = mcMMO.usersFile; public PlayerProfile(String name, boolean addNew) { - hud = LoadProperties.defaulthud; + hud = Config.defaulthud; playerName = name; for (AbilityType abilityType : AbilityType.values()) { @@ -77,7 +78,7 @@ public class PlayerProfile { } } - if (LoadProperties.useMySQL) { + if (Config.getUseMySQL()) { if (!loadMySQL() && addNew) { addMySQLPlayer(); } @@ -100,15 +101,15 @@ public class PlayerProfile { public boolean loadMySQL() { int id = 0; - id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); + id = mcMMO.database.getInt("SELECT id FROM "+tablePrefix+"users WHERE user = '" + playerName + "'"); if(id == 0) return false; this.userid = id; if (id > 0) { - HashMap> huds = mcMMO.database.read("SELECT hudtype FROM "+LoadProperties.MySQLtablePrefix+"huds WHERE user_id = " + id); + HashMap> huds = mcMMO.database.read("SELECT hudtype FROM "+tablePrefix+"huds WHERE user_id = " + id); if(huds.get(1) == null) { - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"huds (user_id) VALUES ("+id+")"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"huds (user_id) VALUES ("+id+")"); } else { if(huds.get(1).get(0) != null) { @@ -120,20 +121,20 @@ public class PlayerProfile { } } } else { - hud = LoadProperties.defaulthud; + hud = Config.defaulthud; } } - HashMap> users = mcMMO.database.read("SELECT lastlogin, party FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = " + id); + HashMap> users = mcMMO.database.read("SELECT lastlogin, party FROM "+tablePrefix+"users WHERE id = " + id); //lastlogin = Integer.parseInt(users.get(1).get(0)); party = users.get(1).get(1); - HashMap> cooldowns = mcMMO.database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM "+LoadProperties.MySQLtablePrefix+"cooldowns WHERE user_id = " + id); + HashMap> cooldowns = mcMMO.database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM "+tablePrefix+"cooldowns WHERE user_id = " + id); /* * I'm still learning MySQL, this is a fix for adding a new table * its not pretty but it works */ if(cooldowns.get(1) == null) { - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"cooldowns (user_id) VALUES ("+id+")"); } else { @@ -146,7 +147,7 @@ public class PlayerProfile { skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldowns.get(1).get(6))); skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldowns.get(1).get(7))); } - HashMap> stats = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"skills WHERE user_id = " + id); + HashMap> stats = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+tablePrefix+"skills WHERE user_id = " + id); skills.put(SkillType.TAMING, Integer.valueOf(stats.get(1).get(0))); skills.put(SkillType.MINING, Integer.valueOf(stats.get(1).get(1))); skills.put(SkillType.REPAIR, Integer.valueOf(stats.get(1).get(2))); @@ -159,7 +160,7 @@ public class PlayerProfile { skills.put(SkillType.AXES, Integer.valueOf(stats.get(1).get(9))); skills.put(SkillType.ACROBATICS, Integer.valueOf(stats.get(1).get(10))); skills.put(SkillType.FISHING, Integer.valueOf(stats.get(1).get(11))); - HashMap> experience = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id); + HashMap> experience = mcMMO.database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM "+tablePrefix+"experience WHERE user_id = " + id); skillsXp.put(SkillType.TAMING, Integer.valueOf(experience.get(1).get(0))); skillsXp.put(SkillType.MINING, Integer.valueOf(experience.get(1).get(1))); skillsXp.put(SkillType.REPAIR, Integer.valueOf(experience.get(1).get(2))); @@ -182,11 +183,11 @@ public class PlayerProfile { public void addMySQLPlayer() { int id = 0; - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 +")"); - id = mcMMO.database.getInt("SELECT id FROM "+LoadProperties.MySQLtablePrefix+"users WHERE user = '" + playerName + "'"); - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")"); - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")"); - mcMMO.database.write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 +")"); + id = mcMMO.database.getInt("SELECT id FROM "+tablePrefix+"users WHERE user = '" + playerName + "'"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"cooldowns (user_id) VALUES ("+id+")"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"skills (user_id) VALUES ("+id+")"); + mcMMO.database.write("INSERT INTO "+tablePrefix+"experience (user_id) VALUES ("+id+")"); this.userid = id; } @@ -298,13 +299,13 @@ public class PlayerProfile { { Long timestamp = System.currentTimeMillis()/1000; //Convert to seconds // if we are using mysql save to database - if (LoadProperties.useMySQL) + if (Config.getUseMySQL()) { - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"huds SET " + mcMMO.database.write("UPDATE "+tablePrefix+"huds SET " +" hudtype = '"+hud.toString()+"' WHERE user_id = "+this.userid); - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid); - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid); - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"cooldowns SET " + mcMMO.database.write("UPDATE "+tablePrefix+"users SET lastlogin = " + timestamp.intValue() + " WHERE id = " + this.userid); + mcMMO.database.write("UPDATE "+tablePrefix+"users SET party = '"+this.party+"' WHERE id = " +this.userid); + mcMMO.database.write("UPDATE "+tablePrefix+"cooldowns SET " +" mining = " + skillsDATS.get(AbilityType.SUPER_BREAKER) +", woodcutting = " + skillsDATS.get(AbilityType.TREE_FELLER) +", unarmed = " + skillsDATS.get(AbilityType.BERSERK) @@ -314,7 +315,7 @@ public class PlayerProfile { +", axes = " + skillsDATS.get(AbilityType.SKULL_SPLIITER) +", blast_mining = " + skillsDATS.get(AbilityType.BLAST_MINING) +" WHERE user_id = "+this.userid); - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills SET " + mcMMO.database.write("UPDATE "+tablePrefix+"skills SET " +" taming = "+skills.get(SkillType.TAMING) +", mining = "+skills.get(SkillType.MINING) +", repair = "+skills.get(SkillType.REPAIR) @@ -328,7 +329,7 @@ public class PlayerProfile { +", acrobatics = "+skills.get(SkillType.ACROBATICS) +", fishing = "+skills.get(SkillType.FISHING) +" WHERE user_id = "+this.userid); - mcMMO.database.write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET " + mcMMO.database.write("UPDATE "+tablePrefix+"experience SET " +" taming = "+skillsXp.get(SkillType.TAMING) +", mining = "+skillsXp.get(SkillType.MINING) +", repair = "+skillsXp.get(SkillType.REPAIR) @@ -476,7 +477,7 @@ public class PlayerProfile { out.append(0+":"); //DATS out.append(0+":"); //DATS out.append(0+":"); //DATS - out.append(LoadProperties.defaulthud.toString()+":");//HUD + out.append(Config.defaulthud.toString()+":");//HUD out.append(0+":"); //Fishing out.append(0+":"); //FishingXP out.append(0+":"); //Blast Mining @@ -1022,7 +1023,7 @@ public class PlayerProfile { * @param newValue The amount of XP to add */ public void addXPOverrideBonus(SkillType skillType, int newValue) { - int xp = newValue * LoadProperties.xpGainMultiplier; + int xp = newValue * Config.xpGainMultiplier; addXPOverride(skillType, xp); } @@ -1047,7 +1048,7 @@ public class PlayerProfile { bonusModifier = partyModifier(skillType); } - int xp = (int) (newValue / skillType.getXpModifier()) * LoadProperties.xpGainMultiplier; + int xp = (int) (newValue / skillType.getXpModifier()) * Config.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 d00d249dd..f2ff7e36b 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/SkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/SkillType.java @@ -4,22 +4,22 @@ import org.bukkit.entity.Player; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; public enum SkillType { - ACROBATICS(LoadProperties.levelCapAcrobatics, LoadProperties.acrobaticsxpmodifier), + ACROBATICS(Config.getLevelCapAcrobatics(), Config.getFormulaMultiplierAcrobatics()), ALL, //This one is just for convenience - ARCHERY(LoadProperties.levelCapArchery, LoadProperties.archeryxpmodifier), - AXES(AbilityType.SKULL_SPLIITER, LoadProperties.levelCapAxes, ToolType.AXE, LoadProperties.axesxpmodifier), - EXCAVATION(AbilityType.GIGA_DRILL_BREAKER, LoadProperties.levelCapExcavation, ToolType.SHOVEL, LoadProperties.excavationxpmodifier), - FISHING(LoadProperties.levelCapFishing, LoadProperties.fishingxpmodifier), - HERBALISM(AbilityType.GREEN_TERRA, LoadProperties.levelCapHerbalism, ToolType.HOE, LoadProperties.herbalismxpmodifier), - MINING(AbilityType.SUPER_BREAKER, LoadProperties.levelCapMining, ToolType.PICKAXE, LoadProperties.miningxpmodifier), - REPAIR(LoadProperties.levelCapRepair, LoadProperties.repairxpmodifier), - SWORDS(AbilityType.SERRATED_STRIKES, LoadProperties.levelCapSwords, ToolType.SWORD, LoadProperties.swordsxpmodifier), - TAMING(LoadProperties.levelCapTaming, LoadProperties.tamingxpmodifier), - UNARMED(AbilityType.BERSERK, LoadProperties.levelCapUnarmed, ToolType.FISTS, LoadProperties.unarmedxpmodifier), - WOODCUTTING(AbilityType.TREE_FELLER, LoadProperties.levelCapWoodcutting, ToolType.AXE, LoadProperties.woodcuttingxpmodifier); + 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()); private AbilityType ability; private int maxLevel; diff --git a/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java b/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java index ce832c0e8..3ae216084 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java +++ b/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Player; import org.getspout.spoutapi.gui.GenericLabel; import org.getspout.spoutapi.gui.GenericPopup; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.buttons.ButtonEscape; import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle; @@ -39,7 +39,7 @@ public class PopupMMO extends GenericPopup { HUDButton.setY(center_y / 2); HUDButton.setDirty(true); - if (LoadProperties.partybar) { + if (Config.partybar) { PartyButton = new ButtonPartyToggle(PP); PartyButton.setX(center_x - (PartyButton.getWidth() / 2)); PartyButton.setY((center_y / 2) + PartyButton.getHeight()); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index 93537481e..74d48ec5a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -7,7 +7,7 @@ import com.gmail.nossr50.ItemChecks; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.Users; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -118,7 +118,7 @@ public class mcBlockListener implements Listener { block.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true)); } - if (id == LoadProperties.anvilID && LoadProperties.anvilmessages) { + if (id == Config.anvilID && Config.anvilmessages) { Repair.placedAnvilCheck(player, id); } } @@ -163,10 +163,10 @@ public class mcBlockListener implements Listener { */ if (mcPermissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) { - if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) { + if (Config.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) { Mining.miningBlockCheck(player, block); } - else if (!LoadProperties.miningrequirespickaxe) { + else if (!Config.miningrequirespickaxe) { Mining.miningBlockCheck(player, block); } } @@ -176,10 +176,10 @@ public class mcBlockListener implements Listener { */ if (mcPermissions.getInstance().woodcutting(player) && mat.equals(Material.LOG)) { - if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) { + if (Config.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) { WoodCutting.woodcuttingBlockCheck(player, block); } - else if (!LoadProperties.woodcuttingrequiresaxe) { + else if (!Config.woodcuttingrequiresaxe) { WoodCutting.woodcuttingBlockCheck(player, block); } } @@ -193,10 +193,10 @@ public class mcBlockListener implements Listener { */ if (Excavation.canBeGigaDrillBroken(mat) && mcPermissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) { - if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) { + if (Config.excavationRequiresShovel && ItemChecks.isShovel(inhand)) { Excavation.excavationProcCheck(block, player); } - else if (!LoadProperties.excavationRequiresShovel) { + else if (!Config.excavationRequiresShovel) { Excavation.excavationProcCheck(block, player); } } @@ -244,7 +244,7 @@ public class mcBlockListener implements Listener { } /* TREE FELLER SOUNDS */ - if (LoadProperties.spoutEnabled && mat.equals(Material.LOG) && PP.getAbilityMode(AbilityType.TREE_FELLER)) { + if (Config.spoutEnabled && mat.equals(Material.LOG) && PP.getAbilityMode(AbilityType.TREE_FELLER)) { SpoutSounds.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation()); } @@ -255,11 +255,11 @@ public class mcBlockListener implements Listener { Herbalism.greenTerra(player, block); } else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) { - if (LoadProperties.excavationRequiresShovel && ItemChecks.isShovel(inhand)) { + if (Config.excavationRequiresShovel && ItemChecks.isShovel(inhand)) { event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } - else if (!LoadProperties.excavationRequiresShovel) { + else if (!Config.excavationRequiresShovel) { event.setInstaBreak(true); Excavation.gigaDrillBreaker(player, block); } @@ -272,28 +272,28 @@ public class mcBlockListener implements Listener { event.setInstaBreak(true); } - if (LoadProperties.spoutEnabled) { + if (Config.spoutEnabled) { SpoutSounds.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } } else if (PP.getAbilityMode(AbilityType.SUPER_BREAKER) && Skills.triggerCheck(player, block, AbilityType.SUPER_BREAKER)) { - if (LoadProperties.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) { + if (Config.miningrequirespickaxe && ItemChecks.isMiningPick(inhand)) { event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block); } - else if (!LoadProperties.miningrequirespickaxe) { + else if (!Config.miningrequirespickaxe) { event.setInstaBreak(true); Mining.SuperBreakerBlockCheck(player, block); } } else if (PP.getSkillLevel(SkillType.WOODCUTTING) >= LEAF_BLOWER_LEVEL && mat.equals(Material.LEAVES)) { - if (LoadProperties.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) { + if (Config.woodcuttingrequiresaxe && ItemChecks.isAxe(inhand)) { if (Skills.triggerCheck(player, block, AbilityType.LEAF_BLOWER)) { event.setInstaBreak(true); WoodCutting.leafBlower(player, block); } } - else if (!LoadProperties.woodcuttingrequiresaxe && !inhand.getType().equals(Material.SHEARS)) { + else if (!Config.woodcuttingrequiresaxe && !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/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index 49423cfe5..f8e10e515 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -27,7 +27,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; @@ -165,7 +165,7 @@ public class mcEntityListener implements Listener { public void onCreatureSpawn(CreatureSpawnEvent event) { SpawnReason reason = event.getSpawnReason(); - if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !LoadProperties.xpGainsMobSpawners) { + if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.xpGainsMobSpawners) { event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true)); } } @@ -219,7 +219,7 @@ public class mcEntityListener implements Listener { */ @EventHandler (priority = EventPriority.LOW) public void onFoodLevelChange(FoodLevelChangeEvent event) { - if (LoadProperties.herbalismHungerBonus) { + if (Config.herbalismHungerBonus) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); PlayerProfile PP = Users.getProfile(player); @@ -299,11 +299,11 @@ public class mcEntityListener implements Listener { switch (type) { case WOLF: - xp = LoadProperties.mtameWolf; + xp = Config.mtameWolf; break; case OCELOT: - xp = LoadProperties.mtameOcelot; + xp = Config.mtameOcelot; break; default: diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 0c19f7811..6f66d05a8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -32,7 +32,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; import com.gmail.nossr50.commands.general.XprateCommand; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.runnables.RemoveProfileFromMemoryTask; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.datatypes.AbilityType; @@ -145,7 +145,7 @@ public class mcPlayerListener implements Listener { /* GARBAGE COLLECTION */ //Remove Spout Stuff - if (LoadProperties.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) { + if (Config.spoutEnabled && SpoutStuff.playerHUDs.containsKey(player)) { SpoutStuff.playerHUDs.remove(player); } @@ -167,14 +167,14 @@ public class mcPlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (mcPermissions.getInstance().motd(player) && LoadProperties.enableMotd) { + if (mcPermissions.getInstance().motd(player) && Config.enableMotd) { 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[] {LoadProperties.xpGainMultiplier})); + player.sendMessage(mcLocale.getString("XPRate.Event", new Object[] {Config.xpGainMultiplier})); } } @@ -204,14 +204,14 @@ public class mcPlayerListener implements Listener { case RIGHT_CLICK_BLOCK: /* REPAIR CHECKS */ - if (mcPermissions.getInstance().repair(player) && block.getTypeId() == LoadProperties.anvilID && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { + if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.anvilID && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { Repair.repairCheck(player, is); event.setCancelled(true); player.updateInventory(); } /* ACTIVATION CHECKS */ - if (LoadProperties.enableAbilities && BlockChecks.abilityBlockCheck(mat)) { + if (Config.enableAbilities && 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 mcPlayerListener implements Listener { } /* BLAST MINING CHECK */ - if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) { + if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.detonatorID) { BlastMining.remoteDetonation(player, plugin); } @@ -244,7 +244,7 @@ public class mcPlayerListener implements Listener { case RIGHT_CLICK_AIR: /* ACTIVATION CHECKS */ - if (LoadProperties.enableAbilities) { + if (Config.enableAbilities) { Skills.activationCheck(player, SkillType.AXES); Skills.activationCheck(player, SkillType.EXCAVATION); Skills.activationCheck(player, SkillType.HERBALISM); @@ -258,7 +258,7 @@ public class mcPlayerListener implements Listener { Item.itemchecks(player); /* BLAST MINING CHECK */ - if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == LoadProperties.detonatorID) { + if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.detonatorID) { BlastMining.remoteDetonation(player, plugin); } diff --git a/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java b/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java index 713fa55e3..36d8ef675 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcSpoutListener.java @@ -8,7 +8,7 @@ import org.getspout.spoutapi.player.SpoutPlayer; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.HUDmmo; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.spout.SpoutStuff; @@ -32,7 +32,7 @@ public class mcSpoutListener implements Listener { PlayerProfile PPs = Users.getProfile(sPlayer); //TODO: Add custom titles based on skills - if (LoadProperties.showPowerLevel) { + if (Config.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 8c89e28e8..7a9ef5697 100644 --- a/src/main/java/com/gmail/nossr50/locale/mcLocale.java +++ b/src/main/java/com/gmail/nossr50/locale/mcLocale.java @@ -7,7 +7,7 @@ import java.util.ResourceBundle; import org.bukkit.ChatColor; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; public class mcLocale { private static final String BUNDLE_NAME = "com.gmail.nossr50.locale.locale"; @@ -28,7 +28,7 @@ public class mcLocale { try { if (RESOURCE_BUNDLE == null) { Locale.setDefault(new Locale("en", "US")); - String[] myLocale = LoadProperties.locale.split("[-_ ]"); + String[] myLocale = Config.locale.split("[-_ ]"); Locale locale = null; diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index c870b5f8e..ccff36753 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; @@ -261,8 +261,8 @@ public class m { } public static int getPowerLevelCap() { - if (LoadProperties.powerLevelCap > 0) { - return LoadProperties.powerLevelCap; + if (Config.getPowerLevelCap() > 0) { + return Config.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 32160617d..6c5689484 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -49,7 +49,7 @@ public class mcMMO extends JavaPlugin { public static mcMMO p; //Config file stuff - LoadProperties config; + Config config; LoadTreasures config2; //Jar stuff @@ -93,7 +93,7 @@ public class mcMMO extends JavaPlugin { } } - this.config = new LoadProperties(this); + this.config = new Config(this); this.config.load(); this.config2 = new LoadTreasures(this); @@ -101,7 +101,7 @@ public class mcMMO extends JavaPlugin { new Party(this).loadParties(); - if (!LoadProperties.useMySQL) { + if (!Config.getUseMySQL()) { Users.loadUsers(); } @@ -115,7 +115,7 @@ public class mcMMO extends JavaPlugin { PluginDescriptionFile pdfFile = this.getDescription(); //Setup the leaderboards - if (LoadProperties.useMySQL) { + if (Config.getUseMySQL()) { database = new Database(this); database.createStructure(); } @@ -134,7 +134,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, LoadProperties.saveInterval * 1200); + scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, Config.saveInterval * 1200); //Regen & Cooldown timer (Runs every second) scheduler.scheduleSyncRepeatingTask(this, new mcTimer(this), 0, 20); //Bleed timer (Runs every two seconds) @@ -142,7 +142,7 @@ public class mcMMO extends JavaPlugin { registerCommands(); - if (LoadProperties.statsTracking) { + if (Config.statsTracking) { //Plugin Metrics running in a new thread new Thread(new Runnable() { public void run() { @@ -247,88 +247,88 @@ public class mcMMO extends JavaPlugin { getCommand("woodcutting").setExecutor(new WoodcuttingCommand()); //mc* commands - if (LoadProperties.mcremoveEnable) { + if (Config.mcremoveEnable) { getCommand("mcremove").setExecutor(new McremoveCommand(this)); } - if (LoadProperties.mcabilityEnable) { + if (Config.mcabilityEnable) { getCommand("mcability").setExecutor(new McabilityCommand()); } - if (LoadProperties.mccEnable) { + if (Config.mccEnable) { getCommand("mcc").setExecutor(new MccCommand()); } - if (LoadProperties.mcgodEnable) { + if (Config.mcgodEnable) { getCommand("mcgod").setExecutor(new McgodCommand()); } - if (LoadProperties.mcmmoEnable) { + if (Config.mcmmoEnable) { getCommand("mcmmo").setExecutor(new McmmoCommand()); } - if (LoadProperties.mcrefreshEnable) { + if (Config.mcrefreshEnable) { getCommand("mcrefresh").setExecutor(new McrefreshCommand(this)); } - if (LoadProperties.mctopEnable) { + if (Config.mctopEnable) { getCommand("mctop").setExecutor(new MctopCommand()); } - if (LoadProperties.mcstatsEnable) { + if (Config.mcstatsEnable) { getCommand("mcstats").setExecutor(new McstatsCommand()); } //Party commands - if (LoadProperties.acceptEnable) { + if (Config.acceptEnable) { getCommand("accept").setExecutor(new AcceptCommand(this)); } - if (LoadProperties.aEnable) { + if (Config.aEnable) { getCommand("a").setExecutor(new ACommand(this)); } - if (LoadProperties.inviteEnable) { + if (Config.inviteEnable) { getCommand("invite").setExecutor(new InviteCommand(this)); } - if (LoadProperties.partyEnable) { + if (Config.partyEnable) { getCommand("party").setExecutor(new PartyCommand(this)); } - if (LoadProperties.pEnable) { + if (Config.pEnable) { getCommand("p").setExecutor(new PCommand(this)); } - if (LoadProperties.ptpEnable) { + if (Config.ptpEnable) { getCommand("ptp").setExecutor(new PtpCommand(this)); } //Other commands - if (LoadProperties.addxpEnable) { + if (Config.addxpEnable) { getCommand("addxp").setExecutor(new AddxpCommand(this)); } - if (LoadProperties.addlevelsEnable) { + if (Config.addlevelsEnable) { getCommand("addlevels").setExecutor(new AddlevelsCommand(this)); } - if (LoadProperties.mmoeditEnable) { + if (Config.mmoeditEnable) { getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); } - if (LoadProperties.inspectEnable) { + if (Config.inspectEnable) { getCommand("inspect").setExecutor(new InspectCommand(this)); } - if (LoadProperties.xprateEnable) { + if (Config.xprateEnable) { getCommand("xprate").setExecutor(new XprateCommand(this)); } getCommand("mmoupdate").setExecutor(new MmoupdateCommand(this)); //Spout commands - if (LoadProperties.xplockEnable) { + if (Config.xplockEnable) { 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 d40c52761..373a0b86c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/SQLConversionTask.java @@ -5,10 +5,11 @@ import java.io.FileReader; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; public class SQLConversionTask implements Runnable { private final mcMMO plugin; + private String tablePrefix = Config.getMySQLTablePrefix(); public SQLConversionTask(mcMMO plugin) { this.plugin = plugin; @@ -164,7 +165,7 @@ public class SQLConversionTask implements Runnable { //Check to see if the user is in the DB id = mcMMO.database.getInt("SELECT id FROM " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users WHERE user = '" + playerName + "'"); if (id > 0) { @@ -172,11 +173,11 @@ public class SQLConversionTask implements Runnable { //Update the skill values mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users SET lastlogin = " + 0 + " WHERE id = " + id); mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "skills SET " + " taming = taming+" + m.getInt(taming) + ", mining = mining+" + m.getInt(mining) @@ -192,7 +193,7 @@ public class SQLConversionTask implements Runnable { + ", fishing = fishing+" + m.getInt(fishing) + " WHERE user_id = " + id); mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "experience SET " + " taming = " + m.getInt(tamingXP) + ", mining = " + m.getInt(miningXP) @@ -213,32 +214,32 @@ public class SQLConversionTask implements Runnable { //Create the user in the DB mcMMO.database.write("INSERT INTO " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users (user, lastlogin) VALUES ('" + playerName + "'," + System.currentTimeMillis() / 1000 + ")"); id = mcMMO.database.getInt("SELECT id FROM " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users WHERE user = '" + playerName + "'"); mcMMO.database.write("INSERT INTO " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "skills (user_id) VALUES (" + id + ")"); mcMMO.database.write("INSERT INTO " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "experience (user_id) VALUES (" + id + ")"); //Update the skill values mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users SET lastlogin = " + 0 + " WHERE id = " + id); mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "users SET party = '" + party + "' WHERE id = " + id); mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "skills SET " + " taming = taming+" + m.getInt(taming) + ", mining = mining+" + m.getInt(mining) @@ -254,7 +255,7 @@ public class SQLConversionTask implements Runnable { + ", fishing = fishing+" + m.getInt(fishing) + " WHERE user_id = " + id); mcMMO.database.write("UPDATE " - + LoadProperties.MySQLtablePrefix + + tablePrefix + "experience SET " + " taming = " + m.getInt(tamingXP) + ", mining = " + m.getInt(miningXP) diff --git a/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java b/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java index 6db7a413c..e23ae154d 100644 --- a/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java +++ b/src/main/java/com/gmail/nossr50/runnables/SpoutStart.java @@ -4,7 +4,7 @@ import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.player.FileManager; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutStuff; public class SpoutStart implements Runnable{ @@ -17,14 +17,14 @@ public class SpoutStart implements Runnable{ @Override public void run() { if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) { - LoadProperties.spoutEnabled = true; + Config.spoutEnabled = true; } else { - LoadProperties.spoutEnabled = false; + Config.spoutEnabled = false; } //Spout Stuff - if (LoadProperties.spoutEnabled) { + if (Config.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 11312bf61..e2e100a56 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -15,7 +15,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.LoadTreasures; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -66,7 +66,7 @@ public class Excavation { List treasures = new ArrayList(); - int xp = LoadProperties.mbase; + int xp = Config.mbase; 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(), LoadProperties.abilityDurabilityLoss); + Skills.abilityDurabilityLoss(player.getItemInHand(), Config.abilityDurabilityLoss); if (!block.hasMetadata("mcmmoPlacedBlock")) { FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); @@ -141,7 +141,7 @@ public class Excavation { Excavation.excavationProcCheck(block, player); } - if (LoadProperties.spoutEnabled) { + if (Config.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 53db35733..33a0450de 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -21,7 +21,7 @@ import com.gmail.nossr50.Combat; import com.gmail.nossr50.ItemChecks; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; -import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.LoadTreasures; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -42,16 +42,16 @@ public class Fishing { int level = PP.getSkillLevel(SkillType.FISHING); int fishingTier; - if (level >= LoadProperties.fishingTier5) { + if (level >= Config.fishingTier5) { fishingTier = 5; } - else if (level >= LoadProperties.fishingTier4) { + else if (level >= Config.fishingTier4) { fishingTier = 4; } - else if (level >= LoadProperties.fishingTier3) { + else if (level >= Config.fishingTier3) { fishingTier = 3; } - else if (level >= LoadProperties.fishingTier2) { + else if (level >= Config.fishingTier2) { fishingTier = 2; } else { @@ -97,7 +97,7 @@ public class Fishing { break; } - if (LoadProperties.fishingDrops && rewards.size() > 0) { + if (Config.fishingDrops && 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, LoadProperties.mfishing); + PP.addXP(SkillType.FISHING, Config.mfishing); 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 323902406..b16d8e76d 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -15,7 +15,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -45,13 +45,13 @@ public class Herbalism { player.updateInventory(); if (m.blockBreakSimulate(block, player, false)) { - if (LoadProperties.enableSmoothToMossy && type.equals(Material.SMOOTH_BRICK)) { + if (Config.enableSmoothToMossy && type.equals(Material.SMOOTH_BRICK)) { block.setData((byte) 0x1); //Set type of the brick to mossy } - else if (LoadProperties.enableDirtToGrass && type.equals(Material.DIRT)) { + else if (Config.enableDirtToGrass && type.equals(Material.DIRT)) { block.setType(Material.GRASS); } - else if (LoadProperties.enableCobbleToMossy && type.equals(Material.COBBLESTONE)) { + else if (Config.enableCobbleToMossy && 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 = LoadProperties.mmushroom; + xp = Config.mmushroom; } break; @@ -145,7 +145,7 @@ public class Herbalism { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) { catciDrops++; } - xp += LoadProperties.mcactus; + xp += Config.mcactus; } } } @@ -154,9 +154,9 @@ public class Herbalism { case CROPS: if (data == CropState.RIPE.getData()) { mat = Material.WHEAT; - xp = LoadProperties.mwheat; + xp = Config.mwheat; - if (LoadProperties.wheatRegrowth && mcPermissions.getInstance().greenThumbWheat(player)) { + if (Config.wheatRegrowth && 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 = LoadProperties.mmelon; + xp = Config.mmelon; } break; case NETHER_WARTS: if (data == (byte) 0x3) { mat = Material.NETHER_STALK; - xp = LoadProperties.mnetherwart; + xp = Config.mnetherwart; } break; @@ -180,7 +180,7 @@ public class Herbalism { case JACK_O_LANTERN: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.getMaterial(id); - xp = LoadProperties.mpumpkin; + xp = Config.mpumpkin; } break; @@ -188,7 +188,7 @@ public class Herbalism { case YELLOW_FLOWER: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = Material.getMaterial(id); - xp = LoadProperties.mflower; + xp = Config.mflower; } break; @@ -201,7 +201,7 @@ public class Herbalism { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) { caneDrops++; } - xp += LoadProperties.msugar; + xp += Config.msugar; } } } @@ -210,14 +210,14 @@ public class Herbalism { case VINE: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = type; - xp = LoadProperties.mvines; + xp = Config.mvines; } break; case WATER_LILY: if (!block.hasMetadata("mcmmoPlacedBlock")) { mat = type; - xp = LoadProperties.mlilypad; + xp = Config.mlilypad; } break; diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index 63d3fa7d9..a98f072e0 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -15,7 +15,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -89,56 +89,56 @@ public class Mining { switch (type) { case COAL_ORE: - xp += LoadProperties.mcoal; + xp += Config.mcoal; break; case DIAMOND_ORE: - xp += LoadProperties.mdiamond; + xp += Config.mdiamond; break; case ENDER_STONE: - xp += LoadProperties.mendstone; + xp += Config.mendstone; break; case GLOWING_REDSTONE_ORE: case REDSTONE_ORE: - xp += LoadProperties.mredstone; + xp += Config.mredstone; break; case GLOWSTONE: - xp += LoadProperties.mglowstone; + xp += Config.mglowstone; break; case GOLD_ORE: - xp += LoadProperties.mgold; + xp += Config.mgold; break; case IRON_ORE: - xp += LoadProperties.miron; + xp += Config.miron; break; case LAPIS_ORE: - xp += LoadProperties.mlapis; + xp += Config.mlapis; break; case MOSSY_COBBLESTONE: - xp += LoadProperties.mmossstone; + xp += Config.mmossstone; break; case NETHERRACK: - xp += LoadProperties.mnetherrack; + xp += Config.mnetherrack; break; case OBSIDIAN: - xp += LoadProperties.mobsidian; + xp += Config.mobsidian; break; case SANDSTONE: - xp += LoadProperties.msandstone; + xp += Config.msandstone; break; case STONE: - xp += LoadProperties.mstone; + xp += Config.mstone; 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 = LoadProperties.abilityDurabilityLoss; + int durabilityLoss = Config.abilityDurabilityLoss; FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); switch (type) { @@ -259,7 +259,7 @@ public class Mining { miningBlockCheck(player, block); - if (LoadProperties.spoutEnabled) { + if (Config.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 d5f7a619c..d8aac53c3 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -19,7 +19,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; @@ -47,21 +47,21 @@ public class Repair { /* * REPAIR ARMOR */ - if (ItemChecks.isArmor(is) && LoadProperties.repairArmor && mcPermissions.getInstance().armorRepair(player)) { - if (ItemChecks.isDiamondArmor(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairDiamondLevel && mcPermissions.getInstance().diamondRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rDiamond)); + if (ItemChecks.isArmor(is) && Config.repairArmor && mcPermissions.getInstance().armorRepair(player)) { + if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.rDiamond) && skillLevel >= Config.repairDiamondLevel && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.rDiamond)); xpHandler(player, PP, is, durabilityBefore, 6, true); } - else if (ItemChecks.isIronArmor(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rIron)); + else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.rIron) && skillLevel >= Config.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.rIron)); xpHandler(player, PP, is, durabilityBefore, 2, true); } - else if (ItemChecks.isGoldArmor(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rGold)); + else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.rGold) && skillLevel >= Config.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.rGold)); xpHandler(player, PP, is, durabilityBefore, 4, true); } - else if (ItemChecks.isLeatherArmor(is) && inventory.contains(LoadProperties.rLeather) && mcPermissions.getInstance().leatherRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rLeather)); + else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.rLeather) && mcPermissions.getInstance().leatherRepair(player)) { + repairItem(player, is, new ItemStack(Config.rLeather)); xpHandler(player, PP, is, durabilityBefore, 1, true); } else { @@ -72,29 +72,29 @@ public class Repair { /* * REPAIR TOOLS */ - else if (ItemChecks.isTool(is) && LoadProperties.repairTools && mcPermissions.getInstance().toolRepair(player)) { - if (ItemChecks.isStoneTool(is) && inventory.contains(LoadProperties.rStone) && skillLevel >= LoadProperties.repairStoneLevel && mcPermissions.getInstance().stoneRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rStone)); + else if (ItemChecks.isTool(is) && Config.repairTools && mcPermissions.getInstance().toolRepair(player)) { + if (ItemChecks.isStoneTool(is) && inventory.contains(Config.rStone) && skillLevel >= Config.repairStoneLevel && mcPermissions.getInstance().stoneRepair(player)) { + repairItem(player, is, new ItemStack(Config.rStone)); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isWoodTool(is) && inventory.contains(LoadProperties.rWood) && mcPermissions.getInstance().woodRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rWood)); + else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.rWood) && mcPermissions.getInstance().woodRepair(player)) { + repairItem(player, is, new ItemStack(Config.rWood)); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isIronTool(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rIron)); + else if (ItemChecks.isIronTool(is) && inventory.contains(Config.rIron) && skillLevel >= Config.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.rIron)); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isDiamondTool(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairDiamondLevel && mcPermissions.getInstance().diamondRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rDiamond)); + else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.rDiamond) && skillLevel >= Config.repairDiamondLevel && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.rDiamond)); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isGoldTool(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(LoadProperties.rGold)); + else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.rGold) && skillLevel >= Config.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.rGold)); xpHandler(player, PP, is, durabilityBefore, 8, true); } - else if (ItemChecks.isStringTool(is) && inventory.contains(LoadProperties.rString) && skillLevel >= LoadProperties.repairStringLevel && mcPermissions.getInstance().stringRepair(player)){ - repairItem(player, is, new ItemStack(LoadProperties.rString)); + else if (ItemChecks.isStringTool(is) && inventory.contains(Config.rString) && skillLevel >= Config.repairStringLevel && mcPermissions.getInstance().stringRepair(player)){ + repairItem(player, is, new ItemStack(Config.rString)); xpHandler(player, PP, is, durabilityBefore, 2, false); } else { @@ -142,7 +142,7 @@ public class Repair { Skills.XpCheckSkill(SkillType.REPAIR, player); //CLANG CLANG - if (LoadProperties.spoutEnabled) { + if (Config.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 >= LoadProperties.arcaneRank4) { + if (skillLevel >= Config.arcaneRank4) { return 4; } - else if (skillLevel >= LoadProperties.arcaneRank3) { + else if (skillLevel >= Config.arcaneRank3) { return 3; } - else if (skillLevel >= LoadProperties.arcaneRank2) { + else if (skillLevel >= Config.arcaneRank2) { return 2; } - else if (skillLevel >= LoadProperties.arcaneRank1) { + else if (skillLevel >= Config.arcaneRank1) { return 1; } else { @@ -204,7 +204,7 @@ public class Repair { if (random.nextInt(100) <= getEnchantChance(rank)) { int enchantLevel = enchant.getValue(); - if (LoadProperties.mayDowngradeEnchants && enchantLevel > 1) { + if (Config.mayDowngradeEnchants && 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 LoadProperties.keepEnchantsRank4; + return Config.keepEnchantsRank4; case 3: - return LoadProperties.keepEnchantsRank3; + return Config.keepEnchantsRank3; case 2: - return LoadProperties.keepEnchantsRank2; + return Config.keepEnchantsRank2; case 1: - return LoadProperties.keepEnchantsRank1; + return Config.keepEnchantsRank1; default: return 0; @@ -263,16 +263,16 @@ public class Repair { public static int getDowngradeChance(int rank) { switch (rank) { case 4: - return LoadProperties.downgradeRank4; + return Config.downgradeRank4; case 3: - return LoadProperties.downgradeRank3; + return Config.downgradeRank3; case 2: - return LoadProperties.downgradeRank2; + return Config.downgradeRank2; case 1: - return LoadProperties.downgradeRank1; + return Config.downgradeRank1; default: return 100; @@ -356,45 +356,45 @@ public class Repair { } else { if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) { - if (skillLevel < LoadProperties.repairDiamondLevel) { + if (skillLevel < Config.repairDiamondLevel) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptDiamond")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(LoadProperties.rDiamond)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.rDiamond)); } } else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) { - if (skillLevel < LoadProperties.repairIronLevel) { + if (skillLevel < Config.repairIronLevel) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptIron")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.rIron)); + player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.rIron)); } } else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) { - if (skillLevel < LoadProperties.repairGoldLevel) { + if (skillLevel < Config.repairGoldLevel) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptGold")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(LoadProperties.rGold)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.rGold)); } } else if (ItemChecks.isStoneTool(is)) { - if (skillLevel < LoadProperties.repairStoneLevel) { + if (skillLevel < Config.repairStoneLevel) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptStone")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(LoadProperties.rStone)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.rStone)); } } else if (ItemChecks.isWoodTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(LoadProperties.rWood)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.rWood)); } else if (ItemChecks.isLeatherArmor(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rLeather)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.rLeather)); } else if (ItemChecks.isStringTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rString)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.rString)); } } } @@ -445,7 +445,7 @@ public class Repair { } /* Handle the enchants */ - if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) { + if (Config.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) { addEnchants(player, item); } @@ -462,7 +462,7 @@ public class Repair { PlayerProfile PP = Users.getProfile(player); if (!PP.getPlacedAnvil()) { - if (LoadProperties.spoutEnabled) { + if (Config.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 7d1d2e0a0..42a2e568e 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -14,7 +14,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.datatypes.AbilityType; import com.gmail.nossr50.datatypes.PlayerProfile; @@ -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 (LoadProperties.enableOnlyActivateWhenSneaking && !player.isSneaking()) { + if (Config.enableOnlyActivateWhenSneaking && !player.isSneaking()) { return; } @@ -111,7 +111,7 @@ public class Skills { } } - if (LoadProperties.enableAbilityMessages) { + if (Config.enableAbilityMessages) { player.sendMessage(tool.getRaiseTool()); } @@ -201,7 +201,7 @@ public class Skills { } } - if (!LoadProperties.useMySQL) { + if (!Config.getUseMySQL()) { ProcessLeaderboardUpdate(skillType, player); ProcessLeaderboardUpdate(SkillType.ALL, player); } @@ -209,18 +209,18 @@ public class Skills { String capitalized = m.getCapitalized(skillType.toString()); /* Spout Stuff */ - if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) { + if (Config.spoutEnabled && player instanceof SpoutPlayer) { SpoutPlayer sPlayer = SpoutManager.getPlayer(player); if (sPlayer.isSpoutCraftEnabled()) { - if (LoadProperties.xpbar) { + if (Config.xpbar) { SpoutStuff.updateXpBar(player); } SpoutStuff.levelUpNotification(skillType, sPlayer); /* Update custom titles */ - if (LoadProperties.showPowerLevel) { + if (Config.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 && LoadProperties.spoutEnabled && player instanceof SpoutPlayer) { + if (skillups == 0 && Config.spoutEnabled && player instanceof SpoutPlayer) { SpoutPlayer sPlayer = (SpoutPlayer) player; if (sPlayer.isSpoutCraftEnabled()) { - if (LoadProperties.xpbar) { + if (Config.xpbar) { 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 (LoadProperties.toolsLoseDurabilityFromAbilities) { + if (Config.toolsLoseDurabilityFromAbilities) { 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 c809dcdf8..1675018a2 100644 --- a/src/main/java/com/gmail/nossr50/skills/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/Taming.java @@ -22,7 +22,7 @@ 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.LoadProperties; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -214,12 +214,12 @@ public class Taming { switch (type) { case WOLF: summonItem = Material.BONE; - summonAmount = LoadProperties.bonesConsumedByCOTW; + summonAmount = Config.bonesConsumedByCOTW; break; case OCELOT: summonItem = Material.RAW_FISH; - summonAmount = LoadProperties.fishConsumedByCOTW; + summonAmount = Config.fishConsumedByCOTW; 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 dfdd2cea0..75f7a3554 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -16,7 +16,7 @@ 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.LoadProperties; +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; @@ -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() >= LoadProperties.treeFellerThreshold) { + if (toBeFelled.size() >= Config.treeFellerThreshold) { player.sendMessage(mcLocale.getString("Woodcutting.Skills.TreeFellerThreshold")); return; } @@ -116,19 +116,19 @@ public class WoodCutting { switch (species) { case GENERIC: - xp += LoadProperties.moak; + xp += Config.moak; break; case REDWOOD: - xp += LoadProperties.mspruce; + xp += Config.mspruce; break; case BIRCH: - xp += LoadProperties.mbirch; + xp += Config.mbirch; break; case JUNGLE: - xp += LoadProperties.mjungle / 4; //Nerf XP from Jungle Trees when using Tree Feller + xp += Config.mjungle / 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() >= LoadProperties.treeFellerThreshold) { + if(toBeFelled.size() >= Config.treeFellerThreshold) { return; } @@ -281,19 +281,19 @@ public class WoodCutting { switch (species) { case GENERIC: - xp += LoadProperties.moak; + xp += Config.moak; break; case REDWOOD: - xp += LoadProperties.mspruce; + xp += Config.mspruce; break; case BIRCH: - xp += LoadProperties.mbirch; + xp += Config.mbirch; break; case JUNGLE: - xp += LoadProperties.mjungle; + xp += Config.mjungle; break; default: @@ -315,11 +315,11 @@ public class WoodCutting { FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); mcMMO.p.getServer().getPluginManager().callEvent(armswing); - if (LoadProperties.woodcuttingrequiresaxe) { - Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss); + if (Config.woodcuttingrequiresaxe) { + Skills.abilityDurabilityLoss(player.getItemInHand(), Config.abilityDurabilityLoss); } - if (LoadProperties.spoutEnabled) { + if (Config.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 + LoadProperties.abilityDurabilityLoss; + durabilityLoss = durabilityLoss + Config.abilityDurabilityLoss; } }