Can i fire a Sponge event (not custom)?

Hi,

I porting a chat plugin from bukkit/spigot and in this plugin i need to launch the event “MessageEvent” with my plugin, to allow other plugins to listem to messages modified by my plugin.

Is you is asking why i not listen the MessageEvent and change from that event?

Its because i allow my players to send messages using commandg like /g hello, and i want this messages (sent by commands) to be like real chat messages and pass for all plugins listem to this event like a normal message.

Is this possible? if not, can be?

There is the SpongeEventFactory:

Sponge.getEventManager().post(
    SpongeEventFactory.createMessageChannelEventChat(
        cause, 
        originalChannel, 
        channel, 
        formatter, 
        rawMessage, 
        messageCancelled
    )
);
1 Like

Yes, I do it for /sudo - this is what my code looks like.

1 Like

Thanks for the methods and for the example :slight_smile:

One more think: How to set the priority of a event like bukkit?

Events in Sponge don’t have priorities (I don’t think they did in Bukkit either), Instead, event handlers have priorities, which determines the order in which they receive the event.