org.bukkit.Server.getWhitelistedPlayers()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.bukkit.Server.getWhitelistedPlayers()方法的一些代码示例,展示了Server.getWhitelistedPlayers()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getWhitelistedPlayers()方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getWhitelistedPlayers

Server.getWhitelistedPlayers介绍

[英]Gets a list of whitelisted players.
[中]获取白名单玩家的列表。

代码示例

代码示例来源:origin: Bukkit/Bukkit

/**
 * @see Server#getWhitelistedPlayers()
 */
public static Set<OfflinePlayer> getWhitelistedPlayers() {
  return server.getWhitelistedPlayers();
}

代码示例来源:origin: GlowstoneMC/Glowstone

@Override
  public List<String> tabComplete(CommandSender sender, String alias, String[] args)
      throws IllegalArgumentException {
    if (args.length == 1) {
      return (List) StringUtil
          .copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList(SUBCOMMANDS.size()));
    }
    if (args.length > 1) {
      String subcommand = args[0];
      if (subcommand.equals("add")) {
        return super.tabComplete(sender, alias, args);
      }
      if (subcommand.equals("remove")) {
        Set<OfflinePlayer> whitelistedPlayers = sender.getServer().getWhitelistedPlayers();
        List<String> names = whitelistedPlayers.stream().map(OfflinePlayer::getName)
            .collect(Collectors.toList());
        return (List) StringUtil
            .copyPartialMatches(args[1], names, new ArrayList(names.size()));
      }
      return Collections.emptyList();
    }
    return super.tabComplete(sender, alias, args);
  }
}

代码示例来源:origin: GlowstoneMC/Glowstone

Set<OfflinePlayer> whitelistedPlayers = sender.getServer().getWhitelistedPlayers();
String[] names = new String[whitelistedPlayers.size()];
int i = 0;

代码示例来源:origin: SpigotMC/Spigot-API

/**
 * @see Server#getWhitelistedPlayers()
 */
public static Set<OfflinePlayer> getWhitelistedPlayers() {
  return server.getWhitelistedPlayers();
}

代码示例来源:origin: EngineHub/CommandHelper

@Override
public List<MCOfflinePlayer> getWhitelistedPlayers() {
  List<MCOfflinePlayer> list = new ArrayList<>();
  for(OfflinePlayer p : s.getWhitelistedPlayers()) {
    list.add(new BukkitMCOfflinePlayer(p));
  }
  return list;
}

代码示例来源:origin: TotalFreedom/TotalFreedomMod

msg("Whitelisted players: " + FUtil.playerListToNames(server.getWhitelistedPlayers()));
return true;
int totalWPs = 0;
for (OfflinePlayer player : server.getWhitelistedPlayers())

相关文章

Server类方法