Skip to content

Commit

Permalink
event
Browse files Browse the repository at this point in the history
  • Loading branch information
Gutin1 committed Feb 12, 2024
1 parent cd6ea46 commit 4c6f096
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_BLUE
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_GREEN
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_ORANGE
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_PINK
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_PURPLE
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_RED
import net.horizonsend.ion.server.miscellaneous.registrations.legacy.CustomItems.ENERGY_SWORD_YELLOW
Expand Down Expand Up @@ -42,6 +43,7 @@ import org.bukkit.Material.FIREWORK_ROCKET
import org.bukkit.Material.GLASS_PANE
import org.bukkit.Material.GLOWSTONE_DUST
import org.bukkit.Material.IRON_INGOT
import org.bukkit.Material.PINK_TULIP
import org.bukkit.Material.PRISMARINE_CRYSTALS
import org.bukkit.Material.REDSTONE
import org.bukkit.Material.SEA_LANTERN
Expand Down Expand Up @@ -212,7 +214,8 @@ object CustomRecipes : IonServerComponent() {
ENERGY_SWORD_YELLOW to materialChoice(COAL),
ENERGY_SWORD_GREEN to materialChoice(EMERALD),
ENERGY_SWORD_PURPLE to customItemChoice(CHETHERITE),
ENERGY_SWORD_ORANGE to materialChoice(COPPER_INGOT)
ENERGY_SWORD_ORANGE to materialChoice(COPPER_INGOT),
ENERGY_SWORD_PINK to materialChoice(PINK_TULIP)
).forEach { (sword, specialItem) ->
createRecipe(
sword, "aga", "a*a", "ata",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package net.horizonsend.ion.server.miscellaneous.registrations.legacy

import com.google.common.collect.HashBasedTable
import com.google.common.collect.Table
import net.horizonsend.ion.common.utils.text.miniMessage
import net.horizonsend.ion.server.features.misc.ITEM_POWER_PREFIX
import net.horizonsend.ion.server.miscellaneous.utils.set
import net.horizonsend.ion.server.miscellaneous.utils.updateMeta
import net.kyori.adventure.text.format.TextDecoration
import org.bukkit.ChatColor
import org.bukkit.ChatColor.BLUE
import org.bukkit.ChatColor.DARK_AQUA
Expand All @@ -19,9 +21,6 @@ import org.bukkit.Material
import org.bukkit.Material.DIAMOND_AXE
import org.bukkit.Material.DIAMOND_PICKAXE
import org.bukkit.Material.FLINT_AND_STEEL
import org.bukkit.Material.IRON_BLOCK
import org.bukkit.Material.IRON_INGOT
import org.bukkit.Material.IRON_ORE
import org.bukkit.Material.LEATHER_BOOTS
import org.bukkit.Material.LEATHER_CHESTPLATE
import org.bukkit.Material.LEATHER_HELMET
Expand All @@ -34,16 +33,20 @@ import java.util.Locale

open class CustomItem(
val id: String,
displayName: String,
private val displayNameRaw: String,
val material: Material,
val model: Int,
val unbreakable: Boolean
val unbreakable: Boolean,
val useMiniMessage: Boolean = false
) {
val displayName = "${ChatColor.RESET}$displayName"
val displayName = "${ChatColor.RESET}$displayNameRaw"

open fun itemStack(amount: Int): ItemStack = ItemStack(material, amount)
.updateMeta {
it.setDisplayName(displayName)
if (useMiniMessage) {
it.displayName(miniMessage.deserialize(displayNameRaw).decoration(TextDecoration.ITALIC, false))
} else it.setDisplayName(displayName)

it.isUnbreakable = unbreakable
it.setCustomModelData(model)
}
Expand Down Expand Up @@ -155,15 +158,16 @@ object CustomItems {
EnergySwordItem("energy_sword_$color", "$colorName$YELLOW Energy$DARK_AQUA Sword", SHIELD, model)
)

class EnergySwordItem(id: String, displayName: String, material: Material, model: Int) :
CustomItem(id, displayName, material, model, true)
class EnergySwordItem(id: String, displayName: String, material: Material, model: Int, useMiniMessage: Boolean = false) :
CustomItem(id, displayName, material, model, true, useMiniMessage)

val ENERGY_SWORD_BLUE = registerEnergySword(color = "blue", colorName = "${BLUE}Blue", model = 1)
val ENERGY_SWORD_RED = registerEnergySword(color = "red", colorName = "${RED}Red", model = 2)
val ENERGY_SWORD_YELLOW = registerEnergySword(color = "yellow", colorName = "${YELLOW}Yellow", model = 3)
val ENERGY_SWORD_GREEN = registerEnergySword(color = "green", colorName = "${GREEN}Green", model = 4)
val ENERGY_SWORD_PURPLE = registerEnergySword(color = "purple", colorName = "${DARK_PURPLE}Purple", model = 5)
val ENERGY_SWORD_ORANGE = registerEnergySword(color = "orange", colorName = "${GOLD}Orange", model = 6)
val ENERGY_SWORD_PINK = register(EnergySwordItem("energy_sword_pink", "<#FFC0CB>Pink<yellow> Energy<dark_aqua> Sword", SHIELD, 7, useMiniMessage = true))
//endregion Energy Swords

//region Power Armor
Expand Down

0 comments on commit 4c6f096

Please sign in to comment.