Help

Discussion in 'Spigot Plugin Help' started by liwaa, Jun 24, 2015.

  1. i am generating a config file, but i don't know how to make it support color codes please help!
     
  2. ChatColor.translateAlternateColorCodes('&', String or message)
     
  3. didnt understand the last part
     
  4. aMS for example
    String MSG = getConfig().getString("MSG.EXAMPLE");
    player.sendMessage(ChatColor.translateAlternateColorCodes('&', MSG));

    Config like this:

    MSG:
    Example: '&c&lPlayer is idiot'
     
  5. Code (Text):
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("ip") && sender instanceof Player){
                Player player = (Player) sender;
                String msg = getConfig().getString("IP");
                ChatColor.translateAlternateColorCodes('&', msg);
                player.sendMessage(msg);

    }
            return false;
     
  6. Code (Text):
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("ip") && sender instanceof Player){
                Player player = (Player) sender;
                String msg = getConfig().getString("IP");
                     player.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));

    }
            return false;
     
  7. WORKED finally thank you alot :)
     
  8. Please, don't try to make Spigot plugins without knowing Java and Bukkit API.
    Java > Bukkit API > Develop plugins
     
    • Agree Agree x 1