diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-16 12:11:17 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-16 12:11:17 +0200 |
commit | 2c66b795277876addffe1386e498fd1c0131218f (patch) | |
tree | deccbe9e7fced46506a44873aa9adb02b9fcd8f1 /src/main/java/at/hannibal2/skyhanni/test/command | |
parent | 560cdada4b3577fb83c39c5cac62409093055103 (diff) | |
download | skyhanni-2c66b795277876addffe1386e498fd1c0131218f.tar.gz skyhanni-2c66b795277876addffe1386e498fd1c0131218f.tar.bz2 skyhanni-2c66b795277876addffe1386e498fd1c0131218f.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt index f3d0d80ef..f0b2c8ae1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils @@ -12,12 +12,12 @@ import net.minecraft.nbt.NBTTagCompound object CopyItemCommand { fun command() { - try { - val itemStack = InventoryUtils.getItemInHand() ?: throw Exception() - copyItemToClipboard(itemStack) - } catch (_: Throwable) { + val itemStack = InventoryUtils.getItemInHand() + if (itemStack == null) { LorenzUtils.chat("§c[SkyHanni] No item in hand!") + return } + copyItemToClipboard(itemStack) } private fun recurseTag(compound: NBTTagCompound, text: String, list: MutableList<String>) { @@ -35,12 +35,10 @@ object CopyItemCommand { } } - fun copyItemToClipboard(itemStack: ItemStack){ + fun copyItemToClipboard(itemStack: ItemStack) { val resultList = mutableListOf<String>() - resultList.add("ITEM LORE") + resultList.add(itemStack.getInternalName().toString()) resultList.add("display name: '" + itemStack.displayName.toString() + "'") - val itemID = itemStack.getInternalName_old() - resultList.add("internalName: '$itemID'") resultList.add("minecraft id: '" + itemStack.getMinecraftId() + "'") resultList.add("lore:") for (line in itemStack.getLore()) { |