diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java index a533445b..ef8f4364 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java @@ -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 descriptionsKey = new PersistentDataKey<>( - this.getPlugin().getNamespacedKeyFactory().create("descriptions_enabled"), + public static final PersistentDataKey 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 { diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java index d6c7815b..8dbb990c 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java @@ -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 { return true; } - return PlayerProfile.getProfile(player).read("descriptions", true); + return PlayerProfile.load(player).read(CommandToggleDescriptions.DESCRIPTIONS_KEY); } }