+
+ private static <T> void buildSetSettingCommand(LiteralArgumentBuilder<CommandSource> command,
+ Setting<T> setting, ArgumentType<T> argument, Class<T> clazz) {
+ Command<CommandSource> setSettingCommand = context -> {
+ setting.set(context.getArgument(VALUE, clazz));
+ if (CommandHelper.lastNodeIsLiteral(context, SAVE)) {
+ ConfigManager.saveConfig();
+ }
+ return 0;
+ };
+ command.then(Commands.argument(VALUE, argument)
+ .executes(setSettingCommand)
+ .then(Commands.literal(SAVE)
+ .executes(setSettingCommand)));
+ }