Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* <tr><td>{@code evoStages.firstStageEvo}</td><td>string</td><td>Permission node for first-stage evolution battles</td></tr>
* <tr><td>{@code evoStages.secondStageEvo}</td><td>string</td><td>Permission node for second-stage evolution battles</td></tr>
* <tr><td>{@code evoStages.finalStageEvo}</td><td>string</td><td>Permission node for final-stage evolution battles</td></tr>
*
* <tr><td rowspan="9">{@code catching}</td>
* <td>{@code restrictCatching}</td><td>boolean</td><td>Enables/disables catching level restrictions</td></tr>
* <tr><td>{@code legendary}</td><td>string</td><td>Permission node required to catch legendary Pokémon</td></tr>
Expand All @@ -46,14 +45,12 @@
* <tr><td>{@code evoStages.firstStageEvo}</td><td>string</td><td>Permission node for first-stage evolution catching</td></tr>
* <tr><td>{@code evoStages.secondStageEvo}</td><td>string</td><td>Permission node for second-stage evolution catching</td></tr>
* <tr><td>{@code evoStages.finalStageEvo}</td><td>string</td><td>Permission node for final-stage evolution catching</td></tr>
*
* <tr><td rowspan="5">{@code leveling}</td>
* <td>{@code restrictLeveling}</td><td>boolean</td><td>Enables/disables leveling level restrictions</td></tr>
* <tr><td>{@code evoStages.singleEvo}</td><td>string</td><td>Permission node for single-evolution Pokémon leveling</td></tr>
* <tr><td>{@code evoStages.firstStageEvo}</td><td>string</td><td>Permission node for first-stage evolution leveling</td></tr>
* <tr><td>{@code evoStages.secondStageEvo}</td><td>string</td><td>Permission node for second-stage evolution leveling</td></tr>
* <tr><td>{@code evoStages.finalStageEvo}</td><td>string</td><td>Permission node for final-stage evolution leveling</td></tr>
*
* <tr><td rowspan="2">{@code scaling}</td>
* <td>{@code enableScaling}</td><td>boolean</td><td>Enables/disables wild Pokémon level scaling</td></tr>
* <tr><td>{@code scalingMethod}</td><td>string</td><td>Scaling formula, e.g. {@code "+- random7"}, {@code "+ 0"}</td></tr>
Expand Down Expand Up @@ -153,7 +150,7 @@ public SuggestionProvider<CommandSourceStack> modulesProvider() {
* Returns a {@link com.mojang.brigadier.suggestion.SuggestionProvider} that suggests
* the valid property keys for whichever module has already been typed in the
* {@code <module>} argument position. If the module argument is not yet present or
* unrecognised, no suggestions are returned.
* unrecognized, no suggestions are returned.
*
* @return context-aware suggestion provider for the {@code <property>} argument
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,60 @@ public final class LevelControlCommand implements CoreCommand {

@Override
public void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext registry, Commands.CommandSelection context) {
dispatcher.register(
new CommandBuilder("level-control")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_ROOT_PERMISSION))
.then("level-up", levelUp -> levelUp
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_LEVEL_UP_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.then(Commands.argument("module", StringArgumentType.string())
.suggests(modulesProvider())
.executes(this::levelUp)
)
)
)
.then("set-level", setLevel -> setLevel
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_SET_LEVEL_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.then(Commands.argument("level", IntegerArgumentType.integer(1))
.executes(this::setLevel)
)
)
var levelUp = new CommandBuilder("level-up")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_LEVEL_UP_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.then(Commands.argument("module", StringArgumentType.string())
.suggests(modulesProvider())
.executes(this::levelUp)
)
.then("status", status -> status
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_STATUS_PERMISSION))
.executes(this::action)
)
.then("status-other", statusOther -> statusOther
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_STATUS_OTHER_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.executes(this::action)
);

var setLevel = new CommandBuilder("set-level")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_SET_LEVEL_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.then(Commands.argument("module", StringArgumentType.string())
.suggests(modulesProvider())
.then(Commands.argument("level", IntegerArgumentType.integer(1))
.executes(this::setLevel)
)
)
.then("configure", configure -> configure
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_CONFIGURE_PERMISSION))
.then(Commands.argument("module", StringArgumentType.string())
.suggests(ConfigureCommand.CMD.modulesProvider())
.then(Commands.argument("property", StringArgumentType.string())
.suggests(ConfigureCommand.CMD.propertiesProvider())
.then(Commands.argument("value", StringArgumentType.greedyString())
.executes(ConfigureCommand.CMD::configure)
)
)
);

var status = new CommandBuilder("status")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_STATUS_PERMISSION))
.executes(this::action);

var statusOther = new CommandBuilder("status-other")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_STATUS_OTHER_PERMISSION))
.then(Commands.argument("player", StringArgumentType.string())
.suggests(playersProvider())
.executes(this::action)
);

var configure = new CommandBuilder("configure")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_CONFIGURE_PERMISSION))
.then(Commands.argument("module", StringArgumentType.string())
.suggests(ConfigureCommand.CMD.modulesProvider())
.then(Commands.argument("property", StringArgumentType.string())
.suggests(ConfigureCommand.CMD.propertiesProvider())
.then(Commands.argument("value", StringArgumentType.greedyString())
.executes(ConfigureCommand.CMD::configure)
)
)
);

var rootCommand = new CommandBuilder("level-control")
.requires(src -> PermissionHelpers.checkPermission(src, PermissionHelpers.COMMAND_ROOT_PERMISSION))
.then(levelUp)
.then(setLevel)
.then(status)
.then(statusOther)
.then(configure);

.build()
);
dispatcher.register(rootCommand.build());
}

public SuggestionProvider<CommandSourceStack> modulesProvider() {
Expand Down