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

This commit is contained in:
TfT_02 2013-01-02 02:10:16 +01:00
parent 4f8337c11a
commit 66cc9bc6db
2 changed files with 17 additions and 7 deletions

View File

@ -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 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 work for Swords
= Fixed a bug which caused advanced.yml not to respect every MaxChance node = 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 Repair would remove enchantments but the glow effect remained
= Fixed a bug where dropped items did not retain custom NBT data = 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 = Fixed a bug which caused a potentially infinite recursion in a btree structure

View File

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