9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-26 10:29:10 +00:00

Added forced anti-grief support

This commit is contained in:
XiaoMoMi
2024-09-14 22:34:22 +08:00
parent f7f788a7d6
commit 92face1040
5 changed files with 20 additions and 1 deletions

View File

@@ -88,6 +88,7 @@ public class BukkitConfigManager extends ConfigManager {
.builder()
.setVersioning(new BasicVersioning("config-version"))
.addIgnoredRoute(configVersion, "other-settings.placeholder-register", '.')
.addIgnoredRoute(configVersion, "mechanics.hologram-offset-correction", '.')
.addIgnoredRoute(configVersion, "worlds.settings._WORLDS_", '.')
.build()
);
@@ -142,6 +143,8 @@ public class BukkitConfigManager extends ConfigManager {
worldeditSupport = config.getBoolean("other-settings.worldedit-support", false);
interveneAntiGrief = config.getBoolean("other-settings.intervene-anti-grief", false);
offsets.clear();
Section section = config.getSection("mechanics.hologram-offset-correction");
if (section != null) {

View File

@@ -474,10 +474,16 @@ public class BukkitItemManager extends AbstractItemManager {
public void handlePlayerBreak(Player player, Location location, ItemStack itemInHand, String brokenID, Cancellable event) {
Optional<CustomCropsWorld<?>> optionalWorld = plugin.getWorldManager().getWorld(player.getWorld());
if (optionalWorld.isEmpty()) {
if (ConfigManager.interveneAntiGrief() && antiGriefLib != null && !antiGriefLib.canBreak(player, location)) {
event.setCancelled(true);
}
return;
}
if (antiGriefLib != null && !antiGriefLib.canBreak(player, location)) {
if (ConfigManager.interveneAntiGrief()) {
event.setCancelled(true);
}
return;
}

View File

@@ -145,3 +145,8 @@ other-settings:
double-check: false
# Enable WorldEdit support (Experimental)
worldedit-support: false
# Whether to let CustomCrops intervene in the anti grief detection
# Sometimes some anti-grief plugins are not supported by custom item plugins, but they are supported by CustomCrops
# If you enable this option, CustomCrops will also protect those unsupported anti-grief plugins
# Supported plugins can be found on https://github.com/Xiao-MoMi/AntiGriefLib/blob/main/README.md
intervene-anti-grief: false