Merge pull request 'Fix bns_admin command registration' (#24) from fix/bns-admin-int-range into main

This commit was merged in pull request #24.
This commit is contained in:
2026-05-23 15:41:34 +00:00
2 changed files with 10 additions and 2 deletions
@@ -56,12 +56,20 @@ ServerEvents.commandRegistry(event => {
}))) })))
// /bns admin waystone-set <player> <n> // /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.literal('waystone-set')
.then(Commands.argument('target', Arguments.PLAYER.create(event)) .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 => { .executes(ctx => {
const target = Arguments.PLAYER.getResult(ctx, 'target'); const target = Arguments.PLAYER.getResult(ctx, 'target');
const count = Arguments.INTEGER.getResult(ctx, 'count'); 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); target.persistentData.putInt('bnsWaystoneCount', count);
ctx.source.sendSystemMessage(Text.gold( ctx.source.sendSystemMessage(Text.gold(
`Set ${target.username}'s bnsWaystoneCount = ${count}` `Set ${target.username}'s bnsWaystoneCount = ${count}`
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing", "$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing",
"name": "Brass and Sigil", "name": "Brass and Sigil",
"version": "0.20.0", "version": "0.20.1",
"minecraft": "1.21.1", "minecraft": "1.21.1",
"loader": { "loader": {
"type": "neoforge", "type": "neoforge",