fixed sendingNowAntispam not properly being cleaned when player leaves
This commit is contained in:
@@ -79,4 +79,8 @@ public interface AdaptedPlayer extends Handle, Audience {
|
|||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
List<String> getPermissions();
|
List<String> getPermissions();
|
||||||
|
|
||||||
|
default boolean equals(AdaptedPlayer other) {
|
||||||
|
return this.getUniqueId().equals(other.getUniqueId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,14 +14,8 @@ import us.ajg0702.utils.common.Messages;
|
|||||||
import us.ajg0702.utils.common.TimeUtils;
|
import us.ajg0702.utils.common.TimeUtils;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
import java.util.concurrent.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class QueueManagerImpl implements QueueManager {
|
public class QueueManagerImpl implements QueueManager {
|
||||||
|
|
||||||
@@ -506,7 +500,8 @@ public class QueueManagerImpl implements QueueManager {
|
|||||||
sendPlayers(null);
|
sendPlayers(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
final HashMap<AdaptedPlayer, Long> sendingNowAntiSpam = new HashMap<>();
|
|
||||||
|
final ConcurrentHashMap<AdaptedPlayer, Long> sendingNowAntiSpam = new ConcurrentHashMap<>();
|
||||||
final HashMap<QueuePlayer, Integer> sendingAttempts = new HashMap<>();
|
final HashMap<QueuePlayer, Integer> sendingAttempts = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -640,6 +635,9 @@ public class QueueManagerImpl implements QueueManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear(AdaptedPlayer player) {
|
public void clear(AdaptedPlayer player) {
|
||||||
sendingNowAntiSpam.remove(player);
|
for (AdaptedPlayer next : sendingNowAntiSpam.keySet()) {
|
||||||
|
if(!next.equals(player)) continue;
|
||||||
|
sendingNowAntiSpam.remove(next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user