Hey guys, so I’m working on a new project that will allow multiple servers to share chats.
I need a way to trigger a a what I believe is a MessageChannelEvent.Chat Event
.
I’ve been looking around but I don’t see a clear way of doing it. The sponge docs do show how to make your own custom events, but That’s not what I want. Unless if I were to extend a Chat Event as a “CustomChatEvent” it would still fire for things that look for the Chat event.
I’m not sure what the best way to go about this is,
I figure I should use Sponge.getEventManager().post()
to put in a new event but when Trying to do so I’d have to override a whole bunch of methods which don’t make sense to override in this context. Am I missing something here.
public void onReceiveProtoBuff(){
Text message = new Text;
MessageChannelEvent.Chat chatEvent = new MessageChannelEvent.Chat() {
@Override
public Text getRawMessage() {
return message;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public void setCancelled(boolean cancel) {
}
@Override
public MessageChannel getOriginalChannel() {
return MessageChannel.TO_ALL;
}
@Override
public Optional<MessageChannel> getChannel() {
return Optional.of(MessageChannel.TO_ALL);
}
@Override
public void setChannel(@Nullable MessageChannel channel) {
}
@Override
public Text getOriginalMessage() {
return null;
}
@Override
public boolean isMessageCancelled() {
return false;
}
@Override
public void setMessageCancelled(boolean cancelled) {
}
@Override
public MessageFormatter getFormatter() {
return null;
}
@Override
public Cause getCause() {
return null;
}
};
Sponge.getEventManager().post(chatEvent);
}