NewEdenMC / PlayTimer

A plugin designed for use on New Eden server to auto promote people to higher ranks.
http://neweden.co/
MIT License
0 stars 0 forks source link

Multiple data storage #6

Open AaronMcHale opened 9 years ago

AaronMcHale commented 9 years ago

Support for multiple types of data storage, either YAML or MySQL.

For YAML move the current data out of the config.yml into a separate .yml file. For MySQL provide options in the config to connect to the server, along with the option to use MySQL instead of YAML (YAML being the default storage type)

A possible implementation of this would be to have a separate data storage class that takes in data and processes it, writing and reading to and from the appropriate data storage.

drisc commented 8 years ago

Data storage will be handled via SQLite-only. May expand to MySQL in the future.

AaronMcHale commented 7 years ago

MySQL Support needs to be cross-server compatible, this could be: when player logs in and play time is last updated store their UUID and current timestamp in a HashMap, then when play time is updated or player quit even is raised (this is raised for player switching servers as well) get the number of seconds between the current time and the time stored in the HashMap, then update the database and perform the addition in the query itself UPDATE table SET playtime = playtime + ? WHERE .... If player logged out then just remove them from the HashMap, if the time is simply being updated then store the current timestamp captured earlier in the HashMap