diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index ff8fb460..62657ff9 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -1132,15 +1132,11 @@ public class Jobs extends JavaPlugin { return true; if (info.getType() == ActionType.BREAK) { - if (GconfigManager.allowBreakPaymentForOreGenerators) { - getBpManager().remove(block); - return true; - } - if (block.hasMetadata("JobsExploit")) { //player.sendMessage("This block is protected using Rukes' system!"); return false; } + BlockProtection bp = getBpManager().getBp(block.getLocation()); if (bp != null) { Long time = bp.getTime(); @@ -1150,22 +1146,27 @@ public class Jobs extends JavaPlugin { getBpManager().remove(block); return false; } + if ((time < System.currentTimeMillis()) && (bp.getAction() != DBAction.DELETE)) { getBpManager().remove(block); return true; } + if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) { int sec = Math.round((time - System.currentTimeMillis()) / 1000L); - if (inform) { - if (player.canGetPaid(info)) - ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); + if (inform && player.canGetPaid(info)) { + ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); } + return false; } + getBpManager().add(block, cd); + if ((cd == null || cd == 0) && GconfigManager.useGlobalTimer) { getBpManager().add(block, GconfigManager.globalblocktimer); } + } else if (GconfigManager.useGlobalTimer) { getBpManager().add(block, GconfigManager.globalblocktimer); } diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 8e2a27ce..3e585603 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -101,7 +101,7 @@ public class GeneralConfigManager { hideJobsInfoWithoutPermission, UseTaxes, TransferToServerAccount, TakeFromPlayersPayment, AutoJobJoinUse, AllowDelevel, BossBarEnabled, BossBarShowOnEachAction, BossBarsMessageByDefault, ExploreCompact, DBCleaningJobsUse, DBCleaningUsersUse, DisabledWorldsUse, UseAsWhiteListWorldList, PaymentMethodsMoney, PaymentMethodsPoints, PaymentMethodsExp, MythicMobsEnabled, - LoggingUse, allowBreakPaymentForOreGenerators; + LoggingUse; public ItemStack guiBackButton, guiNextButton, guiFiller; @@ -803,9 +803,9 @@ public class GeneralConfigManager { BlockProtectionDays = c.get("ExploitProtections.General.KeepDataFor", 14); BlockProtectionDays = BlockProtectionDays > 14 ? 14 : BlockProtectionDays; - c.addComment("ExploitProtections.General.AllowBreakPaymentForOreGenerators", "It allows you to pay for ore generator plugins continuously" + /*c.addComment("ExploitProtections.General.AllowBreakPaymentForOreGenerators", "It allows you to pay for ore generator plugins continuously" + " once you have broken the block in one place."); - allowBreakPaymentForOreGenerators = c.get("ExploitProtections.General.AllowBreakPaymentForOreGenerators", false); + allowBreakPaymentForOreGenerators = c.get("ExploitProtections.General.AllowBreakPaymentForOreGenerators", false);*/ c.addComment("ExploitProtections.General.GlobalBlockTimer", "All blocks will be protected X sec after player places it on ground."); useGlobalTimer = c.get("ExploitProtections.General.GlobalBlockTimer.use", true); diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Util.java b/src/main/java/com/gamingmesh/jobs/stuff/Util.java index 89b05719..d2794098 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Util.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Util.java @@ -43,7 +43,7 @@ public class Util { ItemStack item = CMIMaterial.PLAYER_HEAD.newItemStack(); SkullMeta skullMeta = (SkullMeta) item.getItemMeta(); if (skullOwner.length() == 36) { - OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(skullOwner); + OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner)); Jobs.getNms().setSkullOwner(skullMeta, offPlayer); } else skullMeta.setOwner(skullOwner);