Phoenix616 / Snap

Experimental tool to run BungeeCord plugins on Velocity
https://hangar.papermc.io/Phoenix616/Snap
GNU Lesser General Public License v3.0
118 stars 10 forks source link

Better transmit event info such as cancellation statuses #26

Closed A248 closed 2 years ago

A248 commented 2 years ago

A user claimed that BungeeChat, a chat plugin on BungeeCord, continued to broadcast messages despite the chat event's cancellation by a punishment plugin on Velocity.

I found that BungeeChat does respect the cancellation status of the event, but Snap wasn't transmitting the cancellation of the Velocity chat event to the BungeeCord event.

I looked through the forwarding listeners and found a few other cases where it seemed that some event information was left off during the BungeeCord<->Velocity event conversion.

Folas1337 commented 2 years ago

Just wanted to leave a note that it is working for me so far on a snap.jar that @A248 has provided me :) Thanks for merging it so quickly too, looking forward to a release of this soon so more people can enjoy more compatibility.

LooFifteen commented 2 years ago

This PR has caused incompatibility with one of my plugins as it seems to not follow event priorities, is there any way this can be made to not override lower priorities even though the message has not been edited?

A248 commented 2 years ago

This PR maintains correct behavior by corresponding the same information given to BungeeCord back to Velocity. I don't know what the incompatibility you are experiencing is, but you would be better served by describing it.

Note that Snap is currently limited in that priorities can't be mapped perfectly between Velocity and BungeeCord. A Snap listener on Velocity listens at a certain priority and forwards events to BungeeCord. From Velocity's perspective, all modifications from BungeeCord plugins happen at the same priority (specifically, the priority at which the Snap listener is posted). This aspect of Snap's behavior could change if #2 was implemented.

Phoenix616 commented 2 years ago

Yeah i'm not quite sure I understand what exactly the issue is either but if it's really due to the listener order then there will most likely not be a better way around this than implementing the direct registration. (Currently listeners of Bungee plugins running inside Snap will follow the priority related to other Bungee plugins but will all happen on PostOrder.NORMAL in relation to Velocity plugins)

Main issue with direct registration will be that Bungee allows byte values for listener priority while Velocity is limited to its 5 PostOrder Enums.

LooFifteen commented 2 years ago

The issue on my end is that my changes to the chat message are overriden to the default message. For example, my plugin sets the message to Test Message, it would be changed back to <User> Hello World. It is a Velocity plugin.