All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.carm.lib.mineconfiguration.bungee.data.TextConfig Maven / Gradle / Ivy

There is a newer version: 2.9.3
Show newest version
package cc.carm.lib.mineconfiguration.bungee.data;

import cc.carm.lib.mineconfiguration.common.data.AbstractText;
import net.md_5.bungee.api.CommandSender;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class TextConfig extends AbstractText {

    public TextConfig(@NotNull String message) {
        super(CommandSender.class, message);
    }

    @Contract("!null,-> !null")
    public static @Nullable TextConfig of(@Nullable String message) {
        if (message == null) return null;
        else return new TextConfig(message);
    }

    public static @NotNull List of(@Nullable List messages) {
        if (messages == null || messages.isEmpty()) return new ArrayList<>();
        else return messages.stream().map(TextConfig::of).collect(Collectors.toList());
    }

    public static @NotNull List of(@NotNull String... messages) {
        return of(Arrays.asList(messages));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy