diff --git a/src/main/java/com/gmail/nossr50/BlockChecks.java b/src/main/java/com/gmail/nossr50/BlockChecks.java index ede564920..6972507f8 100644 --- a/src/main/java/com/gmail/nossr50/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/BlockChecks.java @@ -87,7 +87,7 @@ public class BlockChecks { break; } - if (Material.getMaterial(Config.anvilID).equals(material)) { + if (Material.getMaterial(Config.getRepairAnvilId()).equals(material)) { return false; } else { diff --git a/src/main/java/com/gmail/nossr50/Combat.java b/src/main/java/com/gmail/nossr50/Combat.java index e81d1c47c..be1f5c4bb 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -247,7 +247,7 @@ public class Combat { * @param cause DamageCause to pass to damage event */ private static void dealDamage(LivingEntity target, int dmg, DamageCause cause) { - if (Config.eventCallback) { + if (Config.getEventCallbackEnabled()) { EntityDamageEvent ede = (EntityDamageEvent) new FakeEntityDamageEvent(target, cause, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -270,7 +270,7 @@ public class Combat { * @param attacker Player to pass to event as damager */ private static void dealDamage(LivingEntity target, int dmg, Player attacker) { - if (Config.eventCallback) { + if (Config.getEventCallbackEnabled()) { EntityDamageEvent ede = (EntityDamageByEntityEvent) new FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.ENTITY_ATTACK, dmg); mcMMO.p.getServer().getPluginManager().callEvent(ede); @@ -395,7 +395,7 @@ public class Combat { double baseXP = 0; if (target instanceof Player) { - if (!Config.pvpxp) { + if (!Config.getExperienceGainsPlayerVersusPlayerEnabled()) { return; } 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 8cf98f7ff..fc3593c8c 100644 --- a/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/mc/McmmoCommand.java @@ -18,7 +18,7 @@ public class McmmoCommand implements CommandExecutor { String[] mcSplit = description.split(","); sender.sendMessage(mcSplit); - if (Config.donateMessage) { + if (Config.getDonateMessageEnabled()) { if (Config.spoutEnabled && sender instanceof SpoutPlayer) { SpoutPlayer sPlayer = (SpoutPlayer) sender; 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 b6f3b99c7..3d3fcdc02 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PtpCommand.java @@ -44,8 +44,8 @@ public class PtpCommand implements CommandExecutor { return true; } - if (PP.getRecentlyHurt() + (Config.ptpCommandCooldown * 1000) > System.currentTimeMillis()) { - player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.ptpCommandCooldown })); + if (PP.getRecentlyHurt() + (Config.getPTPCommandCooldown() * 1000) > System.currentTimeMillis()) { + player.sendMessage(mcLocale.getString("Party.Teleport.Hurt", new Object[] { Config.getPTPCommandCooldown() })); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index fb4d5aadb..0bcffbcae 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -45,7 +45,7 @@ public class RepairCommand implements CommandExecutor { player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.0"), mcLocale.getString("Repair.Effect.1") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.2"), mcLocale.getString("Repair.Effect.3") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.4"), mcLocale.getString("Repair.Effect.5") })); - player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.repairDiamondLevel }), mcLocale.getString("Repair.Effect.7") })); + player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.6", new Object[] { Config.getRepairDiamondLevelRequirement() }), mcLocale.getString("Repair.Effect.7") })); player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Repair.Effect.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/spout/MchudCommand.java b/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java index d18aed526..cfe576fac 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/MchudCommand.java @@ -32,7 +32,7 @@ public class MchudCommand implements CommandExecutor { return true; } - if (!Config.spoutEnabled || !Config.xpbar) { + if (!Config.spoutEnabled || !Config.getSpoutXPBarEnabled()) { sender.sendMessage(mcLocale.getString("Commands.Disabled")); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java index 598cdb504..ab874529c 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java @@ -26,7 +26,7 @@ public class XplockCommand implements CommandExecutor { return true; } - if (!Config.spoutEnabled || !Config.xpbar || !Config.getCommandXPLockEnabled()) { + if (!Config.spoutEnabled || !Config.getSpoutXPBarEnabled() || !Config.getCommandXPLockEnabled()) { sender.sendMessage(mcLocale.getString("Commands.Disabled")); return true; } diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 16af03464..4636bb4cf 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -4,15 +4,19 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.datatypes.HUDType; public class Config extends ConfigLoader{ + + public static int xpGainMultiplier = getExperienceGainsGlobalMultiplier(); /* * GENERAL SETTINGS */ /* General Settings */ - public static String locale; - public static Boolean enableMotd, statsTracking, eventCallback; - public static int saveInterval; + public static String getLocale() { return config.getString("General.Locale", "en_us"); } + public static boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } + public static int getSaveInterval() { return config.getInt("General.Save_Interval", 10); } + public static boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } + public static boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); } /* mySQL */ public static boolean getUseMySQL() { return config.getBoolean("MySQL.Enabled", false); } @@ -52,8 +56,8 @@ public class Config extends ConfigLoader{ public static boolean getCommandAdminChatAEnabled() { return config.getBoolean("Commands.a.Enabled", true); } public static boolean getCommandPartyChatPEnabled() { return config.getBoolean("Commands.p.Enabled", true); } - public static int ptpCommandCooldown; - public static Boolean donateMessage; + public static int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 30); } + public static boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); } /* Items */ public static int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); } @@ -120,8 +124,9 @@ public class Config extends ConfigLoader{ public static int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); } public static boolean getHerbalismHungerBonusEnabled() { return config.getBoolean("Skills.Herbalism.Hunger_Bonus", true); } public static boolean getHerbalismWheatRegrowth() { return config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true); } - - public static Boolean enableCobbleToMossy, enableSmoothToMossy, enableDirtToGrass; + public static boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); } + public static boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); } + public static boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); } /* Mining */ public static int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); } @@ -141,11 +146,24 @@ public class Config extends ConfigLoader{ public static int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); } /* 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; + public static boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); } + public static int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); } + + public static int getRepairGoldMaterial() { return config.getInt("Skills.Repair.Gold.ID", 266); } + public static int getRepairStoneMaterial() { return config.getInt("Skills.Repair.Stone.ID", 4); } + public static int getRepairWoodMaterial() { return config.getInt("Skills.Repair.Wood.ID", 5); } + public static int getRepairDiamondMaterial() { return config.getInt("Skills.Repair.Diamond.ID", 264); } + public static int getRepairIronMaterial() { return config.getInt("Skills.Repair.Iron.ID", 265); } + public static int getRepairStringMaterial() { return config.getInt("Skills.Repair.String.ID", 287); } + public static int getRepairLeatherMaterial() { return config.getInt("Skills.Repair.Leather.ID", 334); } + + public static boolean getRepairArmorAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Armor", true); } + public static boolean getRepairToolsAllowed() { return config.getBoolean("Skills.Repair.Can_Repair_Tools", true); } + public static int getRepairDiamondLevelRequirement() { return config.getInt("Skills.Repair.Diamond.Level_Required", 50); } + public static int getRepairIronLevelRequirement() { return config.getInt("Skills.Repair.Iron.Level_Required", 0); } + public static int getRepairGoldLevelRequirement() { return config.getInt("Skills.Repair.Gold.Level_Required", 0); } + public static int getRepairStoneLevelRequirement() { return config.getInt("Skills.Repair.Stone.Level_Required", 0); } + public static int getRepairStringLevelRequirement() { return config.getInt("Skills.Repair.String.Level_Required", 0); } /* Taming */ public static int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); } @@ -160,10 +178,20 @@ public class Config extends ConfigLoader{ public static int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); } /* 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; + public static boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); } + public static int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); } + public static int getArcaneForgingDowngradeChanceRank2() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_2", 50); } + public static int getArcaneForgingDowngradeChanceRank3() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_3", 25); } + public static int getArcaneForgingDowngradeChanceRank4() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_4", 15); } + public static boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Arcane_Forging.May_Lose_Enchants", true); } + public static int getArcaneForgingKeepEnchantsChanceRank1() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_1", 10); } + public static int getArcaneForgingKeepEnchantsChanceRank2() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_2", 20); } + public static int getArcaneForgingKeepEnchantsChanceRank3() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_3", 30); } + public static int getArcaneForgingKeepEnchantsChanceRank4() { return config.getInt("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); } + public static int getArcaneForgingRankLevels1() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_1", 100); } + public static int getArcaneForgingRankLevels2() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_2", 250); } + public static int getArcaneForgingRankLevels3() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_3", 500); } + public static int getArcaneForgingRankLevels4() { return config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750); } /* Level Caps */ public static int getLevelCapAcrobatics() { return config.getInt("Skills.Acrobatics.Level_Cap", 0); } @@ -185,8 +213,9 @@ public class Config extends ConfigLoader{ */ /* General Settings */ - public static Boolean xpGainsMobSpawners, pvpxp; - public static int xpGainMultiplier; + public static boolean getExperienceGainsMobspawnersEnabled() { return config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); } + public static boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience.PVP.Rewards", true); } + public static int getExperienceGainsGlobalMultiplier() { return config.getInt("Experience.Gains.Multiplier.Global", 1); } /* Combat XP Multipliers */ public static double getPlayerVersusPlayerXP() { return config.getDouble("Experience.Gains.Multiplier.PVP", 1.0); } @@ -228,12 +257,13 @@ public class Config extends ConfigLoader{ public static boolean spoutEnabled; public static boolean getShowPowerLevelForSpout() { return config.getBoolean("Spout.HUD.Show_Power_Level", true); } - /* 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; + public static boolean getSpoutXPBarEnabled() { return config.getBoolean("Spout.XP.Bar.Enabled", true); } + public static boolean getSpoutXPBarIconEnabled() { return config.getBoolean("Spout.XP.Icon.Enabled", true); } + public static int getSpoutXPBarXPosition() { return config.getInt("Spout.XP.Bar.X_POS", 95); } + public static int getSpoutXPBarYPosition() { return config.getInt("Spout.XP.Bar.Y_POS", 6); } + public static int getSpoutXPIconXPosition() { return config.getInt("Spout.XP.Icon.X_POS", 78); } + public static int getSpoutXPIconYPosition() { return config.getInt("Spout.XP.Icon.Y_POS", 2); } /* Spout HUD Colors */ public static double getSpoutRetroHUDXPBorderRed() { return config.getDouble("Spout.HUD.Retro.Colors.Border.RED", 0.0); } @@ -316,71 +346,5 @@ public class Config extends ConfigLoader{ defaulthud = x; } } - - donateMessage = config.getBoolean("Commands.mcmmo.Donate_Message", true); - xpGainsMobSpawners = config.getBoolean("Experience.Gains.Mobspawners.Enabled", false); - - 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); - - 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); - - 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); - - - pvpxp = config.getBoolean("Experience.PVP.Rewards", 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); - - 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); - - 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); - - ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30); } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java b/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java index 15913d4f3..29bd3274e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java +++ b/src/main/java/com/gmail/nossr50/datatypes/HUDmmo.java @@ -185,12 +185,12 @@ public class HUDmmo { xpbg.setPriority(RenderPriority.Low); xpbg.setDirty(true); - if (Config.xpbar) { + if (Config.getSpoutXPBarEnabled()) { sPlayer.getMainScreen().attachWidget(plugin, xpbar); sPlayer.getMainScreen().attachWidget(plugin, xpfill); sPlayer.getMainScreen().attachWidget(plugin, xpbg); - if (Config.xpicon) { + if (Config.getSpoutXPBarIconEnabled()) { sPlayer.getMainScreen().attachWidget(plugin, xpicon); sPlayer.getMainScreen().attachWidget(plugin, xpicon_bg); sPlayer.getMainScreen().attachWidget(plugin, xpicon_border); @@ -206,26 +206,26 @@ public class HUDmmo { * @param sPlayer Player to initialize XP bar for */ public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) { - if (Config.xpbar) { + if (Config.getSpoutXPBarEnabled()) { xpbar = new GenericTexture(); ((GenericTexture) xpbar).setUrl("xpbar_inc000.png"); - xpbar.setX(Config.xpbar_x); - xpbar.setY(Config.xpbar_y); + xpbar.setX(Config.getSpoutXPBarXPosition()); + xpbar.setY(Config.getSpoutXPBarYPosition()); xpbar.setHeight(8); xpbar.setWidth(256); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (Config.xpicon) { + if (Config.getSpoutXPBarIconEnabled()) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(16); xpicon.setWidth(32); - xpicon.setX(Config.xpicon_x); - xpicon.setY(Config.xpicon_y); + xpicon.setX(Config.getSpoutXPIconXPosition()); + xpicon.setY(Config.getSpoutXPIconYPosition()); xpicon.setDirty(true); sPlayer.getMainScreen().attachWidget(plugin, xpicon); @@ -241,25 +241,25 @@ public class HUDmmo { * @param sPlayer Player to initialize XP bar for */ private void initializeXpBarDisplaySmall(SpoutPlayer sPlayer) { - if (Config.xpbar) { + if (Config.getSpoutXPBarEnabled()) { xpbar = new GenericTexture(); ((GenericTexture)xpbar).setUrl("xpbar_inc000.png"); xpbar.setX(center_x - 64); - xpbar.setY(Config.xpbar_y); + xpbar.setY(Config.getSpoutXPBarYPosition()); xpbar.setHeight(4); xpbar.setWidth(128); sPlayer.getMainScreen().attachWidget(plugin, xpbar); - if (Config.xpicon) { + if (Config.getSpoutXPBarIconEnabled()) { xpicon = new GenericTexture(); xpicon.setUrl("Icon.png"); xpicon.setHeight(8); xpicon.setWidth(16); xpicon.setX(center_x - (8 + 64)); - xpicon.setY(Config.xpicon_y + 2); + xpicon.setY(Config.getSpoutXPIconYPosition() + 2); xpicon.setDirty(true); sPlayer.getMainScreen().attachWidget(plugin, xpicon); @@ -276,7 +276,7 @@ public class HUDmmo { * @param PP Profile of the given player */ private void updateXpBarStandard(Player player, PlayerProfile PP) { - if (!Config.xpbar) { + if (!Config.getSpoutXPBarEnabled()) { return; } @@ -302,7 +302,7 @@ public class HUDmmo { * @param PP Profile of the given player */ private void updateXpBarRetro(Player player, PlayerProfile PP) { - if (!Config.xpbar) { + if (!Config.getSpoutXPBarEnabled()) { return; } 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 3ae216084..f1c46f498 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java +++ b/src/main/java/com/gmail/nossr50/datatypes/popups/PopupMMO.java @@ -39,14 +39,6 @@ public class PopupMMO extends GenericPopup { HUDButton.setY(center_y / 2); HUDButton.setDirty(true); - if (Config.partybar) { - PartyButton = new ButtonPartyToggle(PP); - PartyButton.setX(center_x - (PartyButton.getWidth() / 2)); - PartyButton.setY((center_y / 2) + PartyButton.getHeight()); - PartyButton.setDirty(true); - this.attachWidget(plugin, PartyButton); - } - EscapeButton = new ButtonEscape(); EscapeButton.setX(center_x - (EscapeButton.getWidth() / 2)); EscapeButton.setY((center_y / 2) + (HUDButton.getHeight() * 2) + 5); diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 85b3d56e2..6be80c4da 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -118,7 +118,7 @@ public class BlockListener implements Listener { block.setMetadata("mcmmoPlacedBlock", new FixedMetadataValue(plugin, true)); } - if (id == Config.anvilID && Config.anvilmessages) { + if (id == Config.getRepairAnvilId() && Config.getRepairAnvilMessagesEnabled()) { Repair.placedAnvilCheck(player, id); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 4e55e9530..44048bfea 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -165,7 +165,7 @@ public class EntityListener implements Listener { public void onCreatureSpawn(CreatureSpawnEvent event) { SpawnReason reason = event.getSpawnReason(); - if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.xpGainsMobSpawners) { + if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getExperienceGainsMobspawnersEnabled()) { event.getEntity().setMetadata("mcmmoFromMobSpawner", new FixedMetadataValue(plugin, true)); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index c7c7d1eac..94a99f2dd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -167,7 +167,7 @@ public class PlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (mcPermissions.getInstance().motd(player) && Config.enableMotd) { + if (mcPermissions.getInstance().motd(player) && Config.getMOTDEnabled()) { player.sendMessage(mcLocale.getString("mcMMO.MOTD", new Object[] {plugin.getDescription().getVersion()})); player.sendMessage(mcLocale.getString("mcMMO.Wiki")); } @@ -204,7 +204,7 @@ public class PlayerListener implements Listener { case RIGHT_CLICK_BLOCK: /* REPAIR CHECKS */ - if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.anvilID && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { + if (mcPermissions.getInstance().repair(player) && block.getTypeId() == Config.getRepairAnvilId() && (ItemChecks.isTool(is) || ItemChecks.isArmor(is))) { Repair.repairCheck(player, is); event.setCancelled(true); player.updateInventory(); diff --git a/src/main/java/com/gmail/nossr50/locale/mcLocale.java b/src/main/java/com/gmail/nossr50/locale/mcLocale.java index 7a9ef5697..5dbb42c70 100644 --- a/src/main/java/com/gmail/nossr50/locale/mcLocale.java +++ b/src/main/java/com/gmail/nossr50/locale/mcLocale.java @@ -28,7 +28,7 @@ public class mcLocale { try { if (RESOURCE_BUNDLE == null) { Locale.setDefault(new Locale("en", "US")); - String[] myLocale = Config.locale.split("[-_ ]"); + String[] myLocale = Config.getLocale().split("[-_ ]"); Locale locale = null; diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 7bffd5cef..eed7edd67 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -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, Config.saveInterval * 1200); + scheduler.scheduleSyncRepeatingTask(this, new mcSaveTimer(this), 0, Config.getSaveInterval() * 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 (Config.statsTracking) { + if (Config.getStatsTrackingEnabled()) { //Plugin Metrics running in a new thread new Thread(new Runnable() { public void run() { diff --git a/src/main/java/com/gmail/nossr50/skills/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/Herbalism.java index b6db684c4..f869aae4b 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -45,13 +45,13 @@ public class Herbalism { player.updateInventory(); if (m.blockBreakSimulate(block, player, false)) { - if (Config.enableSmoothToMossy && type.equals(Material.SMOOTH_BRICK)) { + if (Config.getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { block.setData((byte) 0x1); //Set type of the brick to mossy } - else if (Config.enableDirtToGrass && type.equals(Material.DIRT)) { + else if (Config.getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) { block.setType(Material.GRASS); } - else if (Config.enableCobbleToMossy && type.equals(Material.COBBLESTONE)) { + else if (Config.getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) { block.setType(Material.MOSSY_COBBLESTONE); } } diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index d8aac53c3..1e1ef73af 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -47,21 +47,21 @@ public class Repair { /* * REPAIR ARMOR */ - if (ItemChecks.isArmor(is) && Config.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)); + if (ItemChecks.isArmor(is) && Config.getRepairArmorAllowed() && mcPermissions.getInstance().armorRepair(player)) { + if (ItemChecks.isDiamondArmor(is) && inventory.contains(Config.getRepairDiamondMaterial()) && skillLevel >= Config.getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairDiamondMaterial())); xpHandler(player, PP, is, durabilityBefore, 6, true); } - else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.rIron) && skillLevel >= Config.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(Config.rIron)); + else if (ItemChecks.isIronArmor(is) && inventory.contains(Config.getRepairIronMaterial()) && skillLevel >= Config.getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairIronMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, true); } - else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.rGold) && skillLevel >= Config.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(Config.rGold)); + else if (ItemChecks.isGoldArmor(is) && inventory.contains(Config.getRepairGoldMaterial()) && skillLevel >= Config.getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairGoldMaterial())); xpHandler(player, PP, is, durabilityBefore, 4, true); } - else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.rLeather) && mcPermissions.getInstance().leatherRepair(player)) { - repairItem(player, is, new ItemStack(Config.rLeather)); + else if (ItemChecks.isLeatherArmor(is) && inventory.contains(Config.getRepairLeatherMaterial()) && mcPermissions.getInstance().leatherRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairLeatherMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } else { @@ -72,29 +72,29 @@ public class Repair { /* * REPAIR TOOLS */ - 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)); + else if (ItemChecks.isTool(is) && Config.getRepairToolsAllowed() && mcPermissions.getInstance().toolRepair(player)) { + if (ItemChecks.isStoneTool(is) && inventory.contains(Config.getRepairStoneMaterial()) && skillLevel >= Config.getRepairStoneLevelRequirement() && mcPermissions.getInstance().stoneRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairStoneMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.rWood) && mcPermissions.getInstance().woodRepair(player)) { - repairItem(player, is, new ItemStack(Config.rWood)); + else if (ItemChecks.isWoodTool(is) && inventory.contains(Config.getRepairWoodMaterial()) && mcPermissions.getInstance().woodRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairWoodMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } - else if (ItemChecks.isIronTool(is) && inventory.contains(Config.rIron) && skillLevel >= Config.repairIronLevel && mcPermissions.getInstance().ironRepair(player)) { - repairItem(player, is, new ItemStack(Config.rIron)); + else if (ItemChecks.isIronTool(is) && inventory.contains(Config.getRepairIronMaterial()) && skillLevel >= Config.getRepairIronLevelRequirement() && mcPermissions.getInstance().ironRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairIronMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.rDiamond) && skillLevel >= Config.repairDiamondLevel && mcPermissions.getInstance().diamondRepair(player)) { - repairItem(player, is, new ItemStack(Config.rDiamond)); + else if (ItemChecks.isDiamondTool(is) && inventory.contains(Config.getRepairDiamondMaterial()) && skillLevel >= Config.getRepairDiamondLevelRequirement() && mcPermissions.getInstance().diamondRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairDiamondMaterial())); xpHandler(player, PP, is, durabilityBefore, 1, true); } - else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.rGold) && skillLevel >= Config.repairGoldLevel && mcPermissions.getInstance().goldRepair(player)) { - repairItem(player, is, new ItemStack(Config.rGold)); + else if (ItemChecks.isGoldTool(is) && inventory.contains(Config.getRepairGoldMaterial()) && skillLevel >= Config.getRepairGoldLevelRequirement() && mcPermissions.getInstance().goldRepair(player)) { + repairItem(player, is, new ItemStack(Config.getRepairGoldMaterial())); xpHandler(player, PP, is, durabilityBefore, 8, true); } - else if (ItemChecks.isStringTool(is) && inventory.contains(Config.rString) && skillLevel >= Config.repairStringLevel && mcPermissions.getInstance().stringRepair(player)){ - repairItem(player, is, new ItemStack(Config.rString)); + else if (ItemChecks.isStringTool(is) && inventory.contains(Config.getRepairStringMaterial()) && skillLevel >= Config.getRepairStringLevelRequirement() && mcPermissions.getInstance().stringRepair(player)){ + repairItem(player, is, new ItemStack(Config.getRepairStringMaterial())); xpHandler(player, PP, is, durabilityBefore, 2, false); } else { @@ -156,16 +156,16 @@ public class Repair { public static int getArcaneForgingRank(PlayerProfile PP) { int skillLevel = PP.getSkillLevel(SkillType.REPAIR); - if (skillLevel >= Config.arcaneRank4) { + if (skillLevel >= Config.getArcaneForgingRankLevels4()) { return 4; } - else if (skillLevel >= Config.arcaneRank3) { + else if (skillLevel >= Config.getArcaneForgingRankLevels3()) { return 3; } - else if (skillLevel >= Config.arcaneRank2) { + else if (skillLevel >= Config.getArcaneForgingRankLevels2()) { return 2; } - else if (skillLevel >= Config.arcaneRank1) { + else if (skillLevel >= Config.getArcaneForgingRankLevels1()) { return 1; } else { @@ -204,7 +204,7 @@ public class Repair { if (random.nextInt(100) <= getEnchantChance(rank)) { int enchantLevel = enchant.getValue(); - if (Config.mayDowngradeEnchants && enchantLevel > 1) { + if (Config.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) { if (random.nextInt(100) <= getDowngradeChance(rank)) { is.addEnchantment(enchantment, enchantLevel--); downgraded = true; @@ -238,16 +238,16 @@ public class Repair { public static int getEnchantChance(int rank) { switch (rank) { case 4: - return Config.keepEnchantsRank4; + return Config.getArcaneForgingKeepEnchantsChanceRank4(); case 3: - return Config.keepEnchantsRank3; + return Config.getArcaneForgingKeepEnchantsChanceRank3(); case 2: - return Config.keepEnchantsRank2; + return Config.getArcaneForgingKeepEnchantsChanceRank2(); case 1: - return Config.keepEnchantsRank1; + return Config.getArcaneForgingKeepEnchantsChanceRank1(); default: return 0; @@ -263,16 +263,16 @@ public class Repair { public static int getDowngradeChance(int rank) { switch (rank) { case 4: - return Config.downgradeRank4; + return Config.getArcaneForgingDowngradeChanceRank4(); case 3: - return Config.downgradeRank3; + return Config.getArcaneForgingDowngradeChanceRank3(); case 2: - return Config.downgradeRank2; + return Config.getArcaneForgingDowngradeChanceRank2(); case 1: - return Config.downgradeRank1; + return Config.getArcaneForgingDowngradeChanceRank1(); default: return 100; @@ -356,45 +356,45 @@ public class Repair { } else { if (ItemChecks.isDiamondTool(is) || ItemChecks.isDiamondArmor(is)) { - if (skillLevel < Config.repairDiamondLevel) { + if (skillLevel < Config.getRepairDiamondLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptDiamond")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.rDiamond)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.BLUE + m.prettyItemString(Config.getRepairDiamondMaterial())); } } else if (ItemChecks.isIronTool(is) || ItemChecks.isIronArmor(is)) { - if (skillLevel < Config.repairIronLevel) { + if (skillLevel < Config.getRepairIronLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptIron")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.rIron)); + player.sendMessage(mcLocale.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + m.prettyItemString(Config.getRepairIronMaterial())); } } else if (ItemChecks.isGoldTool(is) || ItemChecks.isGoldArmor(is)) { - if (skillLevel < Config.repairGoldLevel) { + if (skillLevel < Config.getRepairGoldLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptGold")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.rGold)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GOLD + m.prettyItemString(Config.getRepairGoldMaterial())); } } else if (ItemChecks.isStoneTool(is)) { - if (skillLevel < Config.repairStoneLevel) { + if (skillLevel < Config.getRepairStoneLevelRequirement()) { player.sendMessage(mcLocale.getString("Repair.Skills.AdeptStone")); } else { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.rStone)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.GRAY + m.prettyItemString(Config.getRepairStoneMaterial())); } } else if (ItemChecks.isWoodTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.rWood)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.DARK_GREEN + m.prettyItemString(Config.getRepairWoodMaterial())); } else if (ItemChecks.isLeatherArmor(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.rLeather)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getRepairLeatherMaterial())); } else if (ItemChecks.isStringTool(is)) { - player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.rString)); + player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(Config.getRepairStringMaterial())); } } } @@ -445,7 +445,7 @@ public class Repair { } /* Handle the enchants */ - if (Config.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) { + if (Config.getArcaneForgingEnchantLossEnabled() && !mcPermissions.getInstance().arcaneBypass(player)) { addEnchants(player, item); } diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index 4f88dc34f..c8e5c1cb5 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -213,7 +213,7 @@ public class Skills { SpoutPlayer sPlayer = SpoutManager.getPlayer(player); if (sPlayer.isSpoutCraftEnabled()) { - if (Config.xpbar) { + if (Config.getSpoutXPBarEnabled()) { SpoutStuff.updateXpBar(player); } @@ -237,7 +237,7 @@ public class Skills { if (skillups == 0 && Config.spoutEnabled && player instanceof SpoutPlayer) { SpoutPlayer sPlayer = (SpoutPlayer) player; if (sPlayer.isSpoutCraftEnabled()) { - if (Config.xpbar) { + if (Config.getSpoutXPBarEnabled()) { SpoutStuff.updateXpBar(player); } }