Sueta
FI

Fix Team Chat

1.0

Re-adds the vanilla formatting for scoreboard teams.

·Plugin

A long-lasting issue with Bukkit is that the chat is reset after vanilla to add compatibility for plugins. This sounds fine, but the issue comes into play when you want to use the Vanilla Scoreboard Teams (now just known as Teams). Bukkit completely removes prefixes, colors, and suffixes for these teams. That's stupid!

So, to fix this issue, I've made this plugin. This plugin re-adds the vanilla formatting for scoreboard teams.

Due to how this plugin works, this will not work with any other chat formatting plugin. It resets your displayName and adds it just like how vanilla should be.

It's extremely lightweight (it's 10 lines of code), so it shouldn't bog down the server performance whatsoever. In fact, it's so lightweight, I'll post the source code right here!

Source Code
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
    if (event.getPlayer() != null) {
        Player player = event.getPlayer();
        player.setDisplayName(player.getName());
        Team team = player.getScoreboard().getEntryTeam(player.getName());
        if (team != null) {
            String format = "<" + team.getPrefix();
            format += team.getColor() + "%s";
            format += ChatColor.RESET + team.getSuffix();
            format += ChatColor.RESET + "> %s";
            event.setFormat(format);
        }
    }
}

Similar projects

Plugin →