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


Java PlayerUtils類代碼示例

本文整理匯總了Java中net.samagames.tools.PlayerUtils的典型用法代碼示例。如果您正苦於以下問題:Java PlayerUtils類的具體用法?Java PlayerUtils怎麽用?Java PlayerUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PlayerUtils類屬於net.samagames.tools包,在下文中一共展示了PlayerUtils類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepare

import net.samagames.tools.PlayerUtils; //導入依賴的package包/類
/**
 * Prepare a message to display a leaderboard with
 * given players and a commentary for the winner
 *
 * @param winner Winner in the leaderboard
 * @param second Second in the leaderboard
 * @param third Third in the leaderboard (can be null)
 * @param commentary Commentary
 *
 * @return Formatted lines
 */
public List<String> prepare(Player winner, Player second, Player third, String commentary)
{
    List<String> lines = new ArrayList<>();
    lines.add(ChatUtils.getCenteredText(ChatColor.GREEN + "Gagnant" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(winner)));

    if(commentary != null)
        lines.add(ChatUtils.getCenteredText(commentary));

    lines.add("");
    lines.add(ChatUtils.getCenteredText(ChatColor.GREEN + "1er" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(winner)));
    lines.add(ChatUtils.getCenteredText(ChatColor.YELLOW + "2e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(second)));

    if(third != null)
        lines.add(ChatUtils.getCenteredText(ChatColor.RED + "3e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(third)));

    return lines;
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:29,代碼來源:PlayerLeaderboardWinTemplate.java

示例2: createPlayerHead

import net.samagames.tools.PlayerUtils; //導入依賴的package包/類
private ItemStack createPlayerHead(Player player)
{
    AbstractPlayerData playerData = SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId());

    ItemStack stack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
    SkullMeta meta = (SkullMeta) stack.getItemMeta();
    meta.setOwner(player.getName());
    meta.setDisplayName(PlayerUtils.getFullyFormattedPlayerName(player));

    List<String> lore = new ArrayList<>();
    lore.add(ChatColor.GRAY + "Pièces : " + ChatColor.GOLD + NumberUtils.format(playerData.getCoins()));
    lore.add(ChatColor.GRAY + "Perles : " + ChatColor.GREEN + NumberUtils.format(this.hub.getInteractionManager().getGraouManager().getPlayerPearls(player.getUniqueId()).size()));
    lore.add(ChatColor.GRAY + "Poussière d'" + ChatColor.AQUA + "\u272F" + ChatColor.GRAY + " : " + ChatColor.AQUA + NumberUtils.format(playerData.getPowders()));

    meta.setLore(lore);
    stack.setItemMeta(meta);

    return stack;
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:20,代碼來源:GuiProfile.java

示例3: prepare

import net.samagames.tools.PlayerUtils; //導入依賴的package包/類
/**
 * Prepare the message with the team's members
 *
 * @param team Winning team
 *
 * @return A list of lines
 */
public List<String> prepare(SurvivalTeam team)
{
    List<String> custom = new ArrayList<>();
    List<String> players = new ArrayList<>();

    custom.add(ChatUtils.getCenteredText(ChatColor.GREEN + "Gagnant" + ChatColor.GRAY + " - Equipe " + ChatColor.RESET + team.getChatColor() + team.getTeamName()));

    players.addAll(team.getPlayersUUID().keySet().stream().map(PlayerUtils::getColoredFormattedPlayerName).collect(Collectors.toList()));

    custom.add(ChatUtils.getCenteredText(StringUtils.join(players, ", ")));

    return custom;
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:21,代碼來源:TeamWinTemplate.java

示例4: prepare

import net.samagames.tools.PlayerUtils; //導入依賴的package包/類
/**
 * Prepare the message with the team's members
 *
 * @param game The game
 *
 * @return A list of lines
 */
public List<String> prepare(SurvivalGame game)
{
    List<SurvivalPlayer> killers = new ArrayList<>(new HashMap<>(game.getRegisteredGamePlayers()).values());
    List<SurvivalPlayer> damagers = new ArrayList<>(new HashMap<>(game.getRegisteredGamePlayers()).values());

    Collections.sort(killers, (o1, o2) -> Integer.compare(o1.getKills().size(), o2.getKills().size()));
    Collections.sort(damagers, (o1, o2) -> Double.compare(o1.getDamageReporter().getTotalPlayerDamages(), o2.getDamageReporter().getTotalPlayerDamages()));

    Collections.reverse(killers);
    Collections.reverse(damagers);

    List<String> finalLines = new ArrayList<>();
    finalLines.add(ChatUtils.getCenteredText(ChatColor.WHITE + "•" + ChatColor.BOLD + " Statistiques du jeu " + ChatColor.RESET + ChatColor.WHITE + "•"));
    finalLines.add("");
    finalLines.add(ChatUtils.getCenteredText(ChatColor.WHITE + "★ Classement des meurtres ★"));
    finalLines.add("");

    finalLines.add(ChatUtils.getCenteredText(ChatColor.GREEN + "1er" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(killers.get(0).getUUID()) + ChatColor.GRAY + " (" + killers.get(0).getKills().size() + ")"));
    if(killers.size() > 1)
        finalLines.add(ChatUtils.getCenteredText(ChatColor.YELLOW + "2e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(killers.get(1).getUUID()) + ChatColor.GRAY + " (" + killers.get(1).getKills().size() + ")"));

    if(killers.size() > 2)
        finalLines.add(ChatUtils.getCenteredText(ChatColor.RED + "3e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(killers.get(2).getUUID()) + ChatColor.GRAY + " (" + killers.get(2).getKills().size() + ")"));

    finalLines.add("");
    finalLines.add("");
    finalLines.add(ChatUtils.getCenteredText(ChatColor.WHITE + "★ Classement des dégats ★"));
    finalLines.add("");

    finalLines.add(ChatUtils.getCenteredText(ChatColor.GREEN + "1er" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(damagers.get(0).getUUID()) + ChatColor.GRAY + " (" + damagers.get(0).getDamageReporter().getTotalPlayerDamages() + ")"));
    if(damagers.size() > 1)
        finalLines.add(ChatUtils.getCenteredText(ChatColor.YELLOW + "2e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(damagers.get(1).getUUID()) + ChatColor.GRAY + " (" + damagers.get(1).getDamageReporter().getTotalPlayerDamages() + ")"));

    if(damagers.size() > 2)
        finalLines.add(ChatUtils.getCenteredText(ChatColor.RED + "3e" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(damagers.get(2).getUUID()) + ChatColor.GRAY + " (" + damagers.get(2).getDamageReporter().getTotalPlayerDamages() + ")"));

    finalLines.add("");

    return finalLines;
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:48,代碼來源:SurvivalStatisticsTemplate.java

示例5: prepare

import net.samagames.tools.PlayerUtils; //導入依賴的package包/類
/**
 * Prepare a message to display the winner of
 * the game
 *
 * @param player Winner
 *
 * @return Formatted lines
 */
public List<String> prepare(Player player)
{
    List<String> lines = new ArrayList<>();
    lines.add(ChatUtils.getCenteredText(ChatColor.GREEN + "Gagnant" + ChatColor.GRAY + " - " + ChatColor.RESET + PlayerUtils.getFullyFormattedPlayerName(player)));
    
    return lines;
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:16,代碼來源:PlayerWinTemplate.java


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