Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
fix: commands on pre-1.19 clients being consumed
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Apr 2, 2024
1 parent c9b0ea6 commit 4502098
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void removePlayer(@NotNull Player player) {
@RequiredArgsConstructor
public static class PlayerChannelHandler extends ChannelDuplexHandler implements VelocityChatListener {

private static final String LEGACY_COMMAND_PREFIX = "/";
private final VelocityHuskChat plugin;
private final Player player;

Expand All @@ -125,6 +126,9 @@ private Optional<String> extractChatMessage(Object msg) {
return Optional.of(keyed.getMessage());
} else if (msg instanceof final LegacyChatPacket legacy) {
// Handle legacy chat (pre-1.19.1)
if (legacy.getMessage().startsWith(LEGACY_COMMAND_PREFIX)) {
return Optional.empty();
}
return Optional.of(legacy.getMessage());
}
return Optional.empty();
Expand Down

0 comments on commit 4502098

Please sign in to comment.