Add LobbyItemManager; PDC support; misc fixes
Introduce LobbyItemManager to provide interactive lobby hotbar items (kits & perks) tagged via PersistentDataContainer and open the appropriate GUIs. Wire the manager into SpeedHG (field, init, event registration) and clear lobby items at game start in GameManager. Add ItemBuilder.pdc helper and necessary imports for setting PDC. Fix potion duration calculation to use invincibilityTime*20. Change AnchorKit icon/trigger material to ANVIL. Update config (border start/end/shrink and disable anti-runner) and update en_US language entries (lobby item names, leaderboard format, kit lore/formatting and small text fixes).
This commit is contained in:
@@ -5,9 +5,11 @@ import net.kyori.adventure.text.format.TextDecoration
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.NamespacedKey
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.inventory.ItemFlag
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
|
||||
class ItemBuilder(
|
||||
private val itemStack: ItemStack
|
||||
@@ -76,6 +78,18 @@ class ItemBuilder(
|
||||
return this
|
||||
}
|
||||
|
||||
fun <T, Z> pdc(
|
||||
key: NamespacedKey,
|
||||
dataType: PersistentDataType<T, Z>,
|
||||
value: Z
|
||||
): ItemBuilder
|
||||
{
|
||||
itemStack.editMeta {
|
||||
it.persistentDataContainer.set( key, dataType, value!! )
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
fun enchant(
|
||||
ench: Enchantment
|
||||
): ItemBuilder
|
||||
|
||||
Reference in New Issue
Block a user