This repository has been archived on 2020-06-15. You can view files and clone it, but cannot push or open issues or pull requests.
2019-05-27 02:14:20 -04:00
|
|
|
package party._2a03.command;
|
|
|
|
|
|
|
|
import com.mojang.brigadier.CommandDispatcher;
|
|
|
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
|
|
import net.minecraft.command.CommandSource;
|
|
|
|
import net.minecraft.command.Commands;
|
|
|
|
import net.minecraft.util.text.TranslationTextComponent;
|
|
|
|
import party._2a03.server.Config;
|
|
|
|
|
|
|
|
public class ConfigCommand {
|
|
|
|
public static void register(CommandDispatcher<CommandSource> dispatcher) {
|
|
|
|
LiteralArgumentBuilder<CommandSource> literalargumentbuilder = Commands.func_197057_a("config").requires((source) -> {
|
|
|
|
return source.func_197034_c(2);
|
|
|
|
});
|
|
|
|
literalargumentbuilder.then(Commands.func_197057_a("reload").executes((source) -> {
|
|
|
|
try {
|
|
|
|
Config.loadConfig();
|
|
|
|
source.getSource().func_197030_a(new TranslationTextComponent("Reloaded the configuration"), true);
|
|
|
|
} catch(Exception e) {
|
|
|
|
source.getSource().func_197030_a(new TranslationTextComponent("Failed to reload the configuration"), true);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}));
|
|
|
|
literalargumentbuilder.then(Commands.func_197057_a("delete").executes((source) -> {
|
2019-05-27 13:36:20 -04:00
|
|
|
source.getSource().func_197030_a(new TranslationTextComponent("Did you seriously think this command did something?"), false);
|
2019-05-27 02:14:20 -04:00
|
|
|
return 1;
|
|
|
|
}));
|
|
|
|
dispatcher.register(literalargumentbuilder);
|
|
|
|
}
|
|
|
|
}
|