aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/los/numeros/command/EPHSCommand.java
blob: f5b44d0451d61949dea0525dfcf9d6de4aececb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package los.numeros.command;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;

import los.numeros.EPHS.Main;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;

public class EPHSCommand {
  public static void
  register(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated)
  {
    dispatcher.register(CommandManager.literal("epsh")
      .then(CommandManager.literal("start").executes(EPHSCommand::run)));
  }

  public static int
  run(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException
  {
    /* get the minecraft server object */
    ServerCommandSource source = ctx.getSource();

    /* pass in the minecraft server object and start it */
    new Main(source, 1);

    return 0;
  }
}