forked from Upstream/mmocore
Fixed stuck player messages
This commit is contained in:
parent
7d93031aeb
commit
3c043babd5
@ -10,20 +10,22 @@ import org.bukkit.entity.Player;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ConfigMessage {
|
public class ConfigMessage {
|
||||||
private final String key;
|
private final String key;
|
||||||
private final List<String> lines;
|
private final List<String> lines = new ArrayList<>();
|
||||||
private final boolean papiPlaceholders, actionbar, raw;
|
private final boolean papiPlaceholders, actionbar, raw;
|
||||||
|
|
||||||
private ConfigMessage(@NotNull String key) {
|
private ConfigMessage(@NotNull String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
|
|
||||||
final Object obj = MMOCore.plugin.configManager.getMessageObject(key);
|
final Object obj = MMOCore.plugin.configManager.getMessageObject(key);
|
||||||
this.lines = obj == null ? Arrays.asList("<message_not_found:'" + key + "'>") : obj instanceof List<?> ? (List<String>) obj : Arrays.asList(obj.toString());
|
if (obj == null) lines.add("<message_not_found:'" + key + "'>");
|
||||||
|
else if (obj instanceof List<?>) lines.addAll((List<String>) obj);
|
||||||
|
else lines.add(obj.toString());
|
||||||
|
|
||||||
// Does message include placeholders
|
// Does message include placeholders
|
||||||
boolean hasPlaceholders = false;
|
boolean hasPlaceholders = false;
|
||||||
|
@ -207,6 +207,9 @@ public class ConfigManager {
|
|||||||
return messages.getStringList(key);
|
return messages.getStringList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The original object, which should be cloned afterwards!!
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Object getMessageObject(String key) {
|
public Object getMessageObject(String key) {
|
||||||
return messages.get(key);
|
return messages.get(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user