const ItemStack = Java.type('net.minestom.server.item.ItemStack'); const Material = Java.type('net.minestom.server.item.Material'); const EquipmentSlot = Java.type('net.minestom.server.entity.EquipmentSlot'); const DataComponents = Java.type('net.minestom.server.component.DataComponents'); const FireworkList = Java.type('net.minestom.server.item.component.FireworkList'); server.log("Elytra script loaded!"); server.on('net.minestom.server.event.player.PlayerSpawnEvent', (event) => { const player = event.getPlayer(); // Create items using fromKey (safer than static field access) const elytra = ItemStack.of(Material.fromKey("minecraft:elytra")); // Create fireworks with flight duration 3 var fireworks = ItemStack.of(Material.fromKey("minecraft:firework_rocket")) .withAmount(64) .with(DataComponents.FIREWORKS, FireworkList.EMPTY.withFlightDuration(3)); // Equip items player.setEquipment(EquipmentSlot.CHESTPLATE, elytra); player.setEquipment(EquipmentSlot.OFF_HAND, fireworks); player.sendMessage("You have been equipped with an Elytra and Fireworks (Flight Duration 3)!"); });