mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
NpcAPI:
Added functions for adding keywords to global script running ++ addGlobalObject(String,Object) ++ removeGlobalObject(String) ++ getEngineObjects()
This commit is contained in:
1 parent
718a867411
commit
7a715ef308
4 files changed
+20
-1
No files matched your search
@@ -58,6 +58,7 @@ import java.util.*;
|
||||
|
||||
public class NpcAPI extends AbstractNpcAPI {
|
||||
private static final Map<Integer, ScriptWorld> worldCache = new LRUHashMap<>(10);
|
||||
public static final HashMap<String,Object> engineObjects = new HashMap<>();
|
||||
public static final EventBus EVENT_BUS = new EventBus();
|
||||
private static AbstractNpcAPI instance = null;
|
||||
|
||||
@@ -68,6 +69,18 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
worldCache.clear();
|
||||
}
|
||||
|
||||
public void addGlobalObject(String key, Object obj) {
|
||||
NpcAPI.engineObjects.put(key,obj);
|
||||
}
|
||||
|
||||
public void removeGlobalObject(String key) {
|
||||
NpcAPI.engineObjects.remove(key);
|
||||
}
|
||||
|
||||
public HashMap<String,Object> getEngineObjects() {
|
||||
return NpcAPI.engineObjects;
|
||||
}
|
||||
|
||||
public long sizeOfObject(Object obj) {
|
||||
return ObjectSizeCalculator.getObjectSize(obj);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user