本文整理汇总了Java中org.cubeengine.libcube.service.command.parser.PlayerList.isAll方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerList.isAll方法的具体用法?Java PlayerList.isAll怎么用?Java PlayerList.isAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cubeengine.libcube.service.command.parser.PlayerList
的用法示例。
在下文中一共展示了PlayerList.isAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: kick
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(desc = "Kicks a player from the server")
public void kick(CommandSource context, PlayerList players, @Optional @Greed(INFINITE) String reason)
{
reason = parseReason(reason, module.perms().COMMAND_KICK_NOREASON, context);
if (players.isAll())
{
ensurePermission(context, module.perms().COMMAND_KICK_ALL);
for (Player toKick : Sponge.getServer().getOnlinePlayers())
{
if (!context.equals(toKick))
{
toKick.kick(Text.of(NEGATIVE,i18n.getTranslation(toKick, kickMessage),"\n\n", reason));
}
}
return;
}
for (Player user : players.list())
{
user.kick(Text.of(NEGATIVE, i18n.getTranslation(user, kickMessage),"\n\n", reason));
bc.broadcastTranslatedWithPerm(NEGATIVE, "{user} was kicked from the server by {user}!",
module.perms().KICK_RECEIVEMESSAGE.getId(), user, context);
}
bc.broadcastMessageWithPerm(NONE, reason, module.perms().KICK_RECEIVEMESSAGE.getId());
}
示例2: kill
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(alias = "slay", desc = "Kills a player")
public void kill(CommandSource context, @Default(UserListInSight.class) PlayerList players,
@Flag boolean force, @Flag boolean quiet, @Flag boolean lightning)
{
lightning = lightning && context.hasPermission(COMMAND_KILL_LIGHTNING.getId());
force = force && context.hasPermission(COMMAND_KILL_FORCE.getId());
quiet = quiet && context.hasPermission(COMMAND_KILL_QUIET.getId());
List<String> killed = new ArrayList<>();
Collection<Player> userList = players.list();
if (players.isAll())
{
if (!context.hasPermission(COMMAND_KILL_ALL.getId()))
{
i18n.send(context, NEGATIVE, "You are not allowed to kill everyone!");
return;
}
if (context instanceof Player)
{
userList.remove(context);
}
}
for (Player user : userList)
{
if (this.kill(user, lightning, context, false, force, quiet))
{
killed.add(user.getName());
}
}
if (killed.isEmpty())
{
i18n.send(context, NEUTRAL, "No one was killed!");
return;
}
i18n.send(context, POSITIVE, "You killed {user#list}!", StringUtils.implode(",", killed));
}
示例3: clearPassword
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(alias = "clearpw", desc = "Clears your password.")
public void clearPassword(CommandSource context,
@Optional @Desc("* or a list of Players delimited by ,") PlayerList players)
{
if (players == null)
{
if (!(context instanceof Player))
{
throw new TooFewArgumentsException();
}
module.resetPassword(((Player)context).getUniqueId());
i18n.send(context, POSITIVE, "Your password has been reset!");
return;
}
if (players.isAll())
{
if (!context.hasPermission(module.perms().COMMAND_CLEARPASSWORD_ALL.getId()))
{
throw new PermissionDeniedException(module.perms().COMMAND_CLEARPASSWORD_ALL);
}
module.resetAllPasswords();
i18n.send(context, POSITIVE, "All passwords reset!");
return;
}
if (!context.hasPermission(module.perms().COMMAND_CLEARPASSWORD_OTHER.getId()))
{
throw new PermissionDeniedException(module.perms().COMMAND_CLEARPASSWORD_OTHER);
}
for (Player user : players.list())
{
module.resetPassword(user.getUniqueId());
i18n.send(context, POSITIVE, "{user}'s password has been reset!", user.getName());
}
}
示例4: feed
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(desc = "Refills your hunger bar")
public void feed(CommandSource context, @Optional PlayerList players)
{
if (players == null)
{
if (!(context instanceof Player))
{
i18n.send(context, NEGATIVE, "Don't feed the troll!");
return;
}
User sender = (User)context;
sender.offer(Keys.FOOD_LEVEL, 20);
sender.offer(Keys.SATURATION, 20.0);
sender.offer(Keys.EXHAUSTION, 0.0);
i18n.send(context, POSITIVE, "You are now fed!");
return;
}
if (!context.hasPermission(COMMAND_FEED_OTHER.getId()))
{
i18n.send(context, NEGATIVE, "You are not allowed to feed other players!");
return;
}
Collection<Player> userList = players.list();
if (players.isAll())
{
if (userList.isEmpty())
{
i18n.send(context, NEGATIVE, "There are no players online at the moment!");
}
i18n.send(context, POSITIVE, "You made everyone fat!");
bc.broadcastStatus(NONE.color(GREEN), "shared food with everyone.", context);
}
else
{
i18n.send(context, POSITIVE, "Fed {amount} players!", userList.size());
}
for (Player user : userList)
{
if (!players.isAll())
{
i18n.send(user, POSITIVE, "You got fed by {user}!", context);
}
user.offer(Keys.FOOD_LEVEL, 20);
user.offer(Keys.SATURATION, 20.0);
user.offer(Keys.EXHAUSTION, 0.0);
}
}
示例5: starve
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(desc = "Empties the hunger bar")
public void starve(CommandSource context, @Optional PlayerList players)
{
if (players == null)
{
if (!(context instanceof Player))
{
context.sendMessage(Text.of("\n\n\n\n\n\n\n\n\n\n\n\n\n"));
i18n.send(context, NEGATIVE, "I'll give you only one line to eat!");
return;
}
User sender = (User)context;
sender.offer(Keys.FOOD_LEVEL, 0);
sender.offer(Keys.SATURATION, 0.0);
sender.offer(Keys.EXHAUSTION, 4.0);
i18n.send(context, NEGATIVE, "You are now starving!");
return;
}
if (!context.hasPermission(COMMAND_STARVE_OTHER.getId()))
{
i18n.send(context, NEGATIVE, "You are not allowed to let other players starve!");
return;
}
Collection<Player> userList = players.list();
if (players.isAll())
{
if (userList.isEmpty())
{
i18n.send(context, NEGATIVE, "There are no players online at the moment!");
return;
}
i18n.send(context, NEUTRAL, "You let everyone starve to death!");
bc.broadcastStatus(ChatFormat.YELLOW + "took away all food.", context);
}
else
{
i18n.send(context, POSITIVE, "Starved {amount} players!", userList.size());
}
for (Player user : userList)
{
if (!players.isAll())
{
i18n.send(user, NEUTRAL, "You are suddenly starving!");
}
user.offer(Keys.FOOD_LEVEL, 0);
user.offer(Keys.SATURATION, 0.0);
user.offer(Keys.EXHAUSTION, 4.0);
}
}
示例6: heal
import org.cubeengine.libcube.service.command.parser.PlayerList; //导入方法依赖的package包/类
@Command(desc = "Heals a player")
public void heal(CommandSource context, @Optional PlayerList players)
{
if (players == null)
{
if (!(context instanceof Player))
{
i18n.send(context, NEGATIVE, "Only time can heal your wounds!");
return;
}
Player sender = (Player)context;
sender.offer(Keys.HEALTH, sender.get(Keys.MAX_HEALTH).get());
i18n.send(sender, POSITIVE, "You are now healed!");
return;
}
if (!context.hasPermission(COMMAND_HEAL_OTHER.getId()))
{
i18n.send(context, NEGATIVE, "You are not allowed to heal other players!");
return;
}
Collection<Player> userList = players.list();
if (players.isAll())
{
if (userList.isEmpty())
{
i18n.send(context, NEGATIVE, "There are no players online at the moment!");
return;
}
i18n.send(context, POSITIVE, "You healed everyone!");
bc.broadcastStatus(ChatFormat.BRIGHT_GREEN + "healed every player.", context);
}
else
{
i18n.send(context, POSITIVE, "Healed {amount} players!", userList.size());
}
for (Player user : userList)
{
if (!players.isAll())
{
i18n.send(user, POSITIVE, "You got healed by {sender}!", context);
}
user.offer(Keys.HEALTH, user.get(Keys.MAX_HEALTH).get());
}
}