nyallo
upon running a command, 'an unexpected error occurred' appears in chat, and when i hover over that message it comes up with TypeError: Cannot read property "persistentData" from undefined. it next specifies that
let pData = event.server.persistentData
is the problem
ServerEvents.commandRegistry(event => {
const { commands: Commands, arguments: Arguments } = event
event.register(
Commands.literal('permadeath')
.requires(src => src.hasPermission(2))
.then(Commands.argument('boolean', Arguments.BOOLEAN.create(event))
.executes(ctx => {
let pData = event.server.persistentData
const boolean = Arguments.BOOLEAN.getResult(ctx, "boolean");
console.log(boolean)
if (boolean) {
console.log('when the permadeath is true')
pData.permadeath = true
} else {
pData.permadeath = false
console.log('when the permadeath is false')
console.log(pData.permadeath)
}
return 1;
})))
})```