Fix command queuing from console
This commit is contained in:
parent
cf27decdb4
commit
7eb83c000b
@ -269,9 +269,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
// Queue for async tasks
|
||||
private AtomicInteger runningCount = new AtomicInteger();
|
||||
private SimpleAsyncNotifyQueue asyncNotifyQueue = new SimpleAsyncNotifyQueue(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
private SimpleAsyncNotifyQueue asyncNotifyQueue = new SimpleAsyncNotifyQueue((t, e) -> {
|
||||
while (e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
}
|
||||
@ -285,7 +283,6 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -4,9 +4,9 @@ import com.boydti.fawe.util.TaskManager;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public abstract class AsyncNotifyQueue {
|
||||
private Object lock = new Object();
|
||||
private final Runnable task;
|
||||
private final AtomicBoolean running = new AtomicBoolean();
|
||||
protected Object lock = new Object();
|
||||
protected final Runnable task;
|
||||
protected final AtomicBoolean running = new AtomicBoolean();
|
||||
|
||||
public AsyncNotifyQueue() {
|
||||
this.task = new Runnable() {
|
||||
@ -25,7 +25,7 @@ public abstract class AsyncNotifyQueue {
|
||||
|
||||
public void queue(Runnable queueTask) {
|
||||
synchronized (lock) {
|
||||
queueTask.run();
|
||||
if (queueTask != null) queueTask.run();
|
||||
if (!running.get()) {
|
||||
running.set(true);
|
||||
TaskManager.IMP.async(task);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.object.task;
|
||||
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class SimpleAsyncNotifyQueue extends AsyncNotifyQueue {
|
||||
@ -27,6 +29,16 @@ public class SimpleAsyncNotifyQueue extends AsyncNotifyQueue {
|
||||
}
|
||||
}
|
||||
|
||||
public void queue(Runnable queueTask) {
|
||||
synchronized (lock) {
|
||||
if (queueTask != null) tasks.add(queueTask);
|
||||
if (!running.get()) {
|
||||
running.set(true);
|
||||
TaskManager.IMP.async(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return tasks.size();
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ public final class CommandManager {
|
||||
public void run() {
|
||||
handleCommandOnCurrentThread(finalEvent);
|
||||
}
|
||||
}, true, false)) {
|
||||
}, false, true)) {
|
||||
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
|
||||
}
|
||||
finalEvent.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user