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\''));
}
})
)
)
}
)