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>
|
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.daboross.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>vault-api</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
<version>1.3.01</version>
|
<version>1.4</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -81,8 +81,8 @@
|
|||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>repo-daboross-net</id>
|
<id>vault-repo</id>
|
||||||
<url>http://repo.daboross.net/</url>
|
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ess-repo</id>
|
<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.
|
// Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds.
|
||||||
new FInfoBoard(getPlayer(), toShow, true);
|
new FInfoBoard(getPlayer(), toShow, true);
|
||||||
} else {
|
} else {
|
||||||
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
|
String msg = P.p.txt.parse("<i>") + " ~ " + toShow.getTag(this);
|
||||||
String msg = P.p.txt.parse("<i>") + " ~ " + factionHere.getTag(this);
|
if (toShow.getDescription().length() > 0) {
|
||||||
if (factionHere.getDescription().length() > 0) {
|
msg += " - " + toShow.getDescription();
|
||||||
msg += " - " + factionHere.getDescription();
|
|
||||||
}
|
}
|
||||||
this.sendMessage(msg);
|
this.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,8 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
import java.util.logging.Level;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
public class FactionsPlayerListener implements Listener {
|
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)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@ -87,13 +89,15 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
Faction factionTo = Board.getFactionAt(to);
|
Faction factionTo = Board.getFactionAt(to);
|
||||||
boolean changedFaction = (factionFrom != factionTo);
|
boolean changedFaction = (factionFrom != factionTo);
|
||||||
|
|
||||||
/* Was used for displaying on Spout but we removed Spout compatibility.
|
|
||||||
if (changedFaction)
|
|
||||||
changedFaction = false;
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (me.isMapAutoUpdating()) {
|
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 {
|
} else {
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
String ownersTo = myFaction.getOwnerListString(to);
|
String ownersTo = myFaction.getOwnerListString(to);
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
# It's suggested that you only turn this on at the direction of a developer.
|
# It's suggested that you only turn this on at the direction of a developer.
|
||||||
debug: false
|
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
|
# Configuration section for Scoreboards
|
||||||
# This will allow you to completely customize how your scoreboards look.
|
# This will allow you to completely customize how your scoreboards look.
|
||||||
|
Loading…
Reference in New Issue
Block a user