1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00
This commit is contained in:
BuildTools 2021-03-27 05:48:50 +08:00
parent c0058a3994
commit 8eb196caaa

View File

@ -9,6 +9,8 @@ import io.github.thebusybiscuit.cscorelib2.config.Config;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import java.util.List;
/** /**
* This class represents a Setting for a {@link SlimefunItem} that can be modified via * This class represents a Setting for a {@link SlimefunItem} that can be modified via
* the {@code Items.yml} {@link Config} file. * the {@code Items.yml} {@link Config} file.
@ -149,7 +151,7 @@ public class ItemSetting<T> {
SlimefunPlugin.getItemCfg().setDefaultValue(item.getId() + '.' + getKey(), getDefaultValue()); SlimefunPlugin.getItemCfg().setDefaultValue(item.getId() + '.' + getKey(), getDefaultValue());
Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getId() + '.' + getKey()); Object configuredValue = SlimefunPlugin.getItemCfg().getValue(item.getId() + '.' + getKey());
if (defaultValue.getClass().isInstance(configuredValue)) { if (defaultValue.getClass().isInstance(configuredValue) || (configuredValue instanceof List && defaultValue instanceof List)) {
// We can do an unsafe cast here, we did an isInstance(...) check before! // We can do an unsafe cast here, we did an isInstance(...) check before!
T newValue = (T) configuredValue; T newValue = (T) configuredValue;