nulli0n / GamePoints-spigot

GNU General Public License v3.0
2 stars 7 forks source link

Balance sync between server's (MySQL) #2

Open Hutch79 opened 2 years ago

Hutch79 commented 2 years ago

It seems that the syncing between paper servers in the same bungee over a MySQL Database is very slow. If I add Gamepoints to a User on server1, server2 needs a couple of minutes to realize that and refresh the balance and baltop.

Is this only the balance and baltop command and the shop always gets the newest data from the database, or is the shop also impacted by this?

My problem is, I use this plugin as a server wide currency and shop. Therefore, if a player buys something on server1 and joins server2, it might be possible that he buys two items for the price of one.

If the Shop is not impacted, basically everything is fine for me. Otherwise, I would be really thankful for a fix, because the plugin is really great for my use case!

A possible solution could maybe be pluginmsg where the plugin gets notified "hey, please update the Database" on Shop purchases or if someone gets gamepoints.

nulli0n commented 2 years ago

There will be added an option to set the auto-sync interval.

Hutch79 commented 2 years ago

Ok, thanks!

One question remaining. Does the auto-sync first check if something is different and then pull the data? If I set this to 5 seconds, for example, to prevent multiple purchases with the same money, I assume that it could be quit laggy.

Maybe for the future, something like pluginmsg could be nice. So if on one server the balance of a player chances, the server sends an info to the other servers "hey, please update".

nulli0n commented 2 years ago

Synchronization will be done async, so it will not lag. Plugin Message is not ideal too, it will not work when there is 0 players on the server.

Hutch79 commented 2 years ago

Ok, if it's async it's nice!

If none is online, there also is no chance for anybody to buy something, so i don't see the problem with pluginmsg

nulli0n commented 2 years ago

If you give points on a Lobby server with 0 online, while that player is playing on other server, it won't work. And this also requires the plugin to be installed on BungeeCord, so it's not that perfect.