diff --git a/shared/src/main/java/net/codersky/mcutils/storage/DataMap.java b/shared/src/main/java/net/codersky/mcutils/storage/DataMap.java index c576c59..4049632 100644 --- a/shared/src/main/java/net/codersky/mcutils/storage/DataMap.java +++ b/shared/src/main/java/net/codersky/mcutils/storage/DataMap.java @@ -130,7 +130,7 @@ public Set getKeys(@NotNull String parent) { @SuppressWarnings("unchecked") private T getFromMap(@NotNull Map source, @NotNull String key, @NotNull Class type) { final Object obj = source.get(key); - return obj != null && obj.getClass().equals(type) ? (T) obj : null; + return obj != null && type.isAssignableFrom(obj.getClass()) ? (T) obj : null; } // - Objects - // @@ -154,9 +154,12 @@ public T get(@NotNull String key, T def) { @Nullable @SuppressWarnings("unchecked") public List getList(@NotNull String key, @NotNull Class type) { - final Object obj = get(key, Object.class); - if (obj instanceof LinkedList lst) - return lst.getClass().getTypeParameters()[0].getClass().equals(type) ? (List) lst : null; + final Object obj = get(key, List.class); + if (obj instanceof List lst) { + if (lst.isEmpty()) + return List.of(); + return lst.getFirst().getClass().equals(type) ? (List) lst : null; + } return null; }