Created
November 15, 2019 21:23
-
-
Save LatvianModder/cd7274ec07a886abaaacd84dab73b363 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void register(CommandDispatcher<CommandSource> dispatcher) | |
{ | |
LiteralCommandNode<CommandSource> command = dispatcher.register(Commands.literal("ftbteams") | |
.then(Commands.literal("create") | |
.then(Commands.argument("name", StringArgumentType.greedyString()) | |
.executes(ctx -> create(ctx.getSource(), string(ctx, "name"))) | |
) | |
.executes(ctx -> create(ctx.getSource(), "")) | |
) | |
.then(Commands.literal("create_server_team") | |
.requires(requiresOPorSP()) | |
.then(Commands.argument("name", StringArgumentType.greedyString()) | |
.executes(ctx -> createServer(ctx.getSource(), string(ctx, "name"))) | |
) | |
) | |
.then(Commands.literal("delete") | |
.then(Commands.argument("team", FTBTeamsAPI.INSTANCE.argument()) | |
.requires(requiresOPorSP()) | |
.executes(ctx -> team(ctx, "team").delete(ctx.getSource())) | |
) | |
.executes(ctx -> teamAsOwner(ctx).delete(ctx.getSource())) | |
) | |
.then(Commands.literal("settings") | |
.then(Commands.argument("key", new TeamPropertyArgument()) | |
.then(Commands.argument("value", StringArgumentType.greedyString()) | |
.executes(ctx -> teamAsOwner(ctx).settings(ctx.getSource(), ctx.getArgument("key", TeamProperty.class), string(ctx, "value"))) | |
) | |
.executes(ctx -> team(ctx).settings(ctx.getSource(), ctx.getArgument("key", TeamProperty.class), "")) | |
) | |
) | |
.then(Commands.literal("settings_for") | |
.requires(requiresOPorSP()) | |
.then(Commands.argument("team", FTBTeamsAPI.INSTANCE.argument()) | |
.then(Commands.argument("key", new TeamPropertyArgument()) | |
.then(Commands.argument("value", StringArgumentType.greedyString()) | |
.executes(ctx -> team(ctx, "team").settings(ctx.getSource(), ctx.getArgument("key", TeamProperty.class), string(ctx, "value"))) | |
) | |
.executes(ctx -> team(ctx, "team").settings(ctx.getSource(), ctx.getArgument("key", TeamProperty.class), "")) | |
) | |
) | |
) | |
.then(Commands.literal("join") | |
.then(Commands.argument("team", FTBTeamsAPI.INSTANCE.argument()) | |
.executes(ctx -> team(ctx, "team").join(ctx.getSource())) | |
) | |
) | |
.then(Commands.literal("leave") | |
.executes(ctx -> team(ctx).leave(ctx.getSource())) | |
) | |
.then(Commands.literal("invite") | |
.then(Commands.argument("players", EntityArgument.players()) | |
.executes(ctx -> teamAsOwner(ctx).invite(ctx.getSource(), EntityArgument.getPlayers(ctx, "players"))) | |
) | |
) | |
.then(Commands.literal("request_invite") | |
.then(Commands.argument("team", FTBTeamsAPI.INSTANCE.argument()) | |
.executes(ctx -> team(ctx, "team").requestInvite(ctx.getSource())) | |
) | |
) | |
.then(Commands.literal("kick") | |
.then(Commands.argument("players", GameProfileArgument.gameProfile()) | |
.executes(ctx -> teamAsOwner(ctx).kick(ctx.getSource(), GameProfileArgument.getGameProfiles(ctx, "players"))) | |
) | |
) | |
.then(Commands.literal("transfer_ownership") | |
.then(Commands.argument("player", EntityArgument.player()) | |
.executes(ctx -> teamAsOwner(ctx).transferOwnership(ctx.getSource(), EntityArgument.getPlayer(ctx, "player"))) | |
) | |
) | |
.then(Commands.literal("info") | |
.then(Commands.argument("team", FTBTeamsAPI.INSTANCE.argument()) | |
.executes(ctx -> team(ctx, "team").info(ctx.getSource())) | |
) | |
.executes(ctx -> team(ctx).info(ctx.getSource())) | |
) | |
.then(Commands.literal("list") | |
.executes(ctx -> list(ctx.getSource())) | |
) | |
.executes(ctx -> team(ctx).gui(ctx.getSource())) | |
); | |
//dispatcher.register(Commands.literal("ftbteam").redirect(command)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment