Forráskód Böngészése

Config overhaul part 6

nossr50 13 éve
szülő
commit
05724ae64f

+ 2 - 2
src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java

@@ -46,8 +46,8 @@ public class TamingCommand implements CommandExecutor {
         player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.10"), mcLocale.getString("Taming.Effect.11") }));
         player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.12"), mcLocale.getString("Taming.Effect.13") }));
         player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Taming.Effect.16"), mcLocale.getString("Taming.Effect.17") }));
-        player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.fishConsumedByCOTW }));
-        player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.bonesConsumedByCOTW }));
+        player.sendMessage(mcLocale.getString("Taming.Effect.14", new Object[] { Config.getTamingCOTWOcelotCost() }));
+        player.sendMessage(mcLocale.getString("Taming.Effect.15", new Object[] { Config.getTamingCOTWWolfCost() }));
 
         player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") }));
 

+ 12 - 19
src/main/java/com/gmail/nossr50/config/Config.java

@@ -76,7 +76,7 @@ public class Config extends ConfigLoader{
                       serratedStrikeCooldown, skullSplitterCooldown;
 
     /* Thresholds */
-    public static int treeFellerThreshold;
+    public static int getTreeFellerThreshold() { return config.getInt("Abilities.Limits.Tree_Feller_Threshold", 500); }
 
     /*
      * SKILL SETTINGS
@@ -128,7 +128,7 @@ public class Config extends ConfigLoader{
     public static int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
     public static int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
     
-    public static int detonatorID;
+    public static int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
 
     /* Repair */
     public static Boolean repairArmor, repairTools;
@@ -138,11 +138,16 @@ public class Config extends ConfigLoader{
     public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairDiamondLevel, repairStringLevel;
 
     /* Taming */
-    public static int mtameWolf, mtameOcelot;
-    public static int bonesConsumedByCOTW, fishConsumedByCOTW;
+    public static int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
+    public static int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
+    public static int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
+    public static int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
 
     /* Woodcutting */
-    public static int moak, mbirch, mspruce, mjungle;
+    public static int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); }
+    public static int getWoodcuttingXPBirch() { return config.getInt("Experience.Woodcutting.Birch", 90); }
+    public static int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
+    public static int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
 
     /* Arcane Forging */
     public static Boolean mayDowngradeEnchants, mayLoseEnchants;
@@ -306,10 +311,7 @@ public class Config extends ConfigLoader{
 
         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);
@@ -321,15 +323,9 @@ public class Config extends ConfigLoader{
         showDisplayName = config.getBoolean("Spout.Party.HUD.Show_Display_Name", false);
         partybar = config.getBoolean("Spout.Party.HUD.Enabled", 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);
-
         
 
-        mtameWolf = config.getInt("Experience.Taming.Animal_Taming.Wolf", 250);
-        mtameOcelot = config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500);
+        
 
         
 
@@ -338,7 +334,6 @@ public class Config extends ConfigLoader{
         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);
@@ -403,7 +398,5 @@ public class Config extends ConfigLoader{
         arcaneRank4 = config.getInt("Arcane_Forging.Rank_Levels.Rank_4", 750);
         
         ptpCommandCooldown = config.getInt("Commands.ptp.Cooldown", 30);
-
-        detonatorID = config.getInt("Skills.Mining.Detonator_ID", 259);
     }
 }

+ 2 - 2
src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java

@@ -299,11 +299,11 @@ public class mcEntityListener implements Listener {
 
             switch (type) {
             case WOLF:
-                xp = Config.mtameWolf;
+                xp = Config.getTamingXPWolf();
                 break;
 
             case OCELOT:
-                xp = Config.mtameOcelot;
+                xp = Config.getTamingXPOcelot();
                 break;
 
             default:

+ 2 - 2
src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java

@@ -235,7 +235,7 @@ public class mcPlayerListener implements Listener {
             }
 
             /* BLAST MINING CHECK */
-            if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.detonatorID) {
+            if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getDetonatorItemID()) {
                 BlastMining.remoteDetonation(player, plugin);
             }
 
@@ -258,7 +258,7 @@ public class mcPlayerListener implements Listener {
             Item.itemchecks(player);
 
             /* BLAST MINING CHECK */
-            if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.detonatorID) {
+            if (mcPermissions.getInstance().blastMining(player) && is.getTypeId() == Config.getDetonatorItemID()) {
                 BlastMining.remoteDetonation(player, plugin);
             }
 

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/Taming.java

@@ -214,12 +214,12 @@ public class Taming {
         switch (type) {
         case WOLF:
             summonItem = Material.BONE;
-            summonAmount = Config.bonesConsumedByCOTW;
+            summonAmount = Config.getTamingCOTWWolfCost();
             break;
 
         case OCELOT:
             summonItem = Material.RAW_FISH;
-            summonAmount = Config.fishConsumedByCOTW;
+            summonAmount = Config.getTamingCOTWOcelotCost();
             break;
 
         default:

+ 10 - 10
src/main/java/com/gmail/nossr50/skills/WoodCutting.java

@@ -53,7 +53,7 @@ public class WoodCutting {
      * @param PP The PlayerProfile of the player
      */
     private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) {
-        if (toBeFelled.size() >= Config.treeFellerThreshold) {
+        if (toBeFelled.size() >= Config.getTreeFellerThreshold()) {
             player.sendMessage(mcLocale.getString("Woodcutting.Skills.TreeFellerThreshold"));
             return;
         }
@@ -116,19 +116,19 @@ public class WoodCutting {
 
                         switch (species) {
                             case GENERIC:
-                                xp += Config.moak;
+                                xp += Config.getWoodcuttingXPOak();
                                 break;
 
                             case REDWOOD:
-                                xp += Config.mspruce;
+                                xp += Config.getWoodcuttingXPSpruce();
                                 break;
 
                             case BIRCH:
-                                xp += Config.mbirch;
+                                xp += Config.getWoodcuttingXPBirch();
                                 break;
 
                             case JUNGLE:
-                                xp += Config.mjungle / 4; //Nerf XP from Jungle Trees when using Tree Feller
+                                xp += Config.getWoodcuttingXPJungle() / 4; //Nerf XP from Jungle Trees when using Tree Feller
                                 break;
 
                             default:
@@ -187,7 +187,7 @@ public class WoodCutting {
     private static void processTreeFelling(Block currentBlock, ArrayList<Block> toBeFelled) {
         Material type = currentBlock.getType();
         
-        if(toBeFelled.size() >= Config.treeFellerThreshold) {
+        if(toBeFelled.size() >= Config.getTreeFellerThreshold()) {
             return;
         }
 
@@ -281,19 +281,19 @@ public class WoodCutting {
 
         switch (species) {
         case GENERIC:
-            xp += Config.moak;
+            xp += Config.getWoodcuttingXPOak();
             break;
 
         case REDWOOD:
-            xp += Config.mspruce;
+            xp += Config.getWoodcuttingXPSpruce();
             break;
 
         case BIRCH:
-            xp += Config.mbirch;
+            xp += Config.getWoodcuttingXPBirch();
             break;
 
         case JUNGLE:
-            xp += Config.mjungle;
+            xp += Config.getWoodcuttingXPJungle();
             break;
 
         default: