nsporillo / GlobalWarming

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

Add proper temperature reset command #39

Open nsporillo opened 5 years ago

nsporillo commented 5 years ago

GlobalWarming works by taking the cumulative carbon scores on a per world basis and translating that into a temperature based on the configurable models files.

Right now we support a /gw debug temp <value> command which will manually override the worlds temperature by calculating the score that the desired temperature matches to and setting the worlds score in the database. However, we track a detailed record of player contributions and reductions which are linked to furnace and tree tables. This means that player scores remain what they are, so scoreboards and GW commands will show scores which do not add up to the current global carbon score.

Ideally we'd have this temperature reset command not destroy the referential integrity of the database. We can probably assume that if one wishes to reset the temperature, then they are okay with erasing all of the player contributions and reductions. The typical suggested workaround for when server owners want to reset their world is to:

  1. Shutdown the server
  2. Manually delete the H2 database files
  3. Restart the server

However if the owner is not using H2 and is instead using MySQL.. this is a more involved process. We want this command to simply purge all relevant tables and reload the internal GlobalWarming storage such that it is fully consistent.

tizzymac commented 5 years ago

Hi, can I take this?

nsporillo commented 5 years ago

@tizzymac Sure