You can now disable Green Thumb for specific crops (the auto replanting) in config.yml

This commit is contained in:
nossr50 2021-02-26 16:18:15 -08:00
parent 735a90fb35
commit 713b0619c3
4 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,7 @@
Version 2.1.175 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 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 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 Version 2.1.174
Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake) Some legacy color codes in our locale file were swapped to &-code equivalents (thanks ViaSnake)

View File

@ -9,6 +9,7 @@ import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; 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 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 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);
}
} }

View File

@ -182,8 +182,10 @@ public class HerbalismManager extends SkillManager {
//TODO: The design of Green Terra needs to change, this is a mess //TODO: The design of Green Terra needs to change, this is a mess
if(Permissions.greenThumbPlant(getPlayer(), originalBreak.getType())) { if(Permissions.greenThumbPlant(getPlayer(), originalBreak.getType())) {
if(!getPlayer().isSneaking()) { if(Config.getInstance().isGreenThumbReplantableCrop(originalBreak.getType())) {
greenThumbActivated = processGreenThumbPlants(originalBreak, blockBreakEvent, isGreenTerraActive()); 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) { private boolean processGreenThumbPlants(BlockState blockState, BlockBreakEvent blockBreakEvent, boolean greenTerra) {
if (!ItemUtils.isHoe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand()) if (!ItemUtils.isHoe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())
&& !ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) { && !ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) {
return false; return false;
} }

View File

@ -451,6 +451,14 @@ Skills:
Tree_Feller_Sounds: true Tree_Feller_Sounds: true
Level_Cap: 0 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 # Settings for Double Drops
### ###