smh changed ig

This commit is contained in:
5vl 2022-06-21 19:10:24 +02:00
parent 8102be41df
commit 527f88befd
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5

View File

@ -7,6 +7,8 @@ import net.kyori.adventure.text.Component
import org.bukkit.Material import org.bukkit.Material
import org.bukkit.event.player.PlayerInteractEvent import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
import java.util.*
import kotlin.collections.HashMap
class Item(uniqueName: String, name: String, private val rarity: Rarity, material: Material, private val type: ItemType, private val lore: String) { class Item(uniqueName: String, name: String, private val rarity: Rarity, material: Material, private val type: ItemType, private val lore: String) {
val finalItem: ItemStack val finalItem: ItemStack
@ -26,7 +28,14 @@ class Item(uniqueName: String, name: String, private val rarity: Rarity, materia
abilities[runnable] = abilityType abilities[runnable] = abilityType
val clickType = if (abilityType == AbilityType.LEFT_CLICK) "Left click" else if (abilityType == AbilityType.RIGHT_CLICK) "Right click" else "Other type" val clickType = if (abilityType == AbilityType.LEFT_CLICK) "Left click" else if (abilityType == AbilityType.RIGHT_CLICK) "Right click" else "Other type"
val meta = finalItem.itemMeta val meta = finalItem.itemMeta
meta.lore(Utils.loreBuilder(lore, "", "<yellow><bold>$clickType: <gold>$name", addLore, rarity.formatted + " " + type.type)) val newLore = meta.lore()!!
val lastLine = newLore.last()!!
newLore.remove(lastLine)
val sj = StringJoiner("\n")
for (line in newLore) {
sj.add(line.toString())
}
meta.lore(Utils.loreBuilder(sj.toString(), "<yellow><bold>$clickType: <gold>$name", addLore, " ", rarity.formatted + " " + type.type))
finalItem.itemMeta = meta finalItem.itemMeta = meta
} }
} }