Skip to content

Instantly share code, notes, and snippets.

@Lomeli12
Created March 3, 2019 05:12
Show Gist options
  • Save Lomeli12/5342b12f44d14fa2e59472dd168fe863 to your computer and use it in GitHub Desktop.
Save Lomeli12/5342b12f44d14fa2e59472dd168fe863 to your computer and use it in GitHub Desktop.
What the hell did I just write?
@Override
public void accept(CommandDispatcher<ServerCommandSource> commandDispatcher) {
commandDispatcher.register(ServerCommandManager.literal(getName()).requires(
(commandSource) -> commandSource.hasPermissionLevel(2))
.then(ServerCommandManager.literal("all")
.executes((commandContext) -> removePlayersSlots(commandContext.getSource(), null,
InventoryUtils.MAX_SLOTS))
.then(ServerCommandManager.argument("targets", GameProfileArgumentType.create())
.executes((commandContext) -> removePlayersSlots(commandContext.getSource(),
GameProfileArgumentType.getProfilesArgument(commandContext, "targets"),
InventoryUtils.MAX_SLOTS))))
.then(ServerCommandManager.argument("amount", IntegerArgumentType.integer(1, InventoryUtils.MAX_SLOTS))
.executes((commandContext) -> removePlayersSlots(commandContext.getSource(), null,
IntegerArgumentType.getInteger(commandContext, "amount")))
.then(ServerCommandManager.argument("targets", GameProfileArgumentType.create())
.executes((commandContext) -> removePlayersSlots(commandContext.getSource(),
GameProfileArgumentType.getProfilesArgument(commandContext, "targets"),
IntegerArgumentType.getInteger(commandContext, "amount")))))
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment