Add cooldown for auto showing f map to players. Fixes issue #64.
This commit is contained in:
parent
49e69b74c8
commit
272c35cda6
10
pom.xml
10
pom.xml
@ -50,9 +50,9 @@
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.daboross.vault</groupId>
|
||||
<artifactId>vault-api</artifactId>
|
||||
<version>1.3.01</version>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -81,8 +81,8 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>repo-daboross-net</id>
|
||||
<url>http://repo.daboross.net/</url>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
|
@ -542,10 +542,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
|
||||
// Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds.
|
||||
new FInfoBoard(getPlayer(), toShow, true);
|
||||
} else {
|
||||
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
|
||||
String msg = P.p.txt.parse("<i>") + " ~ " + factionHere.getTag(this);
|
||||
if (factionHere.getDescription().length() > 0) {
|
||||
msg += " - " + factionHere.getDescription();
|
||||
String msg = P.p.txt.parse("<i>") + " ~ " + toShow.getTag(this);
|
||||
if (toShow.getDescription().length() > 0) {
|
||||
msg += " - " + toShow.getDescription();
|
||||
}
|
||||
this.sendMessage(msg);
|
||||
}
|
||||
|
@ -16,9 +16,8 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class FactionsPlayerListener implements Listener {
|
||||
@ -56,6 +55,9 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// Holds the next time a player can have a map shown.
|
||||
private HashMap<UUID, Long> showTimes = new HashMap<UUID, Long>();
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
@ -87,13 +89,15 @@ public class FactionsPlayerListener implements Listener {
|
||||
Faction factionTo = Board.getFactionAt(to);
|
||||
boolean changedFaction = (factionFrom != factionTo);
|
||||
|
||||
/* Was used for displaying on Spout but we removed Spout compatibility.
|
||||
if (changedFaction)
|
||||
changedFaction = false;
|
||||
*/
|
||||
|
||||
if (me.isMapAutoUpdating()) {
|
||||
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
|
||||
if(showTimes.containsKey(player.getUniqueId()) && (showTimes.get(player.getUniqueId()) > System.currentTimeMillis())) {
|
||||
if(P.p.getConfig().getBoolean("findfactionsexploit.log", false)) {
|
||||
P.p.log(Level.WARNING, "%s tried to show a faction map too soon and triggered exploit blocker.", player.getName());
|
||||
}
|
||||
} else {
|
||||
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
|
||||
showTimes.put(player.getUniqueId(), System.currentTimeMillis() + P.p.getConfig().getLong("findfactionsexploit.cooldown", 2000));
|
||||
}
|
||||
} else {
|
||||
Faction myFaction = me.getFaction();
|
||||
String ownersTo = myFaction.getOwnerListString(to);
|
||||
|
@ -10,6 +10,14 @@
|
||||
# It's suggested that you only turn this on at the direction of a developer.
|
||||
debug: false
|
||||
|
||||
# Prevent find factions exploit
|
||||
# This will help limit how many times a player can be sent a map of factions.
|
||||
# Set this to the cooldown you want, in miliseconds, for a map to be shown to a player.
|
||||
# If you want to log when a player violates this (only happens on chunk enter so it shouldn't be too spammy),
|
||||
# set log to true and it will be logged to console as "player tried to show a faction map too soon and triggered exploit blocker."
|
||||
findfactionsexploit:
|
||||
cooldown: 2000 # in miliseconds. 2000 = 2 seconds.
|
||||
log: false
|
||||
|
||||
# Configuration section for Scoreboards
|
||||
# This will allow you to completely customize how your scoreboards look.
|
||||
|
Loading…
Reference in New Issue
Block a user