Added option to set rate limit timeframe

This commit is contained in:
Auxilor
2021-11-02 17:44:57 +00:00
parent 7141b12e95
commit aa4ac4c6d1
2 changed files with 11 additions and 4 deletions

View File

@@ -80,9 +80,11 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
modifyRateValueBy(player, 1)
scheduledExecutor.schedule({
modifyRateValueBy(player, -1)
}, 1, TimeUnit.SECONDS)
scheduledExecutor.schedule(
{ modifyRateValueBy(player, -1) },
this.getPlugin().configYml.getInt("async-display.ratelimit.timeframe").toLong(),
TimeUnit.SECONDS
)
}
private fun usingAsync(player: Player): Boolean {

View File

@@ -52,9 +52,14 @@ async-display:
ratelimit:
# If rate limit async display should be used.
enabled: true
# The amount of window items packets per second needed to enable async display
# The amount of window items packets per timeframe needed to enable async display
# for a specified player.
cutoff: 5
# The length of the timeframe in seconds.
# Cutoff 5, Timeframe 1 means that if there are more than 5 window items packets
# being sent per second for a player, then that player should have their packets
# handled asynchronously.
timeframe: 1
mysql:
enabled: false # Set to false, data.yml will be used instead.