Sfoglia il codice sorgente

Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml

TfT_02 12 anni fa
parent
commit
66cc9bc6db

+ 1 - 0
Changelog.txt

@@ -28,6 +28,7 @@ Version 1.3.13-dev
  = Fixed a bug where PartyChangeEvent was fired even when a player isn't able to change parties
  = Fixed a bug which caused advanced.yml not to work for Swords
  = Fixed a bug which caused advanced.yml not to respect every MaxChance node
+ = Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml
  = Fixed a bug where Repair would remove enchantments but the glow effect remained
  = Fixed a bug where dropped items did not retain custom NBT data
  = Fixed a bug which caused a potentially infinite recursion in a btree structure

+ 16 - 7
src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java

@@ -4,11 +4,13 @@ import org.bukkit.CropState;
 import org.bukkit.Material;
 import org.bukkit.block.Block;
 
+import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.datatypes.AbilityType;
 import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.SkillType;
 
 public class GreenThumbTimer implements Runnable {
+    AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
     private Block block;
     private PlayerProfile profile;
     private Material type;
@@ -24,19 +26,26 @@ public class GreenThumbTimer implements Runnable {
         if(this.block.getType() != this.type)
             this.block.setType(this.type);
 
+        int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM);
+
+    	final int STAGE_CHANGE = advancedConfig.getGreenThumbStageChange();
+
+        int greenThumbStage = (int) ((double) skillLevel / (double) STAGE_CHANGE);
+        if (greenThumbStage > 4) greenThumbStage = 4;
+
         switch(this.type) {
         case CROPS:
         case CARROT:
         case POTATO:
             //This replants the wheat at a certain stage in development based on Herbalism Skill
             if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
-                if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
+                if (greenThumbStage == 3) {
                     this.block.setData(CropState.MEDIUM.getData());
                 }
-                else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
+                else if (greenThumbStage == 2) {
                     this.block.setData(CropState.SMALL.getData());
                 }
-                else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 200) {
+                else if (greenThumbStage == 1) {
                     this.block.setData(CropState.VERY_SMALL.getData());
                 }
                 else {
@@ -49,10 +58,10 @@ public class GreenThumbTimer implements Runnable {
             break;
         case NETHER_WARTS:
             if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
-                if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
+                if (greenThumbStage == 3) {
                     this.block.setData((byte) 2);
                 }
-                else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
+                else if (greenThumbStage == 2) {
                     this.block.setData((byte) 1);
                 }
                 else {
@@ -65,10 +74,10 @@ public class GreenThumbTimer implements Runnable {
             break;
         case COCOA:
             if (!this.profile.getAbilityMode(AbilityType.GREEN_TERRA)) {
-                if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 600) {
+                if (greenThumbStage == 3) {
                     this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4)));
                 }
-                else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
+                else if (greenThumbStage == 2) {
                     this.block.setData((byte) ((this.block.getData() ^ ((byte) 0xc)) | ((byte) 4)));
                 }
                 else {