本文整理汇总了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;
}
示例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;
}
示例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
);
}
);
}
}