當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerList.isAll方法代碼示例

本文整理匯總了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());
}
 
開發者ID:CubeEngine,項目名稱:modules-main,代碼行數:25,代碼來源:KickBanCommands.java

示例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));
}
 
開發者ID:CubeEngine,項目名稱:modules-main,代碼行數:36,代碼來源:KillCommands.java

示例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());
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-extra,代碼行數:35,代碼來源:AuthCommands.java

示例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);
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-main,代碼行數:48,代碼來源:FoodCommands.java

示例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);
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-main,代碼行數:50,代碼來源:FoodCommands.java

示例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());
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-main,代碼行數:45,代碼來源:HealCommand.java


注:本文中的org.cubeengine.libcube.service.command.parser.PlayerList.isAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。