i'm on kubejs 1802.5.5, trying to make a simple command that just teleports you to spawn:
const { commands: Commands } = event;
event.register(Commands.literal('spawn')
.executes(ctx => {
let player = ctx.source.player;
console.info('hi');
console.info(ctx);
console.info(player);
player.teleportTo('minecraft:overworld', 0, 100, 0, player.yaw, player.pitch);
player.displayClientMessage(Component.green('Teleported to spawn!'), true);
return 1;
})
);
});```
when i run the command, my logs show this:
```[Server thread] [KubeJS Server/INFO]: hi
[Server thread] [KubeJS Server/INFO]: com.mojang.brigadier.context.CommandContext@c27a2f62 [com.mojang.brigadier.context.CommandContext]
[Server thread] [KubeJS Server/INFO]: undefined
[Render thread] [net.minecraft.client.gui.components.ChatComponent/INFO]: [CHAT] An unexpected error occurred trying to execute that command```
as you can see, ctx.source.player is undefined even though the docs say thats what i should use, am i doing something wrong?