From 4f7eedb2ed55549adff61862a6d12861290b333a Mon Sep 17 00:00:00 2001 From: acrylic-style Date: Mon, 5 Aug 2024 10:08:15 +0900 Subject: [PATCH] add /lifecoreutil fixItem --- build.gradle.kts | 2 +- .../lifecore/command/LifeCoreUtilCommand.kt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 209ee22..cf4eca5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "net.azisaba" -version = "1.15.2+6.16.8-SNAPSHOT" +version = "1.15.2+6.16.8" java { toolchain.languageVersion.set(JavaLanguageVersion.of(8)) diff --git a/src/main/java/com/github/mori01231/lifecore/command/LifeCoreUtilCommand.kt b/src/main/java/com/github/mori01231/lifecore/command/LifeCoreUtilCommand.kt index d2f2982..91a9a11 100644 --- a/src/main/java/com/github/mori01231/lifecore/command/LifeCoreUtilCommand.kt +++ b/src/main/java/com/github/mori01231/lifecore/command/LifeCoreUtilCommand.kt @@ -438,6 +438,24 @@ class LifeCoreUtilCommand(val plugin: LifeCore) : TabExecutor { MapUtil.initializeMapRenderer((player as Player), player.inventory.itemInMainHand) } }, + FixItem("displayタグを修正します") { + override fun execute(plugin: LifeCore, player: CommandSender, args: Array) { + val item = (player as Player).inventory.itemInMainHand + val meta = item.itemMeta + if (meta.hasDisplayName()) { + val origName = meta.displayName + meta.setDisplayName(null) + meta.setDisplayName(origName) + } + if (meta.hasLore()) { + val origLore = meta.lore + meta.lore = null + meta.lore = origLore + } + item.itemMeta = meta + player.inventory.setItemInMainHand(item) + } + }, ; abstract fun execute(plugin: LifeCore, player: CommandSender, args: Array)