nsporillo / GlobalWarming

Server side global warming mechanics in Minecraft!
GNU Lesser General Public License v3.0
473 stars 46 forks source link

Adding offline player support and other updates #24

Closed mclifford9 closed 5 years ago

mclifford9 commented 5 years ago

Each player's world ID is stored in the database (and updated as players are created or change worlds). This improves record management for sapling growth, furnace smelting and bounty events for offline players. Further, changed all database tables to use world UUID instead of name. Simplified getting a player's "associated" world. Conflict resolution added: when a furnace or tree is placed in a location that already has a record, delete the old record and replace it with the current record. This solves an issue where, for example, a tree is burned down and a player replants another sapling at that location. Previously, its replacement was ignored. The same delete logic is used for destroyed sapling / furnace blocks. This means that over time, contribution and reduction records may have invalid (unknown) valid furnace / tree records, but that should be OK. It seems reasonable not to track blocks that no longer exist. Tree and furnace objects and tables were generalized in terms of managing in-memory lookup tables (TrackedBlockTable / TrackedBlock). BugFix: during the enable event on a clean machine, the schemas need to be created before the first SELECT statements are executed. NOTE: old servers need to drop the old database tables and delete the GlobalWarming directory in /server/plugins prior to running this update in order to rebuild the schema, config and script files.