PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
10.06k stars 2.34k forks source link

sender.sendMessage not working within async code #7417

Closed James-E-A closed 2 years ago

James-E-A commented 2 years ago

Expected behavior

$ mcrcon
Logged in. Type 'quit' or 'exit' to quit.
>fwhitelist add skyridersam
There was an unexpected error.
>

Observed/Actual behavior

$ mcrcon
Logged in. Type 'quit' or 'exit' to quit.
>fwhitelist add skyridersam
>

Steps/models to reproduce

  1. Install Geyser and Floodgate (the OOTB configuration suffices)
  2. Find the gamertag of someone who has not yet played Minecraft: Bedrock Edition on any Geyser-based Minecraft server (or, for now, you may select my friend skyridersam for convenience)
  3. Open rcon
  4. Type fwhitelist add skyridersam (or your selected gamertag)
  5. Observe that no error is sent to the console

Plugin and Datapack List

floodgate, Geyser-Spigot

(There are 2 data packs enabled: [vanilla (built-in)], [file/bukkit (world)])

Paper version

git-Paper-177 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT) (Git: 2e99e5e)

Other

Specifically, the issue is that code that calls sender.sendMessage(Message.UNEXPECTED_ERROR), such as this error handler in org.geysermc.floodgate.command.WhiteListCommand§performCommand: this error is sent nowhere that I can tell, though the developer of this code seems to believe that the line itself is correct in-context.

James-E-A commented 2 years ago

This issue is a soft-blocker of https://github.com/GeyserMC/Floodgate/issues/261 -- there are, obviously, workarounds that could be applied at the plugin level (such as sending the informative debug info about the problem via sender rather than to the console log), but fixing the upstream problem (that Message.UNEXPECTED_ERROR isn't working) seems like a better course of action

electronicboy commented 2 years ago

https://github.com/GeyserMC/Floodgate/blob/a8829c6d57979a7c66db4b54cecc60cf991293d7/common/src/main/java/org/geysermc/floodgate/command/WhitelistCommand.java#L130

async, the rcon stuff just executes a command and returns the response, that means that if a command goes off the main thread and tries to send a message, that will be blocked

There is some intent for us to support this (but, plugins will need to explicitly support this) from our side, however last I knew upstream had some talks about it so that kinda stalled us off on that, at this point, not really within our control and there is already stuff tracking this somewhere

Gaming32 commented 2 years ago

Side note: there are also (closed afaik) issues on LuckPerms for this same thing