Small PPS change to allow %pps to be used as a placeholder.

This commit is contained in:
Myles 2016-06-22 21:31:27 +01:00
parent 32c43e6023
commit 808a9a7d82
2 changed files with 4 additions and 4 deletions

View File

@ -464,7 +464,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
// Max PPS Checker // Max PPS Checker
if (conf.getMaxPPS() > 0) { if (conf.getMaxPPS() > 0) {
if (info.getPacketsPerSecond() >= conf.getMaxPPS()) { if (info.getPacketsPerSecond() >= conf.getMaxPPS()) {
info.disconnect(conf.getMaxPPSKickMessage()); info.disconnect(conf.getMaxPPSKickMessage().replace("%pps", ((Long) info.getPacketsPerSecond()).intValue() + ""));
return true; // don't send current packet return true; // don't send current packet
} }
} }
@ -482,7 +482,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
} }
if (info.getWarnings() >= conf.getMaxWarnings()) { if (info.getWarnings() >= conf.getMaxWarnings()) {
info.disconnect(conf.getMaxWarningsKickMessage()); info.disconnect(conf.getMaxWarningsKickMessage().replace("%pps", ((Long) info.getPacketsPerSecond()).intValue() + ""));
return true; // don't send current packet return true; // don't send current packet
} }
} }

View File

@ -20,9 +20,9 @@ send-supported-versions: false
# Anti-Cheat, Packets Per Second (PPS) limiter # Anti-Cheat, Packets Per Second (PPS) limiter
# Clients by default send around 20-90 packets per second. # Clients by default send around 20-90 packets per second.
# What is the maximum per second a client can send # What is the maximum per second a client can send (Use %pps to display their pps)
# Use -1 to disable. # Use -1 to disable.
max-pps: 400 max-pps: 600
max-pps-kick-msg: "You are sending too many packets!" max-pps-kick-msg: "You are sending too many packets!"
# We can also kick them if over a period they send over a threshold a certain amount of times. # We can also kick them if over a period they send over a threshold a certain amount of times.