diff options
Diffstat (limited to 'src/main/java/los/numeros/command/HidersAndDiggersCommand.java')
-rw-r--r-- | src/main/java/los/numeros/command/HidersAndDiggersCommand.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/los/numeros/command/HidersAndDiggersCommand.java b/src/main/java/los/numeros/command/HidersAndDiggersCommand.java new file mode 100644 index 0000000..eed4eed --- /dev/null +++ b/src/main/java/los/numeros/command/HidersAndDiggersCommand.java @@ -0,0 +1,31 @@ +package los.numeros.command; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; + +import los.numeros.HidersAndDiggers.Main; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.command.CommandManager; +import net.minecraft.server.command.ServerCommandSource; + +public class HidersAndDiggersCommand { + public static void + register(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated) + { + dispatcher.register(CommandManager.literal("hiders") + .then(CommandManager.literal("start").executes(HidersAndDiggersCommand::run))); + } + + public static int + run(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException + { + /* get the minecraft server object */ + MinecraftServer server = ctx.getSource().getMinecraftServer(); + + /* pass in the minecraft server object and start it */ + new Main(server); + + return 0; + } +} |