Many of my plugins will require a SQL database to work. One thing that bugs me is that many of them have to store similar data or even the same.
Examples: A table that stores an INT primary key, player uuid and player name (same for world), the last login date and the first join date.
I usually use the INT primary key to reference a player (or any other object) in another table, so I will need that table (INT if <–> UUID) for all plugins storing data related to players
Let’s say I have a block logging plugin, a server mail plugin and a plot plugin. They could use the same player table.
It would be great to have a library/plugin that creates and manages these tables for other plugins. Instead of adding new columns to these standard tables, plugins can create their own tables to save their data, but use the INT key of the standard table to reference the player/world/etc.
The library would only create a standard table if at least one plugin requests it (or the admin in a config file), and only create the columns the plugin needs.
Ideas for tables:
Player
- INT primary key
- UUID
- last known username (only if requested, lib tracks username changes)
- first join date (only if requested)
- last login date (only if requested)
- world when last logged out (only if requested)
World
- INT primary key
- UUID
- last known name (only if requested, tracks changes)
- spawn point (only if requested)
The library listens for player and world events and updates the tables automatically, so plugin developers can concentrate on the unique features of their plugins.
There could also be standard tables for blocks, entities and any other game object.
What do you think?