Home

Awesome

<img align="left" src="./pictures/block_logo.svg" style="width:20%;max-width:140px;margin:15px;">

Appwrite Minecraft SDK

Utility Minecraft plugin that creates persistent data storage while using Appwrite as a database. This plugin was a missing piece on the scene for years! Finally, with Appwrite Minecraft SDK, storing data is as simple as /appwrite database NiX3r set money 50. A server makes no longer needs to pay over-priced developers just because there is no simple way to store data without writing Java code.

๐Ÿ“œ Showcase

I am a server administrator, I have no coding experience, and I want to customize my server...

I have a dungeon minigame already created, but I don't want to let players play it infinitely; instead, I want to make this minigame a special reward. First, I start by running a command to define the variable availableDungeonKeys when a player first joins my server and set it to 0:

/appwrite database player set-remote %playername% availableDungeonKeys 3

Great, now when a new player joins, he will automatically have 3 keys.

When starting a minigame, I can use the placeholder %aw_p_availableDungeonKeys% to get the value and check if the amount is higher than 0. If that is the case, I can run a command to take 1 key from the player:

/appwrite database player take-remote %playername% availableDungeonKeys 1

Now that I have taken one key from the player, I can let him into a minigame. Tada ๐ŸŽ‰ I have just created a system where players can join my minigame, but they can only do it 3 times.

Finally, I add an option to purchase more keys to my web-store and run the command once they purchase the keys:

/appwrite database player add-remote %playername% availableDungeonKeys 10

Let's take a look at another scenario... Let's say I need an energy system so the player can only join the minigame when he has at least 1 energy. Instead of buying it, he needs to collect 25 fragments in order to convert it to 1 energy. Fragments can be obtained by breaking a special block on the spawn. How do I achieve that? It's extremely simple!

Let's start.. First, define variables when a player joins for the first time:

/appwrite database player set-remote %playername% energy 5
/appwrite database player set-local %playername% fragments 0

Notice how I marked fragments local because I want to lose the value when a player leaves the server - I don't want to store that.

Now, when a player breaks the specific block, I can run a command to increase his fragments count:

/appwrite database player add-local %playername% fragments 1

In this event, I also use placeholder %aw_p_fragments% to check if he has at least 25, and if that is the case, I reset it to 0 while increasing the energy count:

/appwrite database player add-remote %playername% energy 1
/appwrite database player set-local %playername% fragments 0

Wohoo, energy system finished ๐Ÿฅณ Here is a working example of such a logic:

<img src="https://github.com/nCodesDotEU/Appwrite-Minecraft-Database/blob/master/pictures/energy.gif">

๐Ÿ’ฟ How to install

  1. Download the latest plugin from Spigot (TODO)
  2. Copy the jar file into the server plugins folder
  3. Start / Restart the server to trigger the first load of the plugin
  4. Insert Appwrite endpoint, project ID and API key into the generated config.yml file
  5. Restart the server
  6. Enjoy Appwrite Database plugin!

โŒจ๏ธ Commands

Aliases: appwrite | aw <br> Example of commands usage: <br> <img src="https://github.com/nCodesDotEU/Appwrite-Minecraft-Database/blob/master/pictures/command.gif">

๐Ÿ“ Configs

โš™๏ธ config.yml

In the config.yml file, you can configure the connection to the Appwrite server.

๐Ÿˆด languages.yml

๐Ÿงฒ API

Before using the API, make sure your plugin is set up a valid Maven project.

First things first, you have to import the project from JitPack. To do that, you enter pom.xml of your project and add repository and dependency.

	...
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
	...
	<dependency>
	    <groupId>com.github.nCodesDotEU</groupId>
	    <artifactId>Appwrite-Minecraft-Database</artifactId>
	    <version>Tag</version>
	</dependency>
	...

Then, you can start using the API from class AppwriteDatabaseAPI, for example:

String playerName = "NiX3r";
Player player = Bukkit.getPlayer(playerName);
String playerUUID = player.getUniqueId().toString();

AppwriteDatabaseAPI.addValueSync(playerUUID, "money", 12, true);

๐Ÿ”ฎ PlaceholdersAPI

๐Ÿ“‹ TO-DO List

  1. Don't remove local variables
  2. Aliasses - mathematical formulas to count
  3. Events - create database events (such as OnDataChange, OnDataLoad, OnDataSave, ...)
  4. Defaults - default values of variables
  5. Inspects - inspect players keys, global keys and their values
  6. TOP 10 - shows top 10
  7. Merge data with external changes

๐Ÿ“† Versions

Plugin versionDescription1.171.161.141.121.81.71.5
0.0.1First release of pluginโœ”๏ธโŒโŒโŒโŒโŒโŒ
0.0.2Huge refactorโœ”๏ธโŒโŒโŒโŒโŒโŒ
0.0.3Fixed JitPack buildโœ”๏ธโŒโŒโŒโŒโŒโŒ

โ“ FAQ

๐Ÿ“ฃ Where to use local and where remote variables?

Local variables are those that don't save in the database. On the other hand, remote variables are those that are saved in the database. That means you can use local variables as much as you want, and they'll never be stored in the database. Fun fact: You can create a local variable and then just set it as remote and vice versa.

๐Ÿ“ฃ Types of variables

You can use several variables types. Once you choose the type, you cannot change it - you must delete and then create in again to override the type.

Types:

Why do I need different types? ๐Ÿค” For example, if you have to store money, you have to store it as INT or FLOAT, because later you will need to increase or decrease the value by a relative amount.

<a href="https://appwrite.io/" target="_blank" style="position: fixed;right: 18px;bottom: 18px;z-index: 999;"> <img style="width: 130px;" src="https://appwrite.io/images-ee/press/badge-pink-box.svg" alt="Built with Appwrite"> </a>

My big pleasure for plugin logo to Neon