Gabriel Tofvesson cd14d9388a Initial commit
2021-06-25 16:10:22 +02:00

33 lines
1.1 KiB
Java

package dev.w1zzrd.spigot.wizcompat.command;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.command.CommandSender;
public final class CommandUtils {
private CommandUtils() { throw new UnsupportedOperationException("Functional class"); }
public static boolean assertTrue(final boolean condition, final String message, final CommandSender sender) {
if (!condition) {
final TextComponent errorMessage = new TextComponent(message);
errorMessage.setColor(ChatColor.DARK_RED);
sender.spigot().sendMessage(errorMessage);
}
return !condition;
}
public static BaseComponent errorMessage(final String message) {
final BaseComponent component = new TextComponent(message);
component.setColor(ChatColor.DARK_RED);
return component;
}
public static BaseComponent successMessage(final String message) {
final BaseComponent component = new TextComponent(message);
component.setColor(ChatColor.GREEN);
return component;
}
}