Add online_mode and velocity_secret config options
Some checks failed
Build JStom / build (push) Failing after 53s

This commit is contained in:
2026-01-26 01:26:02 +00:00
parent d06d9bf9d9
commit e06b356531
5 changed files with 98 additions and 0 deletions

25
scripts/elytra_spawn.js Normal file
View File

@@ -0,0 +1,25 @@
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)!");
});