net.minecraft.server.command.ServerCommandSource Java Examples

The following examples show how to use net.minecraft.server.command.ServerCommandSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerCommand.java    From fabric-carpet with MIT License 7 votes vote down vote up
private static int shadow(CommandContext<ServerCommandSource> context)
{
    ServerPlayerEntity player = getPlayer(context);
    if (player instanceof EntityPlayerMPFake)
    {
        Messenger.m(context.getSource(), "r Cannot shadow fake players");
        return 0;
    }
    ServerPlayerEntity sendingPlayer = null;
    try
    {
        sendingPlayer = context.getSource().getPlayer();
    }
    catch (CommandSyntaxException ignored) { }

    if (sendingPlayer!=player && cantManipulate(context)) return 0;
    EntityPlayerMPFake.createShadow(player.server, player);
    return 1;
}
 
Example #2
Source File: GalacticraftCommands.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private static int teleport(CommandContext<ServerCommandSource> context) {
    try {
        ServerWorld serverWorld = DimensionArgumentType.getDimensionArgument(context, "dimension");
        if (serverWorld == null) {
            context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.dimension").setStyle(Style.EMPTY.withColor(Formatting.RED)));
            return -1;
        }

        context.getSource().getPlayer().changeDimension(serverWorld);
        context.getSource().sendFeedback(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.success.single", serverWorld.getRegistryKey().getValue()), true);

    } catch (CommandSyntaxException ignore) {
        context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.entity").setStyle(Style.EMPTY.withColor(Formatting.RED)));
        return -1;
    }
    return -1;
}
 
Example #3
Source File: CarpetEventServer.java    From fabric-carpet with MIT License 6 votes vote down vote up
public void call(Supplier<List<LazyValue>> argumentSupplier, Supplier<ServerCommandSource> cmdSourceSupplier)
{
    if (callList.size() > 0)
    {
        List<LazyValue> argv = argumentSupplier.get(); // empty for onTickDone
        ServerCommandSource source = cmdSourceSupplier.get();
        assert argv.size() == reqArgs;
        List<Callback> fails = new ArrayList<>();
        for (Callback call: callList)
        {
            if (!CarpetServer.scriptServer.runas(source, call.host, call.function, argv))
                fails.add(call);
        }
        for (Callback call : fails) callList.remove(call);
    }
}
 
Example #4
Source File: CarpetScriptHost.java    From fabric-carpet with MIT License 6 votes vote down vote up
public Value callUDF(BlockPos pos, ServerCommandSource source, FunctionValue fun, List<LazyValue> argv) throws InvalidCallbackException
{
    if (CarpetServer.scriptServer.stopAll)
        return Value.NULL;
    if (argv.size() != fun.getArguments().size())
    {
        throw new InvalidCallbackException();
    }
    try
    {
        // TODO: this is just for now - invoke would be able to invoke other hosts scripts
        Context context = new CarpetContext(this, source, pos);
        return fun.getExpression().evalValue(
                () -> fun.lazyEval(context, Context.VOID, fun.getExpression(), fun.getToken(), argv),
                context,
                Context.VOID);
    }
    catch (ExpressionException e)
    {
        handleExpressionException("Callback failed", e);
    }
    return Value.NULL;
}
 
Example #5
Source File: MixinPlayerChat_MeCommand.java    From Galaxy with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("UnresolvedMixinReference")
@Inject(
    method = "method_13238",
    at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V",
        ordinal = 0
    ),
    locals = LocalCapture.CAPTURE_FAILSOFT
)
private static void onCommand(CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> cir, TranslatableText translatableText, Entity entity) {
    if (!(entity instanceof ServerPlayerEntity)) return;

    Main main = Main.Companion.getMain();
    ServerPlayerEntity player = (ServerPlayerEntity) entity;

    if (main == null || !main.getEventManager().emit(new PlayerChatEvent(player, translatableText)).getCancel()) {
        player.server.getPlayerManager().broadcastChatMessage(translatableText, MessageType.CHAT, entity.getUuid());
    } else {
        cir.setReturnValue(0);
        cir.cancel();
        player.server.sendSystemMessage(translatableText.append(" (Canceled)"), entity.getUuid());
    }
}
 
Example #6
Source File: LogCommand.java    From fabric-carpet with MIT License 6 votes vote down vote up
private static int subscribePlayer(ServerCommandSource source, String player_name, String logname, String option)
{
    PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
    if (player == null)
    {
        Messenger.m(source, "r No player specified");
        return 0;
    }
    if (LoggerRegistry.getLogger(logname) == null)
    {
        Messenger.m(source, "r Unknown logger: ","rb "+logname);
        return 0;
    }
    LoggerRegistry.subscribePlayer(player_name, logname, option);
    if (option!=null)
    {
        Messenger.m(source, "gi Subscribed to " + logname + "(" + option + ")");
    }
    else
    {
        Messenger.m(source, "gi Subscribed to " + logname);
    }
        return 1;
}
 
Example #7
Source File: TickSpeed.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static BaseText tickrate_advance(ServerPlayerEntity player, int advance, String callback, ServerCommandSource source)
{
    if (0 == advance)
    {
        tick_warp_callback = null;
        if (source != tick_warp_sender) tick_warp_sender = null;
        finish_time_warp();
        tick_warp_sender = null;
        return Messenger.c("gi Warp interrupted");
    }
    if (time_bias > 0)
    {
        String who = "Another player";
        if (time_advancerer != null) who = time_advancerer.getEntityName();
        return Messenger.c("l "+who+" is already advancing time at the moment. Try later or ask them");
    }
    time_advancerer = player;
    time_warp_start_time = System.nanoTime();
    time_warp_scheduled_ticks = advance;
    time_bias = advance;
    tick_warp_callback = callback;
    tick_warp_sender = source;
    return Messenger.c("gi Warp speed ....");
}
 
Example #8
Source File: SettingsManager.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static boolean canUseCommand(ServerCommandSource source, String commandLevel)
{
    switch (commandLevel)
    {
        case "true": return true;
        case "false": return false;
        case "ops": return source.hasPermissionLevel(2); // typical for other cheaty commands
        case "0":
        case "1":
        case "2":
        case "3":
        case "4":
            return source.hasPermissionLevel(Integer.parseInt(commandLevel));
    }
    return false;
}
 
Example #9
Source File: PlayerCommand.java    From fabric-carpet with MIT License 6 votes vote down vote up
private static boolean cantSpawn(CommandContext<ServerCommandSource> context)
{
    String playerName = StringArgumentType.getString(context, "player");
    MinecraftServer server = context.getSource().getMinecraftServer();
    PlayerManager manager = server.getPlayerManager();
    PlayerEntity player = manager.getPlayer(playerName);
    if (player != null)
    {
        Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r  is already logged on");
        return true;
    }
    GameProfile profile = server.getUserCache().findByName(playerName);
    if (manager.getUserBanList().contains(profile))
    {
        Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r  is banned");
        return true;
    }
    if (manager.isWhitelistEnabled() && profile != null && manager.isWhitelisted(profile) && !context.getSource().hasPermissionLevel(2))
    {
        Messenger.m(context.getSource(), "r Whitelisted players can only be spawned by operators");
        return true;
    }
    return false;
}
 
Example #10
Source File: TickCommand.java    From fabric-carpet with MIT License 6 votes vote down vote up
private static int setWarp(ServerCommandSource source, int advance, String tail_command)
{
    ServerPlayerEntity player = null;
    try
    {
        player = source.getPlayer();
    }
    catch (CommandSyntaxException ignored)
    {
    }
    BaseText message = TickSpeed.tickrate_advance(player, advance, tail_command, source);
    if (message != null)
    {
        source.sendFeedback(message, false);
    }
    return 1;
}
 
Example #11
Source File: TickCommand.java    From fabric-carpet with MIT License 6 votes vote down vote up
private static int toggleFreeze(ServerCommandSource source, boolean isDeep)
{
    TickSpeed.is_paused = !TickSpeed.is_paused;
    if (TickSpeed.is_paused)
    {
        TickSpeed.deepFreeze = isDeep;
        Messenger.m(source, "gi Game is "+(isDeep?"deeply ":"")+"frozen");

    }
    else
    {
        TickSpeed.deepFreeze = false;
        Messenger.m(source, "gi Game runs normally");
    }
    return 1;
}
 
Example #12
Source File: EntityValue.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static Collection<? extends Entity > getEntitiesFromSelector(ServerCommandSource source, String selector)
{
    try
    {
        EntitySelector entitySelector = selectorCache.get(selector);
        if (entitySelector != null)
        {
            return entitySelector.getEntities(source.withMaxLevel(4));
        }
        entitySelector = new EntitySelectorReader(new StringReader(selector), true).read();
        selectorCache.put(selector, entitySelector);
        return entitySelector.getEntities(source.withMaxLevel(4));
    }
    catch (CommandSyntaxException e)
    {
        throw new InternalExpressionException("Cannot select entities from "+selector);
    }
}
 
Example #13
Source File: CounterCommand.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
    LiteralArgumentBuilder<ServerCommandSource> literalargumentbuilder = CommandManager.literal("counter").executes((context)
     -> listAllCounters(context.getSource(), false)).requires((player) ->
            CarpetSettings.hopperCounters);

    literalargumentbuilder.
            then((CommandManager.literal("reset").executes( (p_198489_1_)->
                    resetCounter(p_198489_1_.getSource(), null))));
    for (DyeColor enumDyeColor: DyeColor.values())
    {
        String color = enumDyeColor.toString();
        literalargumentbuilder.
                then((CommandManager.literal(color).executes( (p_198489_1_)-> displayCounter(p_198489_1_.getSource(), color, false))));
        literalargumentbuilder.then(CommandManager.literal(color).
                then(CommandManager.literal("reset").executes((context) ->
                        resetCounter(context.getSource(), color))));
        literalargumentbuilder.then(CommandManager.literal(color).
                then(CommandManager.literal("realtime").executes((context) ->
                        displayCounter(context.getSource(), color, true))));
    }
    dispatcher.register(literalargumentbuilder);
}
 
Example #14
Source File: CarpetSettings.java    From fabric-carpet with MIT License 6 votes vote down vote up
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
    if (source == null) return newValue;
    if (newValue < 0 || newValue > 32)
    {
        Messenger.m(source, "r spawn chunk size has to be between 0 and 32");
        return null;
    }
    if (currentRule.get().intValue() == newValue.intValue())
    {
        //must been some startup thing
        return newValue;
    }
    if (CarpetServer.minecraft_server == null) return newValue;
    ServerWorld currentOverworld = CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD);
    if (currentOverworld != null)
    {
        changeSpawnSize(newValue);
    }
    return newValue;
}
 
Example #15
Source File: CarpetExpression.java    From fabric-carpet with MIT License 6 votes vote down vote up
/**
 * <h1>.</h1>
 * @param expression expression
 * @param source source
 * @param origin origin
 */
public CarpetExpression(Module module, String expression, ServerCommandSource source, BlockPos origin)
{
    this.origin = origin;
    this.source = source;
    this.expr = new Expression(expression);
    this.expr.asAModule(module);


    API_BlockManipulation();
    API_EntityManipulation();
    API_InventoryManipulation();
    API_IteratingOverAreasOfBlocks();
    API_AuxiliaryAspects();
    API_Scoreboard();
    API_Interapperability();
}
 
Example #16
Source File: GalacticraftCommands.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
public static void register() {
    CommandRegistrationCallback.EVENT.register((commandDispatcher, b) -> {
        commandDispatcher.register(LiteralArgumentBuilder.<ServerCommandSource>literal("dimensiontp")
                .requires(serverCommandSource -> serverCommandSource.hasPermissionLevel(2))
                .then(CommandManager.argument("dimension", DimensionArgumentType.dimension())
                        .executes(GalacticraftCommands::teleport)
                        .then(CommandManager.argument("entities", EntityArgumentType.entities())
                                .executes(((GalacticraftCommands::teleportMultiple))))));
        commandDispatcher.register(LiteralArgumentBuilder.<ServerCommandSource>literal("gcr_listbodies")
                .executes(context -> {
                    StringBuilder builder = new StringBuilder();
                    CelestialBodyType.getAll().forEach(celestialBodyType -> builder.append(celestialBodyType.getTranslationKey()).append("\n"));
                    context.getSource().sendFeedback(new LiteralText(builder.toString()), true);
                    return 1;
                }));
    });
}
 
Example #17
Source File: GalacticraftCommands.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
private static int teleportMultiple(CommandContext<ServerCommandSource> context) {
    try {
        ServerWorld serverWorld = DimensionArgumentType.getDimensionArgument(context, "dimension");
        if (serverWorld == null) {
            context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.dimension").setStyle(Style.EMPTY.withColor(Formatting.RED)));
            return -1;
        }

        Collection<? extends Entity> entities = EntityArgumentType.getEntities(context, "entities");
        entities.forEach((Consumer<Entity>) entity -> {
            entity.changeDimension(serverWorld);
            context.getSource().sendFeedback(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.success.multiple", entities.size(), serverWorld.getRegistryKey().getValue()), true);
        });
    } catch (CommandSyntaxException ignore) {
        context.getSource().sendError(new TranslatableText("commands.galacticraft-rewoven.dimensiontp.failure.entity").setStyle(Style.EMPTY.withColor(Formatting.RED)));
        return -1;
    }
    return -1;
}
 
Example #18
Source File: SettingsManager.java    From fabric-carpet with MIT License 5 votes vote down vote up
private int removeDefault(ServerCommandSource source, ParsedRule<?> rule)
{
    if (locked) return 0;
    if (!rules.containsKey(rule.name)) return 0;
    Pair<Map<String, String>,Boolean> conf = readSettingsFromConf();
    conf.getLeft().remove(rule.name);
    writeSettingsToConf(conf.getLeft());
    rules.get(rule.name).resetToDefault(source);
    Messenger.m(source ,"gi "+String.format(tr("ui.rule_%(rule)s_not_set_restart","Rule %s will now not be set on restart"), rule.translatedName()));
    return 1;
}
 
Example #19
Source File: CameraModeCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static boolean iCanHasPermissions(ServerCommandSource source, ServerPlayerEntity player)
{
    try
    {
        return source.hasPermissionLevel(2) || source.getPlayer() == player;
    }
    catch (CommandSyntaxException e)
    {
        return true; // shoudn't happen because server has all permissions anyways
    }
}
 
Example #20
Source File: SettingsManager.java    From fabric-carpet with MIT License 5 votes vote down vote up
private int setDefault(ServerCommandSource source, ParsedRule<?> rule, String stringValue)
{
    if (locked) return 0;
    if (!rules.containsKey(rule.name)) return 0;
    Pair<Map<String, String>,Boolean> conf = readSettingsFromConf();
    conf.getLeft().put(rule.name, stringValue);
    writeSettingsToConf(conf.getLeft()); // this may feels weird, but if conf
    // is locked, it will never reach this point.
    rule.set(source,stringValue);
    Messenger.m(source ,"gi "+String.format(tr("ui.rule_%(rule)s_will_now_default_to_%(value)s","Rule %s will now default to %s"), rule.translatedName(), stringValue));
    return 1;
}
 
Example #21
Source File: LogCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static int unsubFromAll(ServerCommandSource source, String player_name)
{
    PlayerEntity player = source.getMinecraftServer().getPlayerManager().getPlayer(player_name);
    if (player == null)
    {
        Messenger.m(source, "r No player specified");
        return 0;
    }
    for (String logname : LoggerRegistry.getLoggerNames())
    {
        LoggerRegistry.unsubscribePlayer(player_name, logname);
    }
    Messenger.m(source, "gi Unsubscribed from all logs");
    return 1;
}
 
Example #22
Source File: PlayerCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static LiteralArgumentBuilder<ServerCommandSource> makeActionCommand(String actionName, EntityPlayerActionPack.ActionType type)
{
    return literal(actionName)
            .executes(c -> action(c, type, EntityPlayerActionPack.Action.once()))
            .then(literal("once").executes(c -> action(c, type, EntityPlayerActionPack.Action.once())))
            .then(literal("continuous").executes(c -> action(c, type, EntityPlayerActionPack.Action.continuous())))
            .then(literal("interval").then(argument("ticks", IntegerArgumentType.integer(2))
                    .executes(c -> action(c, type, EntityPlayerActionPack.Action.interval(IntegerArgumentType.getInteger(c, "ticks"))))));
}
 
Example #23
Source File: Validator.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string)
{
    if (CarpetServer.settingsManager != null && source != null)
        CarpetServer.settingsManager.notifyPlayersCommandsChanged();
    return newValue;
}
 
Example #24
Source File: ParsedRule.java    From fabric-carpet with MIT License 5 votes vote down vote up
ParsedRule<T> set(ServerCommandSource source, T value, String stringValue)
{
    try
    {
        for (Validator<T> validator : this.validators)
        {
            value = validator.validate(source, this, value, stringValue);
            if (value == null)
            {
                if (source != null)
                {
                    Messenger.m(source, "r Wrong value for " + name + ": " + stringValue);
                    if (validator.description() != null)
                        Messenger.m(source, "r " + validator.description());
                }
                return null;
            }
        }
        if (!value.equals(get()) || source == null)
        {
            this.field.set(null, value);
            if (source != null) CarpetServer.settingsManager.notifyRuleChanged(source, this, stringValue);
        }
    }
    catch (IllegalAccessException e)
    {
        Messenger.m(source, "r Unable to access setting for  "+name);
        return null;
    }
    return this;
}
 
Example #25
Source File: ScriptCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static int invoke(CommandContext<ServerCommandSource> context, String call, BlockPos pos1, BlockPos pos2,  String args)
{
    ServerCommandSource source = context.getSource();
    CarpetScriptHost host = getHost(context);
    if (call.startsWith("__"))
    {
        Messenger.m(source, "r Hidden functions are only callable in scripts");
        return 0;
    }
    List<Integer> positions = new ArrayList<>();
    if (pos1 != null)
    {
        positions.add(pos1.getX());
        positions.add(pos1.getY());
        positions.add(pos1.getZ());
    }
    if (pos2 != null)
    {
        positions.add(pos2.getX());
        positions.add(pos2.getY());
        positions.add(pos2.getZ());
    }
    //if (!(args.trim().isEmpty()))
    //    arguments.addAll(Arrays.asList(args.trim().split("\\s+")));
    handleCall(source, host, () ->  host.call(source, call, positions, args));
    return 1;
}
 
Example #26
Source File: ProfileCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
    LiteralArgumentBuilder<ServerCommandSource> literalargumentbuilder = literal("profile").
            requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandProfile)).
            executes( (c) -> healthReport(c.getSource(), 100)).
            then(literal("health").
                    executes( (c) -> healthReport(c.getSource(), 100)).
                    then(argument("ticks", integer(20,24000)).
                            executes( (c) -> healthReport(c.getSource(), getInteger(c, "ticks"))))).
            then(literal("entities").
                    executes((c) -> healthEntities(c.getSource(), 100)).
                    then(argument("ticks", integer(20,24000)).
                            executes((c) -> healthEntities(c.getSource(), getInteger(c, "ticks")))));
    dispatcher.register(literalargumentbuilder);
}
 
Example #27
Source File: PlayerCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static int stop(CommandContext<ServerCommandSource> context)
{
    if (cantManipulate(context)) return 0;
    ServerPlayerEntity player = getPlayer(context);
    ((ServerPlayerEntityInterface) player).getActionPack().stopAll();
    return 1;
}
 
Example #28
Source File: DistanceCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
{
    LiteralArgumentBuilder<ServerCommandSource> command = literal("distance").
            requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandDistance)).
            then(literal("from").
                    executes( (c) -> DistanceCalculator.setStart(c.getSource(), c.getSource().getPosition())).
                    then(argument("from", Vec3ArgumentType.vec3()).
                            executes( (c) -> DistanceCalculator.setStart(
                                    c.getSource(),
                                    Vec3ArgumentType.getVec3(c, "from"))).
                            then(literal("to").
                                    executes((c) -> DistanceCalculator.distance(
                                            c.getSource(),
                                            Vec3ArgumentType.getVec3(c, "from"),
                                            c.getSource().getPosition())).
                                    then(argument("to", Vec3ArgumentType.vec3()).
                                            executes( (c) -> DistanceCalculator.distance(
                                                    c.getSource(),
                                                    Vec3ArgumentType.getVec3(c, "from"),
                                                    Vec3ArgumentType.getVec3(c, "to")
                                            )))))).
            then(literal("to").
                    executes( (c) -> DistanceCalculator.setEnd(c.getSource(), c.getSource().getPosition()) ).
                    then(argument("to", Vec3ArgumentType.vec3()).
                            executes( (c) -> DistanceCalculator.setEnd(c.getSource(), Vec3ArgumentType.getVec3(c, "to")))));
    dispatcher.register(command);
}
 
Example #29
Source File: PlayerCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static boolean cantManipulate(CommandContext<ServerCommandSource> context)
{
    PlayerEntity player = getPlayer(context);
    if (player == null)
    {
        Messenger.m(context.getSource(), "r Can only manipulate existing players");
        return true;
    }
    PlayerEntity sendingPlayer;
    try
    {
        sendingPlayer = context.getSource().getPlayer();
    }
    catch (CommandSyntaxException e)
    {
        return false;
    }

    if (!context.getSource().getMinecraftServer().getPlayerManager().isOperator(sendingPlayer.getGameProfile()))
    {
        if (sendingPlayer != player && !(player instanceof EntityPlayerMPFake))
        {
            Messenger.m(context.getSource(), "r Non OP players can't control other real players");
            return true;
        }
    }
    return false;
}
 
Example #30
Source File: PlayerCommand.java    From fabric-carpet with MIT License 5 votes vote down vote up
private static LiteralArgumentBuilder<ServerCommandSource> makeDropCommand(String actionName, boolean dropAll)
{
    return literal(actionName)
            .then(literal("all").executes(c ->manipulate(c, ap -> ap.drop(-2,dropAll))))
            .then(literal("mainhand").executes(c ->manipulate(c, ap -> ap.drop(-1,dropAll))))
            .then(literal("offhand").executes(c ->manipulate(c, ap -> ap.drop(40,dropAll))))
            .then(argument("slot", IntegerArgumentType.integer(0, 40)).
                    executes(c ->manipulate(c, ap -> ap.drop(
                            IntegerArgumentType.getInteger(c,"slot"),
                            dropAll
                    ))));
}