mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 12:46:09 +01:00
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 void setAutoLeave(boolean autoLeave);
|
||||||
|
|
||||||
|
public long getLastFrostwalkerMessage();
|
||||||
|
|
||||||
|
public void setLastFrostwalkerMessage();
|
||||||
|
|
||||||
public void setMonitorJoins(boolean monitor);
|
public void setMonitorJoins(boolean monitor);
|
||||||
|
|
||||||
public boolean isMonitoringJoins();
|
public boolean isMonitoringJoins();
|
||||||
|
@ -139,8 +139,15 @@ public class FactionsBlockListener implements Listener {
|
|||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
Location location = event.getBlock().getLocation();
|
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.
|
// 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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
protected transient boolean autoSafeZoneEnabled;
|
protected transient boolean autoSafeZoneEnabled;
|
||||||
protected transient boolean autoWarZoneEnabled;
|
protected transient boolean autoWarZoneEnabled;
|
||||||
protected transient boolean loginPvpDisabled;
|
protected transient boolean loginPvpDisabled;
|
||||||
|
protected transient long lastFrostwalkerMessage;
|
||||||
|
|
||||||
|
|
||||||
public void login() {
|
public void login() {
|
||||||
@ -134,6 +135,14 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
P.p.debug(name + " set autoLeave to " + willLeave);
|
P.p.debug(name + " set autoLeave to " + willLeave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getLastFrostwalkerMessage() {
|
||||||
|
return this.lastFrostwalkerMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastFrostwalkerMessage() {
|
||||||
|
this.lastFrostwalkerMessage = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
public Faction getAutoClaimFor() {
|
public Faction getAutoClaimFor() {
|
||||||
return autoClaimFor;
|
return autoClaimFor;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user