Skip to content

Improve chat message handling: use color for display, plain for detection (compatibility with chat plugins)#32

Open
OtakuSweett wants to merge 1 commit intosulphi-fox:masterfrom
OtakuSweett:master
Open

Improve chat message handling: use color for display, plain for detection (compatibility with chat plugins)#32
OtakuSweett wants to merge 1 commit intosulphi-fox:masterfrom
OtakuSweett:master

Conversation

@OtakuSweett
Copy link

This PR improves chat message handling for better compatibility with other chat plugins, especially AxChatGames and similar.

Now, the message used for detection and processing by other plugins/listeners is plain (without color codes), while the message displayed to players keeps the color formatting.

This change ensures that chat games, moderation, logging, and other plugins see the raw message.

Copilot AI review requested due to automatic review settings March 15, 2026 16:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to improve interoperability with other Bukkit/Spigot chat plugins by ensuring AsyncPlayerChatEvent#getMessage() is plain (no color codes) for detection/logging/moderation, while still displaying a colored version to players.

Changes:

  • Strip color codes from the chat event message so downstream listeners see a plain message.
  • Compute a colored version for player display and inject it into the chat output via event.setFormat(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +135 to +136
coloredMessage = GeneralUtils.colourise(message);
} else {
Comment on lines +152 to +153
// Format: <name> colored_message
event.setFormat("<%1$s> " + coloredMessage);
}
}
// Format: <name> colored_message
event.setFormat("<%1$s> " + coloredMessage);
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

Successfully merging this pull request may close these issues.

2 participants