Tags
Creators
Details
Licensed GPL-3.0-only
Published 2 years ago
Updated last month
All versions
1.5.2
Release
BEconomylast year 551
Compatibility
Minecraft: Java Edition
1.21–1.21.3
Platform
Fabric
Supported environments
Dedicated servers only
Required content
Any compatible version
Any compatible version
Any compatible version
Any compatible version
Changes
- I fixed the problem with negative money from pay/add.
- I fixed a problem of reconnecting to databases.
- I modified the balance command and now you can configure it just like normal commands in config.json
- I made some changes to the API.
New functions for API:
/**
* Sets the player's balance to a specific amount.
*
* This method should be used instead of directly calling `BEconfig.setBalance(...)`,
* as it also triggers the `onBalanceChanged` event and notifies all registered listeners.
*
* @param playerId The UUID of the player whose balance is being updated.
* @param currencyType The currency type to modify.
* @param newBalance The exact value to set as the new balance.
*/
fun updateBalance(playerId: UUID, currencyType: String, newBalance: BigDecimal)
/**
* Adds a specified amount to the player's balance.
*
* This method updates the balance, triggers the `onBalanceChanged` event,
* and logs the transaction as a credit. Always use this instead of modifying the balance manually.
*
* @param playerId The UUID of the player.
* @param currencyType The currency to increase.
* @param amount The amount to add to the current balance.
*/
fun increaseBalance(playerId: UUID, currencyType: String, amount: BigDecimal)
/**
* Subtracts a specified amount from the player's balance.
*
* This method checks for sufficient funds before subtracting, triggers the `onBalanceChanged` event,
* and logs the transaction as a debit. Returns false if the player has insufficient funds.
*
* @param playerId The UUID of the player.
* @param currencyType The currency to subtract from.
* @param amount The amount to subtract.
* @return True if the subtraction was successful, false otherwise.
*/
fun decreaseBalance(playerId: UUID, currencyType: String, amount: BigDecimal): Boolean
/**
* Forces a balance sync to the player using packets.
*
* This is useful when an external system (like a scoreboard or UI) needs
* to refresh the display without changing the balance.
*
* @param playerId The UUID of the player.
* @param currencyType The currency type to sync.
*/
fun syncBalanceToPlayer(playerId: UUID, currencyType: String)
/**
* Applies a modification to the player's balance using a safe lambda.
* Automatically handles balance update and events.
*
* Example usage:
* modifyBalanceSafely(uuid, "pokedollars") { it.multiply(BigDecimal("1.05")) }
*
* @param playerId The UUID of the player.
* @param currencyType The currency type.
* @param modifier A function that receives the current balance and returns the new one.
*/
fun modifyBalanceSafely(playerId: UUID, currencyType: String, modifier: (BigDecimal) -> BigDecimal)
/**
* Resets a player's balance to the default value defined in config for the currency.
* Triggers the `onBalanceChanged` event.
*
* @param playerId The UUID of the player.
* @param currencyType The currency type to reset.
*/
fun resetBalanceToDefault(playerId: UUID, currencyType: String)
/**
* Retrieves a map of all balances for a specific player across all currencies.
*
* @param playerId The UUID of the player.
* @return Map of currency type to balance.
*/
fun getAllPlayerBalances(playerId: UUID): Map<String, BigDecimal>
/**
* Retrieves the top players based on their balance for a specific currency.
* This works across all storage types (local file or database).
*
* @param currencyType The type of currency to rank by.
* @param limit The maximum number of top players to return.
* @return A list of PlayerBalance objects sorted by balance in descending order.
*/
fun getTopBalances(currencyType: String, limit: Int): List<PlayerBalance>
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:4Kma4Oms:TBDxX67r"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:4Kma4Oms:TBDxX67r"
}

