mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 13:09:11 +00:00
Moved NpcAPI.actionManager to ActionManager.GLOBAL
This commit is contained in:
1 parent
70f0ab1e6f
commit
91dc56bf87
3 files changed
+19
-7
No files matched your search
@@ -7,6 +7,7 @@ import noppes.npcs.api.handler.data.IActionQueue;
|
||||
import noppes.npcs.api.handler.data.actions.IConditionalAction;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.action.action.ConditionalAction;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
@@ -21,6 +22,8 @@ import java.util.function.Function;
|
||||
* - cancellation & clearing
|
||||
*/
|
||||
public class ActionManager implements IActionManager {
|
||||
public static final ActionManager GLOBAL = new ActionManager("GLOBAL");
|
||||
|
||||
protected boolean isWorking = false;
|
||||
public ActionLogger LOGGER = new ActionLogger(this);
|
||||
protected String name = "";
|
||||
@@ -33,6 +36,19 @@ public class ActionManager implements IActionManager {
|
||||
protected boolean debug;
|
||||
protected ScriptContainer reportTo;
|
||||
|
||||
private static final Map<Object, IActionListener> listeners = new WeakHashMap<>();
|
||||
|
||||
public IActionListener getOrCreateListener(Object obj) {
|
||||
return listeners.computeIfAbsent(obj, o -> new ActionListener(o));
|
||||
}
|
||||
|
||||
public ActionManager() {
|
||||
}
|
||||
|
||||
public ActionManager(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IActionManager start() {
|
||||
|
||||
Reference in new issue
Block a user