https://github.com/cssxsh/mirai-economy-core
Mirai Console 经济服务前置插件
https://github.com/cssxsh/mirai-economy-core
mirai mirai-console mirai-plugin
Last synced: about 1 year ago
JSON representation
Mirai Console 经济服务前置插件
- Host: GitHub
- URL: https://github.com/cssxsh/mirai-economy-core
- Owner: cssxsh
- License: agpl-3.0
- Created: 2022-06-10T09:26:24.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-12T09:31:49.000Z (almost 2 years ago)
- Last Synced: 2025-02-25T18:01:40.490Z (over 1 year ago)
- Topics: mirai, mirai-console, mirai-plugin
- Language: Kotlin
- Homepage:
- Size: 235 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Mirai Economy Core
> Mirai 经济服务前置插件
[](https://search.maven.org/artifact/xyz.cssxsh.mirai/mirai-economy-core)
[](https://github.com/cssxsh/mirai-economy-core/actions/workflows/Test.yml)
[](https://www.codacy.com/gh/cssxsh/mirai-economy-core/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cssxsh/mirai-economy-core&utm_campaign=Badge_Grade)
**目前需要 [Mirai Hibernate Plugin](https://github.com/cssxsh/mirai-hibernate-plugin) 前置才能使用**
默认的经济货币为 `mirai-coin`
已对接 `Mirai 币` 的插件有:
* [壶言经济@Moyuyanli](https://github.com/Moyuyanli/HuYanEconomy)
* [LoliYouWant@MrXiaoM](https://github.com/MrXiaoM/LoliYouWant)
* [MiraiDailySign@MrXiaoM](https://github.com/MrXiaoM/MiraiDailySign)
## 在 Mirai Console Plugin 项目中引用
```kotlin
repositories {
mavenCentral()
}
dependencies {
compileOnly("xyz.cssxsh.mirai:mirai-economy-core:${version}")
}
// hibernate 6 和 HikariCP 5 需要 jdk11
mirai {
jvmTarget = JavaVersion.VERSION_11
}
```
### 示例代码
* [kotlin](src/test/kotlin/xyz/cssxsh/mirai/economy/EconomyServiceTest.kt)
* [java](src/test/java/xyz/cssxsh/mirai/economy/EconomyUtilsTest.java)
### 自定义货币
自定义货币 提供以下两种方式
1. 实现 `xyz.cssxsh.mirai.economy.service.EconomyCurrency` 接口
然后使用 `EconomyService.register` 注册货币
2. 脚本文件夹, 例如 [Lua](example/currencies/Lua) 或 [TXT](example/currencies/Him188), 文件夹名称将是 货币ID
也支持打包为 Zip 压缩包, 此时压缩包名称将是 货币ID
可以使用 `EconomyScriptCurrency.fromFolder` 或者 `EconomyScriptCurrency.fromZip` 手动加载, 然后手动注册
也可以放到 `data/xyz.cssxsh.mirai.plugin.mirai-economy-core/currencies` 中,在经济系统初始化时自动加载并注册
## [爱发电](https://afdian.net/@cssxsh)
