Have cancel clear queued actions

This commit is contained in:
Jesse Boyd 2016-12-13 14:59:40 +11:00
parent 67b918b048
commit 77be0a3794
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ public class Cancel extends FaweCommand {
UUID uuid = player.getUUID();
Collection<FaweQueue> queues = SetQueue.IMP.getAllQueues();
int cancelled = 0;
player.clearActions();
for (FaweQueue queue : queues) {
Set<EditSession> sessions = queue.getEditSessions();
for (EditSession session : sessions) {

View File

@ -145,6 +145,12 @@ public abstract class FawePlayer<T> extends Metadatable {
}
}
public void clearActions() {
while (getActions().poll() != null) {
runningCount.decrementAndGet();
}
}
private ConcurrentLinkedDeque<Runnable> getActions() {
ConcurrentLinkedDeque<Runnable> adder = getMeta("fawe_action_v2");
if (adder == null) {