Ver código fonte

Move validation to proper location

TfT_02 12 anos atrás
pai
commit
7683dfc436

+ 14 - 6
src/main/java/com/gmail/nossr50/config/Config.java

@@ -116,7 +116,7 @@ public class Config extends AutoUpdateConfigLoader {
         }
 
         if (getPartyShareBonusIncrease() < 0) {
-            reason.add("Party.Sharing.ExpShare_bonus_increase should be greater than or equal to 0!");
+            reason.add("Party.Sharing.ExpShare_bonus_increase should be at least 0!");
         }
 
         if (getPartyShareBonusCap() <= 0) {
@@ -168,28 +168,36 @@ public class Config extends AutoUpdateConfigLoader {
             reason.add("Skills.Taming.Call_Of_The_Wild.Fish_Required should be at least 1!");
         }
 
+        if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
+            reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot_Amount should be greater than 0!");
+        }
+
+        if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
+            reason.add("Skills.Taming.Call_Of_The_Wild.Wolf_Amount should be greater than 0!");
+        }
+
         if (getExperienceGainsGlobalMultiplier() <= 0) {
             reason.add("Experience.Gains.Multiplier.Global should be greater than 0!");
         }
 
         if (getPlayerVersusPlayerXP() < 0) {
-            reason.add("Experience.Gains.Multiplier.PVP should be greater than 0!");
+            reason.add("Experience.Gains.Multiplier.PVP should be at least 0!");
         }
 
         if (getAnimalsXP() < 0) {
-            reason.add("Experience.Gains.Multiplier.Animals should be greater than 0!");
+            reason.add("Experience.Gains.Multiplier.Animals should be at least 0!");
         }
 
         if (getWitherSkeletonXP() < 0) {
-            reason.add("Experience.Gains.Multiplier.Wither_Skeleton should be greater than 0!");
+            reason.add("Experience.Gains.Multiplier.Wither_Skeleton should be at least 0!");
         }
 
         if (getSpawnedMobXpMultiplier() < 0) {
-            reason.add("Experience.Gains.Mobspawners.Multiplier should be greater than 0!");
+            reason.add("Experience.Gains.Mobspawners.Multiplier should be at least 0!");
         }
 
         if (getFormulaMultiplierCurve() < 0) {
-            reason.add("Experience.Formula.Curve_Modifier should be greater than 0!");
+            reason.add("Experience.Formula.Curve_Modifier should be at least 0!");
         }
 
         // Check if there were any errors

+ 0 - 5
src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java

@@ -184,11 +184,6 @@ public class TamingManager extends SkillManager {
 
         int amount = Config.getInstance().getTamingCOTWAmount(type);
 
-        // TODO: Validate in config instead
-        if (amount <= 0) {
-            amount = 1;
-        }
-
         for (int i = 0; i < amount; i++) {
             LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);