60 lines
2.5 KiB
JavaScript
60 lines
2.5 KiB
JavaScript
// priority: 998
|
|
|
|
ServerEvents.commandRegistry((event) => {
|
|
const { commands: Commands, arguments: Arguments } = event;
|
|
|
|
// Helper to create modifier get/set commands
|
|
const createModifierCommand = (name, displayName) => {
|
|
return Commands.literal(name)
|
|
.then(Commands.literal("set")
|
|
.then(Commands.argument("value", Arguments.FLOAT.create(event))
|
|
.executes((context) => {
|
|
let player = context.getSource().getPlayerOrException();
|
|
if (!global.TESTING.value) {
|
|
if (player) error(player, "Testing mode is off, cannot change value");
|
|
return 0;
|
|
}
|
|
global.modifier[name] = Arguments.FLOAT.getResult(context, "value");
|
|
if (player) message(player, `${displayName} modifier (not persistent) changed to ${global.modifier[name]}`);
|
|
return 1;
|
|
})
|
|
)
|
|
)
|
|
.then(Commands.literal("get")
|
|
.executes((context) => {
|
|
let player = context.getSource().getPlayerOrException();
|
|
if (player) message(player, `${displayName} modifier is currently set to ${global.modifier[name]}`);
|
|
return 1;
|
|
})
|
|
);
|
|
};
|
|
|
|
event.register(
|
|
Commands.literal("ftblibrary")
|
|
.requires(src => src.hasPermission(3))
|
|
.then(Commands.literal("TESTING")
|
|
.then(Commands.literal("true").executes((context) => {
|
|
global.TESTING.value = true;
|
|
let player = context.getSource().getPlayerOrException();
|
|
if (player) message(player, "Testing Mode on");
|
|
return 1;
|
|
}))
|
|
.then(Commands.literal("false").executes((context) => {
|
|
global.TESTING.value = false;
|
|
let player = context.getSource().getPlayerOrException();
|
|
if (player) message(player, "Testing Mode Off");
|
|
return 1;
|
|
}))
|
|
)
|
|
);
|
|
|
|
event.register(
|
|
Commands.literal("puffish_skills")
|
|
.requires(src => src.hasPermission(3))
|
|
.then(Commands.literal("modifiers")
|
|
.then(createModifierCommand("ars", "Ars Nouveau"))
|
|
.then(createModifierCommand("ironspell", "Ironspell"))
|
|
)
|
|
);
|
|
});
|