From 66cc9bc6db29b4b84e12c5bb35d9f553424b63ca Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 2 Jan 2013 02:10:16 +0100 Subject: [PATCH] Fixed a bug where GreenThumb_StageChange wasn't read from advanced.yml --- Changelog.txt | 1 + .../nossr50/runnables/GreenThumbTimer.java | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index e9bc63488..9eb7bc3a7 100644 --- a/Changelog.txt +++ b/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 diff --git a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java b/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java index 57f04bd3d..568f7c98f 100644 --- a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java +++ b/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 {