API Installation
API Installation for BlanketEconomy
Step-by-Step Guide
Download the Latest Release: Visit the Releases page and download the latest version of the BlanketEconomy API.
Place the
.jar
File: Copy the downloaded.jar
file and place it into your Minecraft server'smods
folder.Start Your Server: Run your server to generate the configuration file at
config/blanketeconomy/config.json
. This file can be modified to customize the API behavior.
Adding BlanketEconomy as a Dependency
How to Add the .jar
to Your Project
.jar
to Your ProjectDownload the Latest Version: Get the latest version of BlanketEconomy from Modrinth.
Create a
libs
Folder: Inside your project, create a folder namedlibs
.Add the File to
libs
: Place the downloaded.jar
file into thelibs
folder.Add Dependencies: Add the dependency to your build script (e.g., in
build.gradle
for a Gradle project).
Example (Groovy):
This ensures that your project includes BlanketEconomy as a dependency.
Imports and Initializing the API
To use the BlanketEconomy API in your code, import the following:
Accessing the API:
To initialize and access the BlanketEconomy API, use the following code:
This will give you access to various economy-related methods, such as getting balances, transferring currency, and managing custom currencies.
Code Examples for Using the API
1. Getting a Player's Balance
To retrieve the balance of a specific player for a given currency:
2. Setting a Player's Balance
To set the balance for a player:
3. Adding Currency to a Player's Balance
To add currency to a player’s balance:
4. Subtracting Currency from a Player's Balance
To subtract currency from a player’s balance:
5. Transferring Currency Between Players
To transfer currency from one player to another:
6. Checking if a Player Has Enough Funds
To check if a player has sufficient funds:
7. Creating a New Currency
To create a new custom currency in the game:
These examples provide a starting point for integrating the BlanketEconomy API into your mod. From managing player balances to creating custom currencies, the API is flexible and powerful, making it easy to implement your economy needs.
Last updated