Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run code before player gets sent to other server #1094

Open
1 task done
devwckd opened this issue Jan 23, 2023 · 0 comments
Open
1 task done

Run code before player gets sent to other server #1094

devwckd opened this issue Jan 23, 2023 · 0 comments
Labels
s: needs triage Issue waiting for triage t: feature request A request of a feature someone wants to see in a future release.

Comments

@devwckd
Copy link

devwckd commented Jan 23, 2023

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

  • Yes, this issue is unique. There are no similar issues.
@devwckd devwckd added s: needs triage Issue waiting for triage t: feature request A request of a feature someone wants to see in a future release. labels Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: needs triage Issue waiting for triage t: feature request A request of a feature someone wants to see in a future release.
Projects
None yet
Development

No branches or pull requests

1 participant