Skip to content

Commit 32fb1d8

Browse files
authored
Merge pull request #270 from polang233/stable/v3
fix: 修复 Vault 经济功能与条件 Lore 刷新
2 parents 13e91cd + f4e6f21 commit 32fb1d8

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
group=me.arasple.mc.trmenu
2-
version=3.12.4
2+
version=3.12.5

plugin/src/main/kotlin/trplugins/menu/module/display/icon/IconProperty.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class IconProperty(
2727
}
2828

2929
fun isLoreUpdatable(session: MenuSession): Boolean {
30-
return display.lore(session).cyclable() || display.lore(session).elements.any { it -> Regexs.containsPlaceholder(it.lore.joinToString(" ") { it.first }) }
30+
return display.lore(session).cyclable() || display.lore(session).elements.any { lore ->
31+
lore.lore.any { (line, condition) -> condition != null || Regexs.containsPlaceholder(line) }
32+
}
3133
}
3234

3335
fun handleClick(type: ReceptacleClickType, session: MenuSession) {
@@ -44,4 +46,4 @@ class IconProperty(
4446
}
4547

4648

47-
}
49+
}

plugin/src/main/kotlin/trplugins/menu/module/internal/hook/impl/HookVault.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,13 @@ class HookVault : HookAbstract() {
6363
/**
6464
* 当前 Economy provider 背后的实现插件实例。
6565
*
66-
* provider 自身就是 Bukkit Plugin(兜底分支)时直接返回
67-
* 否则按 [Economy.getName] 在 Bukkit 插件表中匹配
66+
* ServicesManager provider 直接使用注册插件
67+
* 兜底 provider 自身就是 Bukkit Plugin
6868
*/
6969
val economyPlugin: Plugin?
7070
get() {
71-
val provider = economyAPI ?: return null
72-
return provider as? Plugin
73-
?: Bukkit.getPluginManager().getPlugin(provider.name)
71+
val registration = Bukkit.getServicesManager().getRegistration(Economy::class.java)
72+
return if (registration?.plugin?.isEnabled == true) registration.plugin else pluginEconomy as? Plugin
7473
}
7574

7675
/**

0 commit comments

Comments
 (0)