-
Notifications
You must be signed in to change notification settings - Fork 0
Issue with Chat Example #4
Copy link
Copy link
Open
Description
The chat event seems to be triggered twice.
Heres the plugins code:
import { type PlayerChatEvent, EventListener, Colors } from "@hytalejs.com/core";
export class PlayerChatHandler {
@EventListener("PlayerChatEvent")
onPlayerChat(event: PlayerChatEvent): void {
const sender = event.getSender();
const content = event.getContent();
logger.info("[CHAT] " + sender.getUsername() + ": " + content);
const playerName = Message.raw(sender.getUsername()).color(Colors.WHITE).bold(true);
const separator = Message.raw(" > ").color(Colors.DARK_GRAY);
const messageText = Message.raw(content).color(Colors.LIGHT_GRAY);
const formattedMessage = Message.empty().insert(playerName).insert(separator).insert(messageText);
event.setCancelled(true);
const targets = event.getTargets();
for (let i = 0; i < targets.length; i++) {
targets[i].sendMessage(formattedMessage);
}
}
}
Not sure if its an issue with my hytale server tho, as all messages from hytalejs seem to be sent twice.
But yeah its twice in the console too

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels