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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user