Treasury 图标

Treasury

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0.3
本资源为搬运资源,原资源地址: https://modrinth.com/mod/treasury
资源信息

Minecraft 版本: 26.1 26.1.1 26.1.2

平台: fabric

标签: economy library utility

资源介绍

Treasury

A simple economy & points API for Minecraft mods.
Inspired by the Bukkit Vault plugin.
It is not an economy implementation.
Instead, like Vault, other mods provide economy/points implementations, and Treasury acts as a bridge layer.

We need a good logo lmao, my art sucks —— the author

What can it do?

  • Hold server economy (multi-currency supported)
  • Access points / premium currency
  • Allow mods to interact economy system without depending on specific implementations

How it works

Treasury defines two main provider types:

  • EconomyProvider for normal currency
  • PointsProvider for points (most for premium currency)

Other mods register their implementation, and other developers who use the API can get them.
See more below.

Registry

Economy

  • Stored in EconomyServiceRegistry
  • Supports multiple providers
  • One provider is selected as primary

Selection rules:

  1. Using primaryEconomy which defined in config if specified
  2. Otherwise, use the first registered provider

Points

  • Stored in PointsServiceRegistry
  • Only one provider allowed

Registering another provider will throw an exception.

Register Providers

Economy

Treasury.economy().register(new ExampleEconomyProvider());

Points

Treasury.points().register(new ExamplePointsProvider());

Notes:

  • Only one points provider allowed
  • Please register during mod initialization

Fabric Entrypoints

Treasury supports register providers via Fabric entrypoints:

  • treasury-economy
  • treasury-points

Example:

{
  "entrypoints": {
    "treasury-economy": [
      "com.example.mod.ExampleEconomyProvider"
    ],
    "treasury-points": [
      "com.example.mod.ExamplePointsProvider"
    ]
  }
}

Usage

Economy

if (Treasury.economy().hasPrimary()) {
    EconomyProvider economy = Treasury.economy().getPrimary();
    double balance = economy.getBalance(playerUuid);
}

Points

if (Treasury.points().isRegistered()) {
    PointsProvider points = Treasury.points().get();
    int balance = points.getBalance(playerUuid);
}

Commands

  • /treasury info
  • /treasury balance <player>

Required permission level: 2

Requirements

  • Fabric: Minecraft 1.20.1+, any Fabric version, Fabric API is not required
  • NeoForge: Minecraft 1.20.4+, any NeoForge version
  • Java: 17 or higher

Don't ask for Forge!

Build

./gradlew build

Import

dependencies {
    compileOnly("io.github.lijinhong11:treasury:VERSION")
}
下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
RCTBadges - Elemental Effects Badges

价格:0 墨喵币
下载量:0

查看详情
Ladders Don't Suck

价格:0 墨喵币
下载量:0

查看详情
CucumberMod-Crops+

价格:0 墨喵币
下载量:0

查看详情
Outdoorsy

价格:0 墨喵币
下载量:0

查看详情