mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 08:40:01 +01:00
FlatWordBuckets: Ensure that at least as many entries as added get
released.
This commit is contained in:
parent
fe439d014f
commit
45951b5013
@ -15,6 +15,7 @@ public class FlatWordBuckets extends AbstractWordProcessor{
|
||||
final long durBucket;
|
||||
final int nBuckets;
|
||||
final float factor;
|
||||
|
||||
public FlatWordBuckets(int maxSize, int nBuckets, long durBucket, float factor){
|
||||
super("FlatWordBuckets");
|
||||
this.maxSize = maxSize;
|
||||
@ -27,12 +28,11 @@ public class FlatWordBuckets extends AbstractWordProcessor{
|
||||
@Override
|
||||
public void start(MessageLetterCount message) {
|
||||
if (entries.size() + message.words.length > maxSize)
|
||||
releaseMap(entries, maxSize / 10);
|
||||
releaseMap(entries, Math.max(message.words.length, maxSize / 10));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float loop(long ts, int index, String key,
|
||||
WordLetterCount message) {
|
||||
public float loop(long ts, int index, String key, WordLetterCount word) {
|
||||
ActionFrequency freq = entries.get(key);
|
||||
if (freq == null){
|
||||
freq = new ActionFrequency(nBuckets, durBucket);
|
||||
|
Loading…
Reference in New Issue
Block a user