bns_admin: drop INTEGER range args (KubeJS wrapper doesn't expose them), validate in handler instead. 0.20.0 -> 0.20.1.
This commit is contained in:
@@ -56,12 +56,20 @@ ServerEvents.commandRegistry(event => {
|
||||
})))
|
||||
|
||||
// /bns admin waystone-set <player> <n>
|
||||
// (Argument-bounds aren't exposed via KubeJS's wrapper, so we
|
||||
// validate the range inside the handler instead.)
|
||||
.then(Commands.literal('waystone-set')
|
||||
.then(Commands.argument('target', Arguments.PLAYER.create(event))
|
||||
.then(Commands.argument('count', Arguments.INTEGER.create(event, 0, 1000))
|
||||
.then(Commands.argument('count', Arguments.INTEGER.create(event))
|
||||
.executes(ctx => {
|
||||
const target = Arguments.PLAYER.getResult(ctx, 'target');
|
||||
const count = Arguments.INTEGER.getResult(ctx, 'count');
|
||||
if (count < 0 || count > 1000) {
|
||||
ctx.source.sendSystemMessage(Text.red(
|
||||
`count must be 0..1000 (got ${count})`
|
||||
));
|
||||
return 0;
|
||||
}
|
||||
target.persistentData.putInt('bnsWaystoneCount', count);
|
||||
ctx.source.sendSystemMessage(Text.gold(
|
||||
`Set ${target.username}'s bnsWaystoneCount = ${count}`
|
||||
|
||||
Reference in New Issue
Block a user