1
0

dont remove from scoreboard when leaving

This commit is contained in:
Lee
2024-03-20 18:09:05 +00:00
parent 6d376a26f6
commit 640a4b6392

View File

@ -68,7 +68,7 @@ public class ColorManager implements Listener {
private NamedTextColor getColorForPlayer(Player player) {
return chatColors.computeIfAbsent(player, (e) -> {
int hash = HashCommon.mix(player.getUniqueId().hashCode());
int index = HashCommon.mix(hash) & 0xF;
int index = HashCommon.mix(hash) & (validColors.size() - 1);
return validColors.get(index);
});
@ -102,15 +102,6 @@ public class ColorManager implements Listener {
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = scoreboard.getTeam(getColorForPlayer(player).toString().toLowerCase());
if (team == null) {
return;
}
if (!team.getEntries().contains(player.getName())) {
return;
}
team.removeEntry(player.getName());
chatColors.remove(player);
}