mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
You can now disable Green Thumb for specific crops (the auto replanting) in config.yml
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user