Skip to content

Latest commit

 

History

History
54 lines (44 loc) · 2.17 KB

README.md

File metadata and controls

54 lines (44 loc) · 2.17 KB

PlayerDataStore Build Status

The PlayerDataStore is a small Bukkit plugin and API that offers a simple per-player key-value storage using Redis. It comes with asynchronous and a synchronous methods.

Installing the plugin

Download the latest release from the releases page and put it into your plugin directory. Start the server once and then enter your Redis URL in the config file created at /path/to/server/plugins/PlayerDataStore/config.yml. If your Redis server runs on the same server and listens on the default port, it should look like this:

redisUrl: 'redis://localhost:6379'

Restart the server after changing the config.

Using the API

If you're a plugin developer, you may sometimes need to save additional player data. Maybe you also want to sync it across multiple servers. That's what PlayerDataStore is there for! You may see it as a fancy version of Map<Player, Map<String, String>> and actually, the API is pretty similar.

Complete javadoc can be found here. Here is a small demo snippet to get started:

PlayerDataStoreService service = Bukkit.getServer().getServicesManager()
                                      .getRegistration(PlayerDataStoreService.class).getProvider();
PlayerDataStore store = service.getStore(somePlayer); // either a Player, an OfflinePlayer or a UUID
store.put("foo", "bar");
store.get("foo"); // "bar"
store.clear();
store.get("foo"); // null

Usage with Maven

If you use Maven, you can pull the dependency from our repository.

<repository>
  <id>wertarbyte-repo</id>
  <url>https://nexus.wertarbyte.com/content/groups/public/</url>
</repository>
<dependency>
  <artifactId>playerdatastore-api</artifactId>
  <groupId>de.craften.plugins.playerdatastore</groupId>
  <version>1.0.0</version>
</dependency>

License

PlayerDataStore is licensed under the MIT license. For more details, see the license file.