diff --git a/Changelog.txt b/Changelog.txt index 323dd3a7a..4d892cafb 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Version 2.1.175 Fixed a bug where mcMMO would occasionally give a 65 item stack from a double smelt on a furnace Fixed a bug where arrows could be duped when fired from a crossbow with piercing enchantment + Added setting to enable or disable Green Thumb automatically replanting crops per crop to config.yml under 'Green_Thumb_Replanting_Crops' section Version 2.1.174 Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index cc8549303..81d727339 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -9,6 +9,7 @@ import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.data.BlockData; import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -597,4 +598,7 @@ public class Config extends AutoUpdateConfigLoader { public int getPowerLevelUpBroadcastRadius() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Distance_Restrictions.Restricted_Radius", 100); } public int getPowerLevelUpBroadcastInterval() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Milestone_Interval", 100); } + public boolean isGreenThumbReplantableCrop(@NotNull Material material) { + return config.getBoolean("Green_Thumb_Replanting_Crops." + StringUtils.getCapitalized(material.toString()), true); + } } diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 4a8104dd9..0d3279b1c 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -182,8 +182,10 @@ public class HerbalismManager extends SkillManager { //TODO: The design of Green Terra needs to change, this is a mess if(Permissions.greenThumbPlant(getPlayer(), originalBreak.getType())) { - if(!getPlayer().isSneaking()) { - greenThumbActivated = processGreenThumbPlants(originalBreak, blockBreakEvent, isGreenTerraActive()); + if(Config.getInstance().isGreenThumbReplantableCrop(originalBreak.getType())) { + if(!getPlayer().isSneaking()) { + greenThumbActivated = processGreenThumbPlants(originalBreak, blockBreakEvent, isGreenTerraActive()); + } } } @@ -688,7 +690,7 @@ public class HerbalismManager extends SkillManager { */ private boolean processGreenThumbPlants(BlockState blockState, BlockBreakEvent blockBreakEvent, boolean greenTerra) { if (!ItemUtils.isHoe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand()) - && !ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) { + && !ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) { return false; } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ad1a09e69..a853f697f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -451,6 +451,14 @@ Skills: Tree_Feller_Sounds: true Level_Cap: 0 +# Disable or Enable the Green Thumb auto replant feature for specific crops, use the name of the block not the crop itemstack +Green_Thumb_Replanting_Crops: + Carrots: true + Wheat: true + Nether_Wart: true + Potatoes: true + Beetroots: true + Cocoa: true # # Settings for Double Drops ###