package ru.steelcrafting.mc.ace.Core.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class Say implements CommandExecutor {
public Say() {
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!sender.hasPermission("core.cmd.say")) {
sender.sendMessage("Unknown commands. Type \"help\" for help.");
return true;
}
if (cmd.getName().equalsIgnoreCase("say")) {
if (args.length == 0) {
String prefix = ChatColor.WHITE + "[" + ChatColor.RED + "Core" + ChatColor.GREEN + "+" + ChatColor.WHITE + "]: ";
sender.sendMessage(prefix + ChatColor.RED + "Используй: /say <сообщение>");
return true;
}
if (args.length >= 1) {
StringBuilder sb = new StringBuilder();
for (String arg: args) {
sb.append(arg);
}
String message = sb.toString();
String say = ChatColor.WHITE + "[" + ChatColor.LIGHT_PURPLE + "Милая консолька школоло-сервера" + ChatColor.WHITE + "]: ";
Command.broadcastCommandMessage(sender, say + message);
}
}
return false;
}
}