Only send frostwalker message every 10 seconds
This commit is contained in:
parent
a7aeb26fd0
commit
5721473a16
@ -41,6 +41,10 @@ public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
public void setAutoLeave(boolean autoLeave);
|
||||
|
||||
public long getLastFrostwalkerMessage();
|
||||
|
||||
public void setLastFrostwalkerMessage();
|
||||
|
||||
public void setMonitorJoins(boolean monitor);
|
||||
|
||||
public boolean isMonitoringJoins();
|
||||
|
@ -139,8 +139,15 @@ public class FactionsBlockListener implements Listener {
|
||||
Player player = (Player) event.getEntity();
|
||||
Location location = event.getBlock().getLocation();
|
||||
|
||||
// only notify every 10 seconds
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis();
|
||||
if (!justCheck) {
|
||||
fPlayer.setLastFrostwalkerMessage();
|
||||
}
|
||||
|
||||
// Check if they have build permissions here. If not, block this from happening.
|
||||
if (!playerCanBuildDestroyBlock(player, location, "frost walk", false)) {
|
||||
if (!playerCanBuildDestroyBlock(player, location, "frost walk", justCheck)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
protected transient boolean autoSafeZoneEnabled;
|
||||
protected transient boolean autoWarZoneEnabled;
|
||||
protected transient boolean loginPvpDisabled;
|
||||
protected transient long lastFrostwalkerMessage;
|
||||
|
||||
|
||||
public void login() {
|
||||
@ -134,6 +135,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
P.p.debug(name + " set autoLeave to " + willLeave);
|
||||
}
|
||||
|
||||
public long getLastFrostwalkerMessage() {
|
||||
return this.lastFrostwalkerMessage;
|
||||
}
|
||||
|
||||
public void setLastFrostwalkerMessage() {
|
||||
this.lastFrostwalkerMessage = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Faction getAutoClaimFor() {
|
||||
return autoClaimFor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user