Перейти к содержимому

BEconomy 1.5.2 для Minecraft 1.21.3 (Fabric)

Релиз27 апреля 2025Minecraft 1.21–1.21.3Fabric551 скачиваний на Modrinth
Это не последняя версия. Последняя для 1.21.3 · Fabric — 1.6.0Открыть 1.6.0 →

Файлы · 1

beconomy-1.5.jarОсновной224 КБСкачать ↗
Основной · 224 КБ
SHA-14a56fb02540eec8ed1512395de7572b92bb9354dSHA-5123e1d1afe2011644da516cf9c5fb131185285b091e58d744641552dac0aa96d87fbbb6da766e4593c4e37d0e0509c8c512da0a21bd1a50c7a6e8898afd413d6a5
Скачать ↗

Что изменилось

  • 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>

Зависимости этой версии

Fabric APIобязательная · 0.114.1+1.21.3 для 1.21.3Мод на Modrinth ↗
Text Placeholder APIобязательная · 2.5.2+1.21.3 для 1.21.3Мод на Modrinth ↗
Fabric Language Kotlinобязательная · 1.14.2+kotlin.2.4.21 для 1.21.3Скачать для 1.21.3 · Fabric
LuckPermsобязательная · v5.4.145-fabric для 1.21.3Мод на Modrinth ↗

Сайт использует cookie: необходимые — для входа и темы, а также счётчики посещений Яндекс Метрика и LiveInternet — по ним мы видим, как пользуются сайтом. Рекламных cookie у нас нет. Подробнее