diff --git a/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java b/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java index 44ce98c9..00f0aa8b 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java +++ b/eco-api/src/main/java/com/willfp/eco/core/data/keys/PersistentDataKey.java @@ -29,6 +29,31 @@ public final class PersistentDataKey { */ private final PersistentDataKeyType type; + /** + * If the key uses local storage. + */ + private final boolean local; + + /** + * Create a new Persistent Data Key. + * + * @param key The key. + * @param type The data type. + * @param defaultValue The default value. + * @param local If the key uses local storage. + */ + public PersistentDataKey(@NotNull final NamespacedKey key, + @NotNull final PersistentDataKeyType type, + @NotNull final T defaultValue, + final boolean local) { + this.key = key; + this.defaultValue = defaultValue; + this.type = type; + this.local = local; + + Eco.get().registerPersistentKey(this); + } + /** * Create a new Persistent Data Key. * @@ -42,6 +67,7 @@ public final class PersistentDataKey { this.key = key; this.defaultValue = defaultValue; this.type = type; + this.local = false; Eco.get().registerPersistentKey(this); } @@ -82,6 +108,8 @@ public final class PersistentDataKey { return this.type; } + public boolean isLocalStorage() { return this.local; } + /** * Get all persistent data keys. * diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt index 7de71c37..72ba1062 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/data/EcoProfile.kt @@ -106,3 +106,4 @@ class EcoServerProfile( private val PersistentDataKey<*>.isLocal: Boolean get() = this == localServerIDKey || EcoPlugin.getPlugin(this.key.namespace)?.isUsingLocalStorage == true + || this.isLocalStorage