Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Dec 3, 2023
2 parents 3495d23 + 59dfeeb commit 77de51b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ public final class PersistentDataKey<T> {
*/
private final PersistentDataKeyType<T> 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<T> 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.
*
Expand All @@ -42,6 +67,7 @@ public PersistentDataKey(@NotNull final NamespacedKey key,
this.key = key;
this.defaultValue = defaultValue;
this.type = type;
this.local = false;

Eco.get().registerPersistentKey(this);
}
Expand Down Expand Up @@ -82,6 +108,8 @@ public PersistentDataKeyType<T> getType() {
return this.type;
}

public boolean isLocalStorage() { return this.local; }

/**
* Get all persistent data keys.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,10 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
},
IntegrationLoader("PlayerPoints") { Prices.registerPriceFactory(PriceFactoryPlayerPoints()) },
IntegrationLoader("RoyaleEconomy") {
for (currency in MultiCurrencyHandler.getCurrencies()) {
Prices.registerPriceFactory(PriceFactoryRoyaleEconomy(currency))
if (!MultiCurrencyHandler.getCurrencies().isNullOrEmpty()) {
for (currency in MultiCurrencyHandler.getCurrencies()) {
Prices.registerPriceFactory(PriceFactoryRoyaleEconomy(currency))
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ class EcoServerProfile(

private val PersistentDataKey<*>.isLocal: Boolean
get() = this == localServerIDKey || EcoPlugin.getPlugin(this.key.namespace)?.isUsingLocalStorage == true
|| this.isLocalStorage

0 comments on commit 77de51b

Please sign in to comment.