Interface ConfigCommandApi
- All Known Implementing Classes:
ConfigCommandImpl
public interface ConfigCommandApi
Provides methods for creating and registering config commands using
ConfigHolders.
A generated config command will have the following subcommands:
reset:
Resets the config to default values
reload:
Reloads the config from disk
get:
option:
Gets the given config options value.
set:
option:
If there's no way to represent the config option in a command,
this will tell the user to modify it manually.
newValue:
Sets the given config option to the given new value.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic com.mojang.brigadier.builder.LiteralArgumentBuilder<?>createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder) Creates a config command using the provided name andConfigHolder.static com.mojang.brigadier.builder.LiteralArgumentBuilder<?>createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback) Creates a config command using the provided name andConfigHolder.static com.mojang.brigadier.builder.LiteralArgumentBuilder<?>createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback) Creates a config command using the provided name andConfigHolder.com.mojang.brigadier.builder.LiteralArgumentBuilder<?>createConfigCommandImpl(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback) static voidregisterConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.static voidregisterConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.static voidregisterConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.voidregisterConfigCommandImpl(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback, String... commandTree)
-
Field Details
-
INSTANCE
-
-
Method Details
-
registerConfigCommand
static void registerConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.The command tree could for example be
"modid", "config"for the command to look like/modid config reset/reload/get/set- Parameters:
configHolder- yourConfigHolderinstance.commandTree- the command tree.
-
registerConfigCommand
static void registerConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.
TheconfigReloadCallbackis executed after thereloadcommand is run, and can be used for reinitializing stuff based on the new values.The command tree could for example be
"modid", "config"for the command to look like/modid config reset/reload/get/set- Parameters:
configHolder- yourConfigHolderinstance.configReloadCallback- executed when config is reloaded by thereloadcommand.commandTree- the command tree.
-
registerConfigCommand
static void registerConfigCommand(top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback, String... commandTree) Creates and registers a config command using the provided command tree andConfigHolder.
TheconfigReloadCallbackis executed after thereloadcommand is run, and can be used for reinitializing stuff based on the new values.The command tree could for example be
"modid", "config"for the command to look like/modid config reset/reload/get/set- Parameters:
configHolder- yourConfigHolderinstance.configReloadCallback- executed when config is reloaded by thereloadcommand.configValueSetCallback- executed when a config value is changed by thesetcommand.commandTree- the command tree.
-
createConfigCommand
static com.mojang.brigadier.builder.LiteralArgumentBuilder<?> createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder) Creates a config command using the provided name andConfigHolder.- Parameters:
commandName- the name of the command.configHolder- yourConfigHolderinstance.- Returns:
- a config command using the provided name and
ConfigHolder.
-
createConfigCommand
static com.mojang.brigadier.builder.LiteralArgumentBuilder<?> createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback) Creates a config command using the provided name andConfigHolder.
TheconfigReloadCallbackis executed after thereloadcommand is run, and can be used for reinitializing stuff based on the new values.- Parameters:
commandName- the name of the command.configReloadCallback- executed when config is reloaded by thereloadcommand.configHolder- yourConfigHolderinstance.- Returns:
- a config command using the provided name and
ConfigHolder.
-
createConfigCommand
static com.mojang.brigadier.builder.LiteralArgumentBuilder<?> createConfigCommand(String commandName, top.offsetmonkey538.offsetconfig538.api.config.ConfigHolder<?> configHolder, @Nullable Runnable configReloadCallback, @Nullable Runnable configValueSetCallback) Creates a config command using the provided name andConfigHolder.
TheconfigReloadCallbackis executed after thereloadcommand is run, and can be used for reinitializing stuff based on the new values.- Parameters:
commandName- the name of the command.configReloadCallback- executed when config is reloaded by thereloadcommand.configValueSetCallback- executed when a config value is changed by thesetcommand.configHolder- yourConfigHolderinstance.- Returns:
- a config command using the provided name and
ConfigHolder.
-
registerConfigCommandImpl
-
createConfigCommandImpl
-