feat: introduce a flag section into the config for instabreak (#4368)

* Added and applied config

* removed wrong return logic
This commit is contained in:
Maurice 2024-03-07 21:34:25 +01:00 committed by GitHub
parent 5344efd1b7
commit 25e98618b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -670,7 +670,11 @@ public class BlockEventListener implements Listener {
BlockBreakEvent call = new BlockBreakEvent(block, player);
Bukkit.getServer().getPluginManager().callEvent(call);
if (!call.isCancelled()) {
event.getBlock().breakNaturally();
if (Settings.Flags.INSTABREAK_CONSIDER_TOOL) {
block.breakNaturally(event.getItemInHand());
} else {
block.breakNaturally();
}
}
}
// == rather than <= as we only care about the "ground level" not being destroyed

View File

@ -723,6 +723,12 @@ public class Settings extends Config {
}
@Comment("Settings related to flags")
public static final class Flags {
@Comment("If \"instabreak\" should consider the used tool.")
public static boolean INSTABREAK_CONSIDER_TOOL = false;
}
@Comment({"Enable or disable parts of the plugin",
"Note: A cache will use some memory if enabled"})