From 77be0a3794b6a1e6e7b70f4236c3791e872f9f50 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 13 Dec 2016 14:59:40 +1100 Subject: [PATCH] Have cancel clear queued actions --- core/src/main/java/com/boydti/fawe/command/Cancel.java | 1 + core/src/main/java/com/boydti/fawe/object/FawePlayer.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/core/src/main/java/com/boydti/fawe/command/Cancel.java b/core/src/main/java/com/boydti/fawe/command/Cancel.java index ff4fb9e8..80b6d116 100644 --- a/core/src/main/java/com/boydti/fawe/command/Cancel.java +++ b/core/src/main/java/com/boydti/fawe/command/Cancel.java @@ -24,6 +24,7 @@ public class Cancel extends FaweCommand { UUID uuid = player.getUUID(); Collection queues = SetQueue.IMP.getAllQueues(); int cancelled = 0; + player.clearActions(); for (FaweQueue queue : queues) { Set sessions = queue.getEditSessions(); for (EditSession session : sessions) { diff --git a/core/src/main/java/com/boydti/fawe/object/FawePlayer.java b/core/src/main/java/com/boydti/fawe/object/FawePlayer.java index 56ce81bf..b1bda605 100644 --- a/core/src/main/java/com/boydti/fawe/object/FawePlayer.java +++ b/core/src/main/java/com/boydti/fawe/object/FawePlayer.java @@ -145,6 +145,12 @@ public abstract class FawePlayer extends Metadatable { } } + public void clearActions() { + while (getActions().poll() != null) { + runningCount.decrementAndGet(); + } + } + private ConcurrentLinkedDeque getActions() { ConcurrentLinkedDeque adder = getMeta("fawe_action_v2"); if (adder == null) {