org.bukkit.Bukkit.getBannedPlayers()方法的使用及代码示例

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

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

Bukkit.getBannedPlayers介绍

暂无

代码示例

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

@Override
  public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1) {
      List<String> completions = new ArrayList<String>();
      for (OfflinePlayer player : Bukkit.getBannedPlayers()) {
        String name = player.getName();
        if (StringUtil.startsWithIgnoreCase(name, args[0])) {
          completions.add(name);
        }
      }
      return completions;
    }
    return ImmutableList.of();
  }
}

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

@Override
  public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1) {
      List<String> completions = new ArrayList<String>();
      for (OfflinePlayer player : Bukkit.getBannedPlayers()) {
        String name = player.getName();
        if (StringUtil.startsWithIgnoreCase(name, args[0])) {
          completions.add(name);
        }
      }
      return completions;
    }
    return ImmutableList.of();
  }
}

代码示例来源:origin: Rsl1122/Plan-PlayerAnalytics

@Override
  public List<UserImportData> getUserImportData() {
    List<UserImportData> dataList = new ArrayList<>();

    Set<OfflinePlayer> operators = Bukkit.getOperators();
    Set<OfflinePlayer> banned = Bukkit.getBannedPlayers();

    Arrays.stream(Bukkit.getOfflinePlayers()).parallel().forEach(player -> {
      UserImportData.UserImportDataBuilder builder = UserImportData.builder(serverUUID.get());
      builder.name(player.getName())
          .uuid(player.getUniqueId())
          .registered(player.getFirstPlayed());

      if (operators.contains(player)) {
        builder.op();
      }

      if (banned.contains(player)) {
        builder.banned();
      }

      dataList.add(builder.build());
    });

    return dataList;
  }
}

相关文章