Long name

Discussion in 'Plugin Development' started by Pandastyl, Jul 5, 2014.

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


    I was wondering if theres any way to fix, when player has a long name (16 chars) the name will be all white in the Tab list.
    Im using cTabList for the colors but i was thinking if there is an easy fix for this.
    I already commented on cTablist about this but still, Wondering if theres easier fix for this :p

  2. Offline


    I don't think that there can be a fix for this, because, as far as I know, the minecraft client allows a maximum of 16 chars per cell in the tablist. Because a color code has to chars, the name would be 18 chars long, which wouldn't work. That can't be fixed by the devs of cTablist. If you're using an API, you could use the this:
    1. String name = "whatever";
    2. ChatColor color = ChatColor.BLUE; //Whatever
    3. if (name.length() >= 15) {
    4. int toMany = (color.toString() + name).length() - 16;
    5. name = name.subString(0, name.length()-toMany);
    6. name = color + name;
    7. }
    8. WhatEverYouAPIIs.setCell(x, y, name); //Might be slightly different

    If you want to print the name "thisnameisxxlong" (length: 16) in red, the code would place "thisnameisxxlo" (length: looks like 14, but it's 16).
  3. Offline


    You can add a prefix using scoreboards and teams, that's how some servers have
    [D] thisnameisxxlong
    But instead of [D] you can simply add ChatColor.RED
  4. Offline


    Pandastyl simolus3 hacky way around it would be using the team prefix (this would result into a coloured nametag as well)
  5. Offline


    Konkz Scoreboard/team prefix it is then, ChatColor.RED would still add 2 chars.
Thread Status:
Not open for further replies.

Share This Page