本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}