javascript


SUBMITTED BY: Guest

DATE: Dec. 14, 2013, 12:20 p.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 1268

  1. package ru.steelcrafting.mc.ace.Core.commands;
  2. import org.bukkit.ChatColor;
  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandExecutor;
  5. import org.bukkit.command.CommandSender;
  6. public class Say implements CommandExecutor {
  7. public Say() {
  8. }
  9. @Override
  10. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  11. if (!sender.hasPermission("core.cmd.say")) {
  12. sender.sendMessage("Unknown commands. Type \"help\" for help.");
  13. return true;
  14. }
  15. if (cmd.getName().equalsIgnoreCase("say")) {
  16. if (args.length == 0) {
  17. String prefix = ChatColor.WHITE + "[" + ChatColor.RED + "Core" + ChatColor.GREEN + "+" + ChatColor.WHITE + "]: ";
  18. sender.sendMessage(prefix + ChatColor.RED + "Используй: /say <сообщение>");
  19. return true;
  20. }
  21. if (args.length >= 1) {
  22. StringBuilder sb = new StringBuilder();
  23. for (String arg: args) {
  24. sb.append(arg);
  25. }
  26. String message = sb.toString();
  27. String say = ChatColor.WHITE + "[" + ChatColor.LIGHT_PURPLE + "Милая консолька школоло-сервера" + ChatColor.WHITE + "]: ";
  28. Command.broadcastCommandMessage(sender, say + message);
  29. }
  30. }
  31. return false;
  32. }
  33. }

comments powered by Disqus