Skip to content

Commit

Permalink
feat: introduce a flag section into the config for instabreak (#4368)
Browse files Browse the repository at this point in the history
* Added and applied config

* removed wrong return logic
  • Loading branch information
Tamikaschu committed Mar 7, 2024
1 parent 5344efd commit 25e9861
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,11 @@ public void onBlockDamage(BlockDamageEvent event) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,12 @@ public static final class Titles {

}

@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"})
Expand Down

0 comments on commit 25e9861

Please sign in to comment.