I have: Code: event.setLine(3, "§e" + players + "§0/§e" + maxplayers + " §0Online"); But it thinks the "§e" (colour codes) are characters, so it only displays: "0/12 On" Anyone know a way to fix this?
Use Code:java event.setLine(3, ChatColor.translateAlternateColorCodes('&',"&e" + players + "&0/&e" + maxplayers + " &0Online");
xTrollxDudex There is no error, is just still shows only: "0/12 On" not "0/12 Online" like it should. Edit: What's ChatColor enumeration?
Elimnator The chat color enumeration is the long verion of "enum", just do ChatColor.BLACK + "text here" + ChatColor.RED + "more text". All the chat colors can be found on the javadocs.
Oh, I think I know what you mean now. You cant stop chat chars from being seen as a char. So ChatColor.BLACK or my method, or your §0 will still take up space, hence why you cant fit your line on.
Tomskied xTrollxDudex I did this and it still wont show the maxplayers variable. Code: event.setLine(3, "Players: " + ChatColor.YELLOW + players + ChatColor.BLACK + "/" + ChatColor.YELLOW + maxplayers);
A line of text on a sign is 15 chars max long. "Players: " 9 chars. ChatColor.YELLOW 2 chars, players probably 1-2 chars, ChatColor.BLACK 2 chars, "/" 1 char, ChatColor.YELLOW 2 chars, maxplayers, probably 1-2 chars. Even if the max players and players is lower than 10, thats still 18 chars. Too many for one line.
Tomskied I thought ChatColor.YELLOW didn't count as characters. How do I change the colour but not use up characters?
if i'm not mistaken you need to use "//" in the string not "/" to get a single "/" charactor after compiling
Well I did: Code: event.setLine(3, "Players: " + ChatColor.YELLOW + players + "/" + maxplayers); And it worked, so you must be mistaken.