HelpChat / DeluxeMenus

DeluxeMenus but open source!?
https://wiki.helpch.at/clips-plugins/deluxemenus
MIT License
72 stars 35 forks source link

Investigation - action `[commandevent]` might not work properly anymore #32

Open BlitzOffline opened 7 months ago

BlitzOffline commented 7 months ago

Got a report in discord mentioning that [commandevent] action might not work anymore. The user has mentioned that they have updated both their server and DeluxeMenus. Will try to get hold of old and new versions for both.

Need to investigate this.

Conversation can be followed here.

BlitzOffline commented 2 weeks ago

I was able to replicate the behavior on Paper 1.21.

It seems that the server no longer executes the commands from the PlayerCommandPreprocessEvent event. Not sure we can do anything about this.

For [commandevent] we send a PlayerCommandPreprocessEvent. For [player] we execute Player#chat with a slash appended at the start of the message.

Looking into the CraftBukkit code, it would seem that Player#performCommand runs different code than Player#chat so maybe we can replace the PlayerCommandPreprocessEvent with Player#performCommand?

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java#501