Are you lazy to recode everything every time you make a plugin? If yes, this plugin is for you.
The API provides some cool functionnalities which are listed below.
You don't have to store UUIDs or convert current names. Just add the timestamp at which the player was and you can get the UUID with the API. If the UUID can't be found, the plugin queries Mojang and return the UUID. When a player connects and he's not in the database, the plugin add his name, the corresponding UUID and the current timestamp to the database.
fr.minepod.core.Core MPCore = (fr.minepod.core.Core) plugin.getServer().getPluginManager().getPlugin("MPCore"); Date date = new Date(); String playerName = ""; UUID uuid = MPCore.getUUIDsManager().getUUIDFromUUIDPlayerClassByDate(playerName, date);
With the DataUpdater you don't have to check with heavy conditions for updating. Just pass the current version, the expected version and fill the methods to run to update between each versions.
public boolean updateData() throws Exception { if(new DataUpdater(getServer()) { @SuppressWarnings("unused") public String fromVersion1x0x0() { // Do updating code (1.0.0 -> 1.1.0) here return "1x1x0"; } @SuppressWarnings("unused") public String fromVersion1x1x0() { // Do updating code (1.1.0 -> 1.2.0) here return "1x2x0"; } }.execute(data.getString("config.version"), "1.2.0")) { // Set the configuration version to the new version, in this case 1.2.0 data.set("config.version", "1.2.0"); return true; } else { // Something is wrong, catch this to prevent errors and configuration overwrite return false; } }
The javadoc is available in the source code repository inside each class. https:d.minepod.fr/minepod/mpcore/blob/master/Core/src/fr/minepod/core/Core.java
The source code can be found at https:d.minepod.fr/minepod/mpcore/tree/master.