diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 069e2880..4c8638f4 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -23,9 +23,11 @@ import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.UUID; import org.bukkit.OfflinePlayer; @@ -94,6 +96,8 @@ public class JobsPlayer { private PlayerPoints pointsData = new PlayerPoints(); + private Set blockOwnerShipInform = null; + public JobsPlayer(OfflinePlayer player) { this.userName = player.getName() == null ? "Unknown" : player.getName(); this.playerUUID = player.getUniqueId(); @@ -892,6 +896,7 @@ public class JobsPlayer { public void onDisconnect() { clearBossMaps(); isOnline = false; + blockOwnerShipInform = null; Jobs.getPlayerManager().addPlayerToCache(this); } @@ -1428,4 +1433,16 @@ public class JobsPlayer { map.put(job, cal.getTimeInMillis()); leftTimes.put(uuid, map); } + + public boolean hasBlockOwnerShipInform(String location) { + if (blockOwnerShipInform == null) + return false; + return blockOwnerShipInform.contains(location); + } + + public void addBlockOwnerShipInform(String location) { + if (blockOwnerShipInform == null) + blockOwnerShipInform = new HashSet(); + this.blockOwnerShipInform.add(location); + } } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 7809db13..3ae3f700 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1114,9 +1114,16 @@ public final class JobsPaymentListener implements Listener { if (player == null || !player.isOnline()) return; - CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled", - "[type]", CMIMaterial.get(finalBlock).getName(), - "[location]", LC.Location_Full.getLocale(finalBlock.getLocation()))); + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + + String lc = CMILocation.toString(finalBlock.getLocation()); + + if (!jPlayer.hasBlockOwnerShipInform(lc)) { + CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled", + "[type]", CMIMaterial.get(finalBlock).getName(), + "[location]", LC.Location_Full.getLocale(finalBlock.getLocation()))); + jPlayer.addBlockOwnerShipInform(lc); + } } }); @@ -1141,9 +1148,13 @@ public final class JobsPaymentListener implements Listener { if (player == null || !player.isOnline()) return; - CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled", - "[type]", CMIMaterial.get(stand.getBlock()).getName(), - "[location]", LC.Location_Full.getLocale(stand.getLocation()))); + 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()))); + } } }); }