Skip to content

Instantly share code, notes, and snippets.

@davidjpfeiffer
Last active August 14, 2024 00:53
Show Gist options
  • Save davidjpfeiffer/fd5ed83f465f42100368ee53d8fe67d3 to your computer and use it in GitHub Desktop.
Save davidjpfeiffer/fd5ed83f465f42100368ee53d8fe67d3 to your computer and use it in GitHub Desktop.
How to change a Minecraft player's glow color using the Bukkit / Spigot / Paper APIs

The player.setGlowing(true) method can be used to enable / disable the glowing effect for any player

The default glow color is white, but this color can be changed using Scoreboard Teams

First, obtain a reference to the main scoreboard using Bukkit.getScoreboardManager().getMainScoreboard()

You must set this as the player's scoreboard using player.setScoreboard(mainScoreboard)

Next, use the main scoreboard to create a team using mainScoreboard.registerNewTeam(ChatColor.BLUE + "team")

Now that the team has been created, you must set the team color using team.setColor(ChatColor.BLUE)

Finally, add the player to the team using team.addEntry(player.getName())

Note: In this example we created a new team on the main scoreboard. This should only be done once. You can use mainScoreboard.getTeam(teamName) to obtain a reference to an existing team if necessary. Note that the team name must begin with the name of the team color for the glowing effect to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment