当前位置: 首页>>代码示例>>Java>>正文


Java CommandContext.getRemainingString方法代码示例

本文整理汇总了Java中com.sk89q.minecraft.util.commands.CommandContext.getRemainingString方法的典型用法代码示例。如果您正苦于以下问题:Java CommandContext.getRemainingString方法的具体用法?Java CommandContext.getRemainingString怎么用?Java CommandContext.getRemainingString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.minecraft.util.commands.CommandContext的用法示例。


在下文中一共展示了CommandContext.getRemainingString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: play

import com.sk89q.minecraft.util.commands.CommandContext; //导入方法依赖的package包/类
@Command(
    aliases = { "play", "replay" },
    desc = "Play a game",
    usage = "[game]",
    min = 0,
    max = -1
)
public List<String> play(final CommandContext args, final CommandSender sender) throws CommandException {
    final String name = args.argsLength() > 0 ? args.getRemainingString(0) : "";
    if(args.getSuggestionContext() != null) {
        return StringUtils.complete(name, ticketBooth.allGames(sender).stream().map(Game::name));
    }

    ticketBooth.playGame(CommandUtils.senderToPlayer(sender), name);
    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:TicketCommands.java

示例2: watch

import com.sk89q.minecraft.util.commands.CommandContext; //导入方法依赖的package包/类
@Command(
    aliases = { "watch" },
    desc = "Spectate a game",
    usage = "[game]",
    min = 0,
    max = -1
)
public List<String> watch(final CommandContext args, final CommandSender sender) throws CommandException {
    final String name = args.argsLength() > 0 ? args.getRemainingString(0) : "";
    if(args.getSuggestionContext() != null) {
        return StringUtils.complete(name, ticketBooth.allGames(sender).stream().map(Game::name));
    }

    ticketBooth.watchGame(CommandUtils.senderToPlayer(sender), name);
    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:17,代码来源:TicketCommands.java

示例3: create

import com.sk89q.minecraft.util.commands.CommandContext; //导入方法依赖的package包/类
public void create(CommandContext args, CommandSender sender, @Nullable Type type, @Nullable Duration duration) throws CommandException {
    final User punisher = userFinder.getLocalUser(sender);
    final String reason = args.getRemainingString(duration == null ? 1 : 2);
    final boolean auto = flag('a', args, sender);
    final boolean silent = flag('s', args, sender);
    final boolean offrecord = flag('o', args, sender);
    if(permission(sender, type)) {
        syncExecutor.callback(
            userFinder.findUser(sender, args, 0),
            response -> {
                punishmentCreator.create(
                    punisher,
                    response.user,
                    reason,
                    type,
                    duration,
                    silent,
                    auto,
                    offrecord
                );
            }
        );
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:25,代码来源:PunishmentCommands.java


注:本文中的com.sk89q.minecraft.util.commands.CommandContext.getRemainingString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。