Store Game Data in a Database
That’s great for configuration data, but not so useful for game data—data that changes as the game plays on, like player scores and status, inventory, health, and things like that. We need to access data a little differently, and be able to write game data from the plugin as well as read it.
There is one important limitation to storage approaches, however. You can only save and load simple types: strings, integers, floating point, and boolean values. You can’t save Minecraft-specific objects—things like Location or Player. You can save a player’s name as a String, and save a Location as a set of double x-, y-, and z-coordinates, but you can’t save the Minecraft objects directly.
That turns out to be a reasonable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access