diff --git a/src/me/topchetoeu/jscript/engine/Data.java b/src/me/topchetoeu/jscript/engine/Data.java index 6c2d58f..54b78a2 100644 --- a/src/me/topchetoeu/jscript/engine/Data.java +++ b/src/me/topchetoeu/jscript/engine/Data.java @@ -5,7 +5,6 @@ import java.util.Map; @SuppressWarnings("unchecked") public class Data { - public final Data parent; private HashMap, Object> data = new HashMap<>(); public Data copy() { @@ -33,19 +32,12 @@ public class Data { return this; } public T get(DataKey key, T val) { - for (var it = this; it != null; it = it.parent) { - if (it.data.containsKey(key)) { - return (T)it.data.get((DataKey)key); - } - } - + if (data.containsKey(key)) return (T)data.get((DataKey)key); set(key, val); return val; } public T get(DataKey key) { - for (var it = this; it != null; it = it.parent) { - if (it.data.containsKey(key)) return (T)it.data.get((DataKey)key); - } + if (data.containsKey(key)) return (T)data.get((DataKey)key); return null; } public boolean has(DataKey key) { return data.containsKey(key); } @@ -61,11 +53,4 @@ public class Data { public int increase(DataKey key) { return increase(key, 1, 0); } - - public Data() { - this.parent = null; - } - public Data(Data parent) { - this.parent = parent; - } }