Closed Setloth closed 2 years ago
If you are trying to sort tablist via NameTagApi, you must rename every group differently to every player to make it sorting & working.
NameTag name (team name) can be long 16 symbols.
You must set name to [your group name or id - ~ 4 symbols][part of player's name - ~5 first symbols][part of player's uuid - ~remaining symbols]
Example: 0001Straidb647-4
Example of usage: https://github.com/TheDevTec/SCR/blob/remaster/src/me/devtec/scr/functions/Tablist.java
I do that using the NameTagApi#setName
though right, just using a group name, players name, etc
I am still a bit confused, but basically i just do a 0000
+ name
+ uuid
for the .setName()
?
and for the leading number, is higher higher priority or lower higher priority (just clarifying cause i think minecraft's internal is 0 = highest or smth i dont really remember
I am also not 100% sure of the usage from the url you sent, could you clarify basic usage of the method
Like if I did:
String formatIndex = String.format("%04d", index);
tag.setName(formatIndex+player.getName().substring(0,4)+player.getUniqueId().toString().substring(0,4));
Where index
is the index of the player's group in a list of groups I have predefined for order, and player
is just the target player
Would that work?
Tablist is sorted basically by name, if you want to have player upper in the tablist, set priority to lower.
You can create Map<String, String> to make this easier.
static Map<String, String> priorityGroups = new HashMap<>();
static {
//0001, 0002, 0003, 0004, 0005, 0006
loadGroups(Arrays.asList("owner", "admin", "builder", "helper", "vip", "default");
}
public static void loadGroups(List<String> groups) {
int length = (""+groups.size()).length()+1;
for(int i = 0; i < groups.size(); ++i) {
String s = "";
int limit = length-(i+"").length();
for(int d = 0; d < limit; ++d)
s+="0";
s+=i;
priorityGroups.put(groups.get(i), s);
}
}
NameTagAPI tag = ...
tag.setName(priorityGroups.get("default") + name + uuid);
Alrighty, thanks!
If problem is solved, close issue. And if you are looking for faster support, report bugs on our discord. https://discord.com/invite/8YtfC234dA
If problem is solved, close issue.
And if you are looking for faster support, report bugs on our discord.
oh sorry i thought i closed it with my last comment, i must of mis clicked
Does
From here Control the Tablist sorting? because I attempted to set the name to something like:
0name
, and another to1name
to see if that would change the sorting, which it didn'tI could 100% possibly be just using it wrong, but I wanted to get a clarification on its usage, and if I am using it correctly and it just isn't working properly, then submit this as a bug report for it.
But any info would be nice
And, if this isn't inherently control the sorting, what would be the steps in order to produce a sorted tablist?