Move the chat renderer to a final class variable instead of initializing it every chat event

This commit is contained in:
spacerocket62 2022-01-27 01:03:48 -08:00
parent 8202021f07
commit 15f0f5fe2d

View File

@ -18,11 +18,12 @@ import org.jetbrains.annotations.NotNull;
public class ChatListener extends PlexListener public class ChatListener extends PlexListener
{ {
private final PlexChatRenderer renderer = new PlexChatRenderer();
@EventHandler @EventHandler
public void onChat(AsyncChatEvent event) public void onChat(AsyncChatEvent event)
{ {
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(event.getPlayer().getUniqueId()); PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(event.getPlayer().getUniqueId());
PlexChatRenderer renderer = new PlexChatRenderer();
if (!plexPlayer.getPrefix().isEmpty()) if (!plexPlayer.getPrefix().isEmpty())
{ {