ScoreBoard prefix color

Discussion in 'Plugin Development' started by Altexon, May 8, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    How can i give color for my prefix?

    /sbman <team> &e«&cAdmin&e» -> now i see this in tab: &e«&cAdmin&e» Steve
    I would like to see: «Admin» Steve
    Thank you for your help.

    package eu.altexon.sbman;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    public class sbc implements CommandExecutor {
        String pre = ChatColor.DARK_GRAY+"["+ChatColor.RED+"SBMan"+ChatColor.DARK_GRAY+"] ";
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            Player p = (Player) sender;
            if (label.equalsIgnoreCase("sbman")){
                if(p instanceof Player){
                    if (args.length == 0){
                        p.sendMessage(pre+ChatColor.RED+"Használat: /sbman <team> <prefix>");
                        return false;
                    p.sendMessage(pre+ChatColor.AQUA+"Prefix sikeresen létrehozva a(z) "+ChatColor.RED+args[0]+ChatColor.AQUA+" nevű ScoreBoardhoz");
                    return true;
                    p.sendMessage(pre+ChatColor.RED+"Ehhez nincs jogod!");
            return false;
  2. Offline

    I Al Istannen

  3. Offline


    Last edited: May 8, 2016
  4. Offline


    That method returns a string that has all the color codes (i.e '&-') transformed into Chatcolors. Whenever you need to get a new string which has chatcolors in it, use this method (I.e when you are sending messages).
  5. Offline


    Please, can You give one code for me?
  6. Offline


    Prefixes and Suffixes have to be 16 characters as well, if one of them is more than 16 you crash the client, however you can have up to 48 characters with the three things
    I Al Istannen likes this.
  7. Offline


    This is just one line you have to add. Just use that method, replace 'char' with the character you want to replace (I.E "&") and replace "String" with the message you want to add chatcolors to.
Thread Status:
Not open for further replies.

Share This Page