diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java index deed2e3d..594f8eda 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/ConfigMessage.java @@ -10,20 +10,22 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collection; import java.util.List; public class ConfigMessage { private final String key; - private final List lines; + private final List lines = new ArrayList<>(); private final boolean papiPlaceholders, actionbar, raw; private ConfigMessage(@NotNull String key) { this.key = key; final Object obj = MMOCore.plugin.configManager.getMessageObject(key); - this.lines = obj == null ? Arrays.asList("") : obj instanceof List ? (List) obj : Arrays.asList(obj.toString()); + if (obj == null) lines.add(""); + else if (obj instanceof List) lines.addAll((List) obj); + else lines.add(obj.toString()); // Does message include placeholders boolean hasPlaceholders = false; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index f6ee9621..0c5a3764 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -207,6 +207,9 @@ public class ConfigManager { return messages.getStringList(key); } + /** + * @return The original object, which should be cloned afterwards!! + */ @Nullable public Object getMessageObject(String key) { return messages.get(key);