MPCore

Are you lazy to recode everything every time you make a plugin? If yes, this plugin is for you.

This page is not updated at the moment but the code is, see the source code section for where to find it.

Functionnalities

The API provides some cool functionnalities which are listed below.

  • UUIDs: fetch player UUID by name and timestamp
  • Commands: register and check permissions & arguments
  • DataUpdater: update your configuration automatically and easily
  • Integrations: hook into other plugins with a simple method
  • Localizations: add various languages to your plugin
  • Logger: log things into a logfile
  • Formatted messages: use pre-formatted messages and more
  • Permissions: check permissions with Vault or, if not found, with Bukkit buit-in permissions system
  • Rewards: load rewards (items, commands) from file and give them

UUIDs

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);

DataUpdater

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;
	}
}

Javadoc

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

Source code

The source code can be found at https:d.minepod.fr/minepod/mpcore/tree/master.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files