Using the vault as support for prefix suffix?

Discussion in 'Bukkit Help' started by LenonMojang, Dec 26, 2013.

  1. Offline

    LenonMojang

    Using the vault as support for prefix suffix?
    'm new to java and I want to solve this question
    this class

    1. package net.MoreCraft.MoreChat.Chat;
    2. import net.MoreCraft.MoreChat.MoreChat;
    3. import net.MoreCraft.MoreChat.Settings.Config;
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandExecutor;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. public class CommandChatGlobal implements CommandExecutor {
    11. public CommandChatGlobal(MoreChat moreChat) {
    12. }
    13. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    14. if (!(sender instanceof Player)) {
    15. sender.sendMessage("Esse comando pode ser usado somente no jogo!");
    16. return true;
    17. }
    18. Player player = (Player) sender;
    19. if (cmd.getName().equalsIgnoreCase("global")) {
    20. if (!player.hasPermission("MoreCraft.MoreChat.User.Chat.Global")) {
    21. Config.noPermissionMessage(player);
    22. return true;
    23. }
    24. try {
    25. StringBuilder x = new StringBuilder();
    26. int i;
    27. for (i = 0; i < args.length; i++) {
    28. x.append(args + " ");
    29. }
    30. if (args.length > 0) {
    31. Bukkit.getServer().broadcastMessage(ChatColor.GRAY + "【" + ChatColor.GREEN + ChatColor.BOLD + "G" + ChatColor.GRAY + "】"+ ChatColor.RESET + player.getDisplayName() + ": " + ChatColor.GRAY + x.toString().trim());
    32. } else {
    33. player.sendMessage(ChatColor.RED + "Erro!");
    34. player.sendMessage(ChatColor.RED + "Uso: /" + commandLabel + " <mensagem>");
    35. }
    36. } catch (Exception e) {
    37. player.sendMessage(ChatColor.RED + "Erro!");
    38. player.sendMessage(ChatColor.RED + "Uso: /" + commandLabel + " <mensagem>");
    39. }
    40. } else if (args.length < 1) {
    41. player.sendMessage(ChatColor.RED + "Erro!");
    42. player.sendMessage(ChatColor.RED + "Uso: /" + commandLabel + " <mensagem>");
    43. }
    44. return true;
    45. }
    46. }
     

Share This Page