added stuff but forgor to push lol

This commit is contained in:
5vl 2022-06-11 01:14:55 +02:00
parent 2f226eaed3
commit b8a12bef29
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5
5 changed files with 46 additions and 11 deletions

View File

@ -0,0 +1,21 @@
package me.fivevl.itemadder
import net.kyori.adventure.text.Component
import org.bukkit.Material
import org.bukkit.inventory.ItemStack
class Item(uniqueName: String, name: Component, rarity: Rarity, material: Material, type: Type, vararg lore: String) {
object Items {
val items = HashMap<String, Item>()
}
lateinit var finalItem: ItemStack
init {
val item = ItemStack(material)
val meta = item.itemMeta
meta.displayName(name)
meta.lore(Utils.loreBuilder())
Items.items[uniqueName] = this
}
}

View File

@ -1,9 +1,10 @@
package me.fivevl.itemadder
import org.bukkit.Material
import org.bukkit.plugin.java.JavaPlugin
class Main : JavaPlugin() {
override fun onEnable() {
Item("TEST_ITEM", Utils.color("<blue>Test Item"), Rarity.EPIC, Material.STONE_SWORD, Type.SWORD, Utils.loreBuilder("<blue>Test Lore"))
}
}

View File

@ -1,13 +1,11 @@
package me.fivevl.itemadder
import net.kyori.adventure.text.Component
enum class Rarity(val formatted: Component) {
COMMON(Utils.color("<white><bold>COMMON")),
UNCOMMON(Utils.color("<lime><bold>UNCOMMON")),
RARE(Utils.color("<blue><bold>RARE")),
EPIC(Utils.color("<purple><bold>EPIC")),
LEGENDARY(Utils.color("<gold><bold>LEGENDARY")),
MYTHIC(Utils.color("<pink><bold>MYTHIC")),
SPECIAL(Utils.color("<red><bold>SPECIAL"))
enum class Rarity(val formatted: String) {
COMMON("<white><bold>COMMON"),
UNCOMMON("<lime><bold>UNCOMMON"),
RARE("<blue><bold>RARE"),
EPIC("<purple><bold>EPIC"),
LEGENDARY("<gold><bold>LEGENDARY"),
MYTHIC("<pink><bold>MYTHIC"),
SPECIAL("<red><bold>SPECIAL")
}

View File

@ -0,0 +1,8 @@
package me.fivevl.itemadder
enum class Type(type: String) {
SWORD("SWORD"),
PICKAXE("PICKAXE"),
AXE("AXE"),
ITEM("ITEM")
}

View File

@ -7,4 +7,11 @@ object Utils {
fun color(s: String): Component {
return MiniMessage.miniMessage().deserialize(s)
}
fun loreBuilder(vararg arr: String): ArrayList<Component> {
val lore = ArrayList<Component>()
for (s in arr) {
lore.add(color(s))
}
return lore
}
}