mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-27 19:09:09 +00:00
more blocks should be supported
This commit is contained in:
@@ -114,7 +114,11 @@ public abstract class AbstractCustomEventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
ItemStack itemStack = event.getItem();
|
||||
if (itemStack != null && itemStack.getType() == Material.BONE_MEAL && ConfigManager.overriddenCrops().contains(type)) {
|
||||
// Paper API
|
||||
// prevents player from using bone meals
|
||||
if (itemStack != null && itemStack.getType() == Material.BONE_MEAL
|
||||
&& ConfigManager.overriddenCrops().contains(type)
|
||||
&& ConfigManager.VANILLA_CROPS.contains(type)) {
|
||||
event.setUseItemInHand(Event.Result.DENY);
|
||||
}
|
||||
this.itemManager.handlePlayerInteractBlock(
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.momirealms.customcrops.api.misc.water.FillMethod;
|
||||
import net.momirealms.customcrops.api.misc.water.WateringMethod;
|
||||
import net.momirealms.customcrops.api.util.PluginUtils;
|
||||
import net.momirealms.customcrops.common.config.ConfigLoader;
|
||||
import net.momirealms.customcrops.common.helper.VersionHelper;
|
||||
import net.momirealms.customcrops.common.plugin.feature.Reloadable;
|
||||
import net.momirealms.customcrops.common.util.Pair;
|
||||
import org.bukkit.Material;
|
||||
@@ -39,6 +40,23 @@ import java.util.*;
|
||||
|
||||
public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
||||
|
||||
public static final Set<Material> VANILLA_CROPS;
|
||||
|
||||
static {
|
||||
HashSet<Material> set = new HashSet<>(
|
||||
List.of(Material.WHEAT, Material.CARROTS, Material.POTATOES, Material.BEETROOTS, Material.SWEET_BERRY_BUSH,
|
||||
Material.MELON_STEM, Material.PUMPKIN_STEM)
|
||||
);
|
||||
if (VersionHelper.isVersionNewerThan1_19_4()) {
|
||||
set.add(Material.TORCHFLOWER_CROP);
|
||||
}
|
||||
if (VersionHelper.isVersionNewerThan1_20()) {
|
||||
set.add(Material.PITCHER_CROP);
|
||||
}
|
||||
VANILLA_CROPS = Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
|
||||
private static ConfigManager instance;
|
||||
protected final BukkitCustomCropsPlugin plugin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user