Permalink
Browse files

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

  • Loading branch information...
TfT-02 committed Jan 2, 2013
1 parent 4f8337c commit 66cc9bc6db29b4b84e12c5bb35d9f553424b63ca
Showing with 17 additions and 7 deletions.
  1. +1 −0 Changelog.txt
  2. +16 −7 src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java
View
@@ -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
@@ -4,11 +4,13 @@
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 void run() {
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 @@ else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 200) {
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 @@ else if (this.profile.getSkillLevel(SkillType.HERBALISM) >= 400) {
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 {

0 comments on commit 66cc9bc

Please sign in to comment.