mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Fix for constant message flood for brewing stand payments being disabled
New option to disable messages informing about disabled payments from blocks
This commit is contained in:
parent
3d2f4d710a
commit
6dd5ff0907
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user