io.github.parzivalExe.guiApi.components.ComponentMeta.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of guiapi-mc1.8 Show documentation
Show all versions of guiapi-mc1.8 Show documentation
With GuiAPI you can create Guis for your Bukkit/Spigot-Plugin in seconds while at the same time saving many lines of code
The newest version!
package io.github.parzivalExe.guiApi.components
import org.bukkit.inventory.ItemStack
@Suppress("unused")
class ComponentMeta(var title: String, private var look: ItemStack) {
var description = arrayListOf()
var savedObjects = hashMapOf()
constructor(name: String, look: ItemStack, description: ArrayList) : this(name, look) {
this.description = description
}
//region simple methods
fun addDescriptionLine(descriptionLine: String) {
description.add(descriptionLine)
}
fun getDescriptionAsString(): String {
var string = ""
description.forEach { line -> string += line + "\n" }
string.removeSuffix("\n")
return string
}
//endregion
fun setLook(look: ItemStack) {
this.look = look
}
internal fun buildItem(): ItemStack {
val itemMeta = look.itemMeta
itemMeta.apply {
displayName = title
lore = description
}
look.itemMeta = itemMeta
return look
}
}