-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Milestone
Description
Currently, the order in which e.g. plot resetting or merging happens is:
- Waiting for the successful modification of the data in the database
- Submitting an
AsyncTaskto the pool - Updating the chunks after it finishes
This is problematic since the database got already updated when the terrain modifications are not even calculated. This could be exploited if players would intentionally wait for server reboots. (Some servers restart their servers during the night to perform backups, etc.) If they would then merge two plots at the correct time, the server would restart after the database was queried, but before theAsyncTaskfinished running or updating the chunks. That way, the normal road would still be on the plot for the players to modify as they please, which is especially problematic if the road contains valuable or normally unobtainable blocks.
This could be fixed by changing the above-mentioned order:
- Submitting an
AsyncTaskto the pool - When the task is finished, waiting for the successful modification of the data in the database
- Updating the chunks
This would not entirely remove the possibility of the above-mentioned issue, but strongly reduce the time window in which this could be done.
But this is currently not easily implemented due to the design of theChunkModifyingAsyncTaskclass, since it updates the chunks in the world before any callbacks are called.
Although especially plot merging takes a comparably long time due to its many queries, even on my test server merging only takes around 2 seconds.
So it is highly unlikely that this will actually happen to someone.