Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glowing changes the players nametag #10

Closed
Nuckerr opened this issue Sep 5, 2023 · 3 comments
Closed

Glowing changes the players nametag #10

Nuckerr opened this issue Sep 5, 2023 · 3 comments

Comments

@Nuckerr
Copy link

Nuckerr commented Sep 5, 2023

When I set a glow, it changes the player's nametag. How can I avoid this?

@SkytAsul
Copy link
Owner

SkytAsul commented Sep 5, 2023

Can you show me an example?

@Nuckerr
Copy link
Author

Nuckerr commented Sep 5, 2023

https://imgur.com/0jmbDlc

The code looks like this:

glow.clearGlowing(player)
        team.players
            .filter { it.uniqueId != player.uniqueId }
            .filter { it.isOnline }
            .map { it.player!! }
            .filter { it.gameMode != GameMode.SPECTATOR }
            .forEach {
                val color = getColorTeamAsInt(getTeamId(team)!!)
                val textColor = TextColor.color(color)
                glow.setGlowing(it, player, NamedTextColor.nearestTo(textColor).toChatColor())
                glow.setGlowing(player, it, NamedTextColor.nearestTo(textColor).toChatColor())
            }

fun GlowingEntities.clearGlowing(entity: Entity) {
    Bukkit.getOnlinePlayers().forEach {
        unsetGlowing(entity, it)
        if(entity is Player) unsetGlowing(it, entity);
    }
}

@SkytAsul
Copy link
Owner

SkytAsul commented Sep 6, 2023

Ah yeah it's because GlowingEntities change the team to change the color (related to #5 and #9).
To avoid that, set the "color" parameter of the "setGlowing" method to null: the player will now glow with its team color.

@SkytAsul SkytAsul closed this as completed Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants