This commit is contained in:
nulli0n committed 2024-11-20 18:37:17 +05:00
1 parent 5a13e98744
commit af553c6f63
2 files changed
+8

No files matched your search

@@ -5,6 +5,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.nightcore.util.StringUtil;
import su.nightexpress.nightcore.util.TriFunction;
import su.nightexpress.nightcore.util.bukkit.NightItem;
import su.nightexpress.nightcore.util.bukkit.NightSound;
import su.nightexpress.nightcore.util.wrapper.UniFormatter;
import su.nightexpress.nightcore.util.wrapper.UniParticle;
@@ -116,6 +117,11 @@ public class ConfigValue<T> {
return create(path, FileConfig::getItem, FileConfig::setItem, defaultValue, description);
}
@NotNull
public static ConfigValue<NightItem> create(@NotNull String path, @NotNull NightItem defaultValue, @Nullable String... description) {
return create(path, FileConfig::getCosmeticItem, FileConfig::set, defaultValue, description);
}
@NotNull
@Deprecated
public static ConfigValue<UniSound> create(@NotNull String path, @NotNull UniSound defaultValue, @Nullable String... description) {
@@ -153,6 +153,8 @@ public class FileConfig extends YamlConfiguration {
public void set(@NotNull String path, @Nullable Object value) {
if (value instanceof Writeable writeable) {
writeable.write(this, path);
this.changed = true;
return;
}
else if (value instanceof String str) {
value = Colorizer.plain(str);