Skip to content

Commit eb18d94

Browse files
committed
fix(item):修复获取物品数据时线程死锁等问题
- 使用 MinecraftVersion 判断版本并设置物品数据 - 优化命令执行逻辑,提升代码可读性 - 改用 unsafeLazy 优化插件获取方式放置线程死锁
1 parent b25f7bb commit eb18d94

File tree

1 file changed

+1
-1
lines changed
  • plugin/src/main/kotlin/trplugins/menu/module/internal/command/impl

1 file changed

+1
-1
lines changed

plugin/src/main/kotlin/trplugins/menu/module/internal/command/impl/CommandItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ object CommandItem : CommandExpression {
101101
val stringJson: String = if (!HookPlugin.getNBTAPI().isHooked) {
102102
val json = JsonObject()
103103
json.addProperty("type", item.type.name)
104-
json.addProperty("data", item.data!!.data)
104+
json.addProperty("data", if (MinecraftVersion.isLowerOrEqual(MinecraftVersion.V1_12)) item.data!!.data else 0)
105105
json.addProperty("amount", item.amount)
106106
json.add("meta", Gson().toJsonTree(item.getItemTag()))
107107
json.toString()

0 commit comments

Comments
 (0)