#help creating a command for my dynamic seasons script

6 messages · Page 1 of 1 (latest)

crude orbit
#

i am trying to create a command for my dynamic seasons script that allows an admin to change the servers hemisphere

however when i run the command i get the error [System] [CHAT] An unexpected error occurred trying to execute that command

it does not give me any more information than that

can anyone tell me what i am doing wrong here?

here is the code of the command

ServerEvents.commandRegistry(event => {
    const { commands: Commands, arguments: Arguments } = event

    event.register
        (Commands.literal('locale') // The name of the command
            .requires(s => s.hasPermission(2)) // Check if the player has operator privileges
            .executes(ctx => {
                //the variable holding the current locale is cmdloc
                let player = ctx.source.player;
                player.displayClientMessage(Component.white('the current hemisphere is'+cmdloc+"ern"));
            })
            .then(
                Commands.argument(
                    'hemisphere', 
                    Arguments.STRING.create(event)
                ) // the selected hemisphere  --  must be north or south
                .executes(ctx => {
                    let player = ctx.source.player;
                    const newloc = Arguments.STRING.getResult(ctx, 'hemisphere');
                    if (newloc == ("north" | "south")) {
                        cmdloc = newloc
                    } else {
                        player.displayClientMessage(Component.white('hemisphere must be \'north\' or \'south\''));
                    }
                })
            )
        )
    }
)
zinc waveBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

stoic summit
#

if issue persists update code above and provide logs logs/kubejs/server.log

crude orbit
#

i will try that now

crude orbit
#

i got it working, thanks