Run code before player gets sent to other server #1094
Labels
s: needs triage
Issue waiting for triage
t: feature request
A request of a feature someone wants to see in a future release.
Describe the new feature
It'd be cool to have a way to run code before a player gets sent to other service, like an event that ran on the players current service and blocked the player from being transported to the other instance until the listeners finished running, possibly not on the main thread because it would be used to save stuff to the database.
Why do you need this feature?
I'm coding a server that needs to synchronize player's inventories between all the instances and the way that I do now (described on the Alternatives section) leads to basically inventory wipes. This feature would minimize data inconsistency because the system wouldn't rely on latency and lag.
Alternatives
The way it's done now is very sketchy, I save the players inventory on the quit event and on the join event I need to make a delayed task to load it from the database since the player quit event on instance 1 is called sometimes after the join event on instance 2, this sums with the latency added from the inventory serialization code and the database update code and results in data loss. It's also required to cancel a bunch of events if the player's inventory is not saved/loaded, this could lead to item duplication and other issues that this feature would prevent.
Other
This could be a simple platform-based event (e.g: bukkit events) or a channel message query.
called before these lines:
player.connect(serverInfo, Reason.PLUGIN);
I can do a PR implementing this, I just need to know your opinion on how it should be implemented 😄
Issue uniqueness
The text was updated successfully, but these errors were encountered: