コード例 #1
0
  @Override
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    final Collection<OfflinePlayer> players = Bukkit.getWhitelistedPlayers();

    for (final OfflinePlayer player : players) {
      player.setWhitelisted(false);
    }

    sender.sendMessage(messages.evalTemplate("remove", ImmutableMap.of("count", players.size())));
    return true;
  }
コード例 #2
0
ファイル: RequestListCommand.java プロジェクト: Eluinhost/UHC
  @Override
  public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    final List<TeamRequest> requests = requestManager.getRequests();

    if (requests.size() == 0) {
      sender.sendMessage(messages.getRaw("no requests"));
      return true;
    }

    for (final TeamRequest request : requests) {
      final Map<String, Object> context =
          ImmutableMap.<String, Object>builder()
              .put("id", request.getId())
              .put("name", request.getOwnerName())
              .put("members", Joiner.on(", ").join(request.getOthers()))
              .build();

      sender.sendMessage(messages.evalTemplate("list request", context));
    }

    return true;
  }