Closed archer-321 closed 2 years ago
You still need to keep
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u());
at the top, otherwise the event could be fired asynchronously and more than once (cause the handler is called again trying to be run on the main thread).
Was moving the lines necessary for it to work?
Oops, the line should be back at the top (even though technically, this resets the player's idle timer even if they're dead; however, I don't think this behaviour change is a problem).
Was moving the lines necessary for it to work?
The event is to fire before any of the vanilla server's checks to allow for "invalid sign updates" to be handled with a custom event. For example, the instanceof TileEntitySign
check would cancel any sign updates for client-side only signs.
This PR adds an event that's called before a sign change is processed. The event is handy for sign GUIs and other (non-vanilla) sign changes that rely on "invalid" sign updates to get input from a player.
From testing, the code seems to work just fine. However, I moved some lines in front of the vanilla "sanity checks". When reviewing this PR, this should be double-checked.