diff --git a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java index f1d50190..70b072ac 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/jobsSign.java @@ -5,7 +5,8 @@ import org.bukkit.Location; import org.bukkit.World; import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.stuff.Util; + +import net.Zrips.CMILib.Container.CMIWorld; public class jobsSign { @@ -122,7 +123,7 @@ public class jobsSign { return; } - World world = Util.getWorld(split[0]); + World world = CMIWorld.getWorld(split[0]); if (world == null) return; diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 404762be..7c87a5c8 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -88,7 +88,7 @@ public class GeneralConfigManager { public boolean ignoreOreGenerators, useBlockProtection, enableSchedule, PayForRenaming, PayForEnchantingOnAnvil, PayForEachCraft, SignsEnabled, SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames, - PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, + PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable, BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding, boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, multiplyBoostedExtraValues/*, preventCropResizePayment*/, payItemDurabilityLoss, applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder, @@ -866,6 +866,9 @@ public class GeneralConfigManager { "Player will not get paid, but items will be brewd as they supose too"); PreventBrewingStandFillUps = c.get("ExploitProtections.Brew.PreventBrewingStandFillUps", false); + c.addComment("ExploitProtections.informOnPaymentDisable", "Do you want to show informational message when payments from blocks gets disabled due to hopper transfers"); + informOnPaymentDisable = c.get("ExploitProtections.informOnPaymentDisable", true); + c.addComment("use-breeder-finder", "Breeder finder.", "If you are not using breeding payment, you can disable this to save little resources. Really little."); useBreederFinder = c.get("use-breeder-finder", true); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 3ae3f700..15c416d0 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1106,8 +1106,7 @@ public final class JobsPaymentListener implements Listener { final Block finalBlock = block; plugin.getBlockOwnerShip(CMIMaterial.get(finalBlock)).ifPresent(os -> { - - if (os.disable(finalBlock)) { + if (os.disable(finalBlock) && Jobs.getGCManager().informOnPaymentDisable) { UUID uuid = plugin.getBlockOwnerShip(CMIMaterial.get(finalBlock)).get().getOwnerByLocation(finalBlock.getLocation()); Player player = Bukkit.getPlayer(uuid); @@ -1115,7 +1114,6 @@ public final class JobsPaymentListener implements Listener { return; JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - String lc = CMILocation.toString(finalBlock.getLocation()); if (!jPlayer.hasBlockOwnerShipInform(lc)) { @@ -1125,7 +1123,6 @@ public final class JobsPaymentListener implements Listener { jPlayer.addBlockOwnerShipInform(lc); } } - }); } @@ -1141,7 +1138,7 @@ public final class JobsPaymentListener implements Listener { if (Jobs.getGCManager().canPerformActionInWorld(stand.getWorld())) plugin.getBlockOwnerShip(CMIMaterial.get(stand.getBlock())).ifPresent(os -> { - if (os.disable(stand.getBlock())) { + if (os.disable(stand.getBlock()) && Jobs.getGCManager().informOnPaymentDisable) { UUID uuid = plugin.getBlockOwnerShip(CMIMaterial.get(stand.getBlock())).get().getOwnerByLocation(stand.getLocation()); Player player = Bukkit.getPlayer(uuid); @@ -1150,10 +1147,12 @@ public final class JobsPaymentListener implements Listener { JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); String lc = CMILocation.toString(stand.getLocation()); + if (!jPlayer.hasBlockOwnerShipInform(lc)) { CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled", "[type]", CMIMaterial.get(stand.getBlock()).getName(), "[location]", LC.Location_Full.getLocale(stand.getLocation()))); + jPlayer.addBlockOwnerShipInform(lc); } } }); diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Util.java b/src/main/java/com/gamingmesh/jobs/stuff/Util.java index 32ffaf6e..96828de0 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Util.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Util.java @@ -158,6 +158,7 @@ public final class Util { org.bukkit.attribute.AttributeInstance attr = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH); return attr == null ? 0d : attr.getBaseValue(); } + return entity.getMaxHealth(); } @@ -195,21 +196,6 @@ public final class Util { return item; } - public static World getWorld(String name) { - World w = Bukkit.getWorld(name); - if (w != null) - return w; - - name = name.replaceAll("[_|.|-]", ""); - - for (World one : Bukkit.getWorlds()) { - if (one.getName().replaceAll("[_|.|-]", "").equalsIgnoreCase(name)) - return one; - } - - return null; - } - public static PotionType getPotionByName(String name) { for (PotionType one : PotionType.values()) { if (one.toString().equalsIgnoreCase(name)) {