mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01: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;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
###
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user