mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-24 00:41:23 +01:00
Fixed migration
This commit is contained in:
parent
d281430a4d
commit
8ae4964d2e
@ -5,6 +5,7 @@ import com.willfp.eco.core.command.impl.Subcommand;
|
||||
import com.willfp.eco.core.data.PlayerProfile;
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKey;
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType;
|
||||
import com.willfp.eco.util.NamespacedKeyUtils;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -13,8 +14,8 @@ public class CommandToggleDescriptions extends Subcommand {
|
||||
/**
|
||||
* Persistent data key for descriptions.
|
||||
*/
|
||||
private final PersistentDataKey<Boolean> descriptionsKey = new PersistentDataKey<>(
|
||||
this.getPlugin().getNamespacedKeyFactory().create("descriptions_enabled"),
|
||||
public static final PersistentDataKey<Boolean> DESCRIPTIONS_KEY = new PersistentDataKey<>(
|
||||
NamespacedKeyUtils.create("ecoenchants", "descriptions_enabled"),
|
||||
PersistentDataKeyType.BOOLEAN,
|
||||
true
|
||||
);
|
||||
@ -37,9 +38,9 @@ public class CommandToggleDescriptions extends Subcommand {
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile profile = PlayerProfile.load(player);
|
||||
boolean currentStatus = profile.read(descriptionsKey);
|
||||
boolean currentStatus = profile.read(DESCRIPTIONS_KEY);
|
||||
currentStatus = !currentStatus;
|
||||
profile.write(descriptionsKey, currentStatus);
|
||||
profile.write(DESCRIPTIONS_KEY, currentStatus);
|
||||
if (currentStatus) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("enabled-descriptions"));
|
||||
} else {
|
||||
|
@ -2,7 +2,8 @@ package com.willfp.ecoenchants.display.options;
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.ecoenchants.data.storage.PlayerProfile;
|
||||
import com.willfp.eco.core.data.PlayerProfile;
|
||||
import com.willfp.ecoenchants.command.CommandToggleDescriptions;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -62,6 +63,6 @@ public class DescriptionOptions extends PluginDependent<EcoPlugin> {
|
||||
return true;
|
||||
}
|
||||
|
||||
return PlayerProfile.getProfile(player).read("descriptions", true);
|
||||
return PlayerProfile.load(player).read(CommandToggleDescriptions.DESCRIPTIONS_KEY);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user