From eed592e5bdd2d9874bece36fa85452add45bca64 Mon Sep 17 00:00:00 2001 From: Zrips Date: Wed, 8 May 2024 16:26:13 +0300 Subject: [PATCH] Config option for BlockTracker plugin usage --- src/main/java/com/gamingmesh/jobs/Jobs.java | 2 +- .../gamingmesh/jobs/config/GeneralConfigManager.java | 8 ++++++-- .../jobs/listeners/JobsPaymentListener.java | 11 ++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 891f4745..03a1232a 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -1019,7 +1019,7 @@ public final class Jobs extends JavaPlugin { List progression = jPlayer.getJobProgression(); int numjobs = progression.size(); - if (!isBpOk(jPlayer, info, block, true)) + if (!Jobs.getGCManager().useBlockProtectionBlockTracker && !isBpOk(jPlayer, info, block, true)) return; // no job diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index f6270d9d..c6957851 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -93,7 +93,7 @@ public class GeneralConfigManager { private FireworkEffect fireworkEffect; - public boolean ignoreOreGenerators, useBlockProtection, enableSchedule, PayForRenaming, PayForEnchantingOnAnvil, PayForEachCraft, SignsEnabled, + public boolean ignoreOreGenerators, useBlockProtection, useBlockProtectionBlockTracker, enableSchedule, PayForRenaming, PayForEnchantingOnAnvil, PayForEachCraft, SignsEnabled, SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames, PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable, BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding, @@ -884,7 +884,11 @@ public class GeneralConfigManager { "Enable blocks protection, like ore, from exploiting by placing and destroying same block again and again.", "Modify restrictedBlocks.yml for blocks you want to protect"); useBlockProtection = c.get("ExploitProtections.General.PlaceAndBreak.Enabled", c.getC().getBoolean("ExploitProtections.General.PlaceAndBreakProtection", true)); - + + c.addComment("ExploitProtections.General.PlaceAndBreak.BlockTracker.Enabled", + "Should we use BlockTracker plugin instead of built in block tracker"); + useBlockProtectionBlockTracker = c.get("ExploitProtections.General.PlaceAndBreak.BlockTracker.Enabled", false); + c.addComment("ExploitProtections.General.PlaceAndBreak.IgnoreOreGenerators", "Enabling this we will ignore blocks generated in ore generators, liko stone, coublestone and obsidian. You can still use timer on player placed obsidian block"); ignoreOreGenerators = c.get("ExploitProtections.General.PlaceAndBreak.IgnoreOreGenerators", true); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 5afb2086..eff1c8f3 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -418,8 +418,8 @@ public final class JobsPaymentListener implements Listener { return; // Checks whether the broken block has been tracked by BlockTracker - if (JobsHook.BlockTracker.isEnabled()) { - if (HookManager.getBlockTrackerManager().isTracked(block)) return; + if (JobsHook.BlockTracker.isEnabled() && Jobs.getGCManager().useBlockProtectionBlockTracker && HookManager.getBlockTrackerManager().isTracked(block)) { + return; } Player player = event.getPlayer(); @@ -438,7 +438,6 @@ public final class JobsPaymentListener implements Listener { if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName())) return; - BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK); FastPayment fp = Jobs.FASTPAYMENT.get(player.getUniqueId()); @@ -551,7 +550,7 @@ public final class JobsPaymentListener implements Listener { } if (JobsHook.PyroFishingPro.isEnabled()) { - if(PyroFishingProManager.lastFish != null) { + if (PyroFishingProManager.lastFish != null) { Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new PyroFishingProInfo(PyroFishingProManager.lastFish, ActionType.PYROFISHINGPRO)); } return; @@ -1668,9 +1667,7 @@ public final class JobsPaymentListener implements Listener { return; CMIEntityType type = CMIEntityType.get(event.getEntityType()); - - - + if (type != CMIEntityType.TNT && type != CMIEntityType.TNT_MINECART && type != CMIEntityType.ENDER_CRYSTAL) return;