||Ruins and Inventory issues||Dec 23, 2016|
I've recently been doing some work on our ruins server, by the way of rewriting portions of the plugins that run the ruins experience.
Primarily our Ruins Plugin and Inventory plugin.
However in doing so, as with any plugin there's some bugs.
Although the code currently is 100x better than the previous code, it's less crash prone, easier to work with and generally more reliable. There are some bugs that cause the plugins to function incorrectly on occasion.
For the ruins plugin loot wasn't being put into chests.
This turned out to be one of two things. WorldEdit was outdated and some changes in 1.11 seem to have broken our method of putting loot into ruins (More info below) this was fixed by updating WorldEdit. This was hard to track down due to there being a total lack of errors. Secondly when loot was placed in chests the sign on the front of the chest remained. This also has been fixed.
Our ruins plugin uses chests placed throughout the schematic. On the front of the chest is a sign that tells our plugin what loot belongs in that chest. When the schematic is spawned in (Using WorldEdit) our plugins process each chest and sign. Between 1.10 (Or below) and 1.11 a change has been made that caused WorldEdit to spawn empty signs. As a result our plugins simply don't recognize the chests/signs and ignores them. Thus not putting loot into the chests.
I've completely rewritten this plugin from the ground up to improve how it handles inventories.
An issue we face is when a player switches server they join the 2nd server before leaving the first one.
This makes traditional means of saving inventories impossible. To avoid this issue we added a 2 second delay to loading an inventory. Giving the ruins server time to save the inventory before towny loads it and vice-versa. However how we handled it allowed players to dupe items easily and if the server they were switching from lagged they would lose their inventory.
Rewriting the plugin to lock an inventory from being touched until it was saved and then waiting until it was unlocked would solve the issue of ruins lag as well as allowing us to avoid dupe glitches.
How did players dupe?
Previously your inventory is still intact when you connect. It is then reloaded with the correct inventory.
This allowed players to throw items out of their inventory onto the ground, the inventory reloads after the 2 second delay and then they simply pick the items up. A silly oversight on my part.
How did I solve it?
Now that inventories wait for the inventory to be fully saved by the previous server it allows us to do the following:
Save a copy of the players inventory in memory (The last items they had) then clear their inventory.
This is all done before the player even starts to spawn on the server. Completely disabling the ability to throw items on the ground and pick them back up again.
The server then makes 10 attempts to load the players inventory. Every half second. If the server fails to do this it restores their inventory out of memory.
But there's a catch.
There appears to be a bug that I'm currently having difficult tracking down where for some reason a players inventory remains empty even after being reloaded. I've been through my code several times and can't track this down.
For now I really urge people to do the following:
With your co-operation we can all squish some bugs!
I'd like to hand a shoutout to R3mBot for being a guinea pig for me and repeatedly join and quit ruins to attempt to cause the bug for me to track down. She's helped by reporting quite a few issues lately to me related to Ruins and the inventory sync bug.
|0 Replies • 112 Views|