本文整理汇总了Java中org.bukkit.entity.Player.setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java Player.setDisplayName方法的具体用法?Java Player.setDisplayName怎么用?Java Player.setDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.setDisplayName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Refresh the given player's appearance for all viewers, assuming the given identity is their current one.
*
* This is necessary if the player's identity changes, or if their current identity's name is invalidated.
*/
public void refreshPlayer(final Player player, final Identity identity) {
player.setDisplayName(nameRenderer.getLegacyName(identity, REAL_NAME_TYPE));
final String legacyNickname = renderLegacyNickname(identity);
for(Player viewer : player.getServer().getOnlinePlayers()) {
refreshFakeNameAndSkin(player, identity, legacyNickname, viewer);
}
if(config.overheadFlair()) {
String prefix = usernameRenderer.getColor(identity, REAL_NAME_TYPE).toString();
if(identity.getNickname() == null) {
prefix = flairRenderer.getLegacyName(identity, REAL_NAME_TYPE) + prefix;
}
setOverheadNamePrefix(player, prefix);
}
}
示例2: updatePlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Performs updates on this player such as attempting to give vote rewards, updating player tablist name,
* and sending the "you have mail" message
*/
public void updatePlayer() {
if (!isOnline())
return; // This only applies to online players.
Player player = getPlayer();
setUsername(player.getName());
player.setDisplayName(getName());
getTemporaryRank().getTeam().addEntry(player.getName());
Voting.giveRewards(player); // Give vote rewards, if any.
player.setOp(getRank().isAtLeast(EnumRank.BUILDER)); // Grant or remove OP status if the player is of high enough level.
// Updates data.
setLastIP(player.getAddress().toString().split("/")[1].split(":")[0]);
player.addAttachment(Core.getInstance(), "OpenInv.*", getRank().isStaff());
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
if (!getMail().isEmpty())
player.sendMessage(ChatColor.GOLD + "You have " + ChatColor.RED + getMail().size() + ChatColor.GOLD
+ " unread messages. Use /mail to read them.");
if (!getMailbox().isEmpty()) {
String l = ChatColor.YELLOW + "✉" + ChatColor.GOLD;
player.sendMessage(TextUtils.centerChat(l + " You have new mail! Claim it with /mailbox. " + l));
}
}, 20L);
}
示例3: addTeamEntry
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void addTeamEntry(Player target, Player all, PermissionGroup permissionGroup)
{
Team team = all.getScoreboard().getTeam(permissionGroup.getTagId() + permissionGroup.getName());
if (team == null)
team = all.getScoreboard().registerNewTeam(permissionGroup.getTagId() + permissionGroup.getName());
team.setPrefix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getPrefix()));
team.setSuffix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getSuffix()));
team.addEntry(target.getName());
target.setDisplayName(ChatColor.translateAlternateColorCodes('&', permissionGroup.getDisplay() + target.getName()));
}
示例4: setSpectator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void setSpectator(Player player, String prefix, Location spawn) {
if (!PREFIXES.containsKey(player.getName()))
PREFIXES.put(player.getName(), prefix);
player.setFoodLevel(20);
player.setLevel(0);
player.setGameMode(GameMode.ADVENTURE);
player.setAllowFlight(true);
player.setPlayerListName(prefix + player.getDisplayName());
player.setDisplayName(prefix + player.getDisplayName());
player.setExp(0);
player.setHealthScale(20);
player.setHealth(20);
player.setTotalExperience(0);
player.setCanPickupItems(false);
player.setCustomName(prefix + player.getDisplayName());
player.setCustomNameVisible(true);
for (PotionEffect eff : player.getActivePotionEffects()) {
player.removePotionEffect(eff.getType());
}
player.teleport(spawn);
for (Player p : Bukkit.getOnlinePlayers()) {
p.hidePlayer(player);
}
PlayerUtil.addDeadPlayer(player);
}
示例5: removeSpectator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void removeSpectator(Player player) {
player.setFoodLevel(20);
player.setLevel(0);
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false);
player.setExp(0);
player.setHealthScale(20);
player.setHealth(20);
player.setTotalExperience(0);
player.setCanPickupItems(false);
for (PotionEffect eff : player.getActivePotionEffects()) {
player.removePotionEffect(eff.getType());
}
if (PREFIXES.containsKey(player.getName())) {
player.setCustomName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setPlayerListName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setDisplayName(player.getDisplayName().replace(PREFIXES.get(player.getName()), ""));
player.setCustomNameVisible(true);
}
for (Player p : Bukkit.getOnlinePlayers()) {
p.showPlayer(player);
}
PlayerUtil.removeDeadPlayer(player);
}
示例6: join
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void join(Player p) {
for (Team team : list) {
if (team.getMembers().contains(p.getName()))
team.getMembers().remove(p.getName());
}
p.setDisplayName(color + p.getName());
members.add(p.getName());
}
示例7: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
Chat.player(sender, "&cThis command is only available for players!");
return true;
}
final Player p = (Player) sender;
Gamer g = Gamer.get(p);
if (g.getRank().getType() == RankType.USER) {
Chat.player(sender, "&cGo to www.mczone.co/donate to get this command!");
return true;
}
if (!State.PRE) {
Chat.player(sender, "&cThe game has already started!");
return true;
}
Team team = Walls.BLUE;
if (cmd.getName().equalsIgnoreCase("red"))
team = Walls.RED;
if (cmd.getName().equalsIgnoreCase("green"))
team = Walls.GREEN;
if (cmd.getName().equalsIgnoreCase("yellow"))
team = Walls.YELLOW;
team.join(p);
p.setDisplayName(team.getColor() + p.getName());
Chat.setPlayerListName(p, team.getColor() + p.getName());
p.setDisplayName(team.getColor() + p.getName());
p.teleport(team.getSpawn());
Chat.player(sender, "&aYou have changed to team " + team.getColor() + team.getColor().name() + "&a!");
return true;
}
示例8: CPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public CPlayer(Player player) {
super(player);
this.player = player;
color = Utils.getRandomColor();
player.setDisplayName(color + player.getName());
updateColor();
AgarMC.get().getGame().equipSpectatingPlayer(player);
}
示例9: nickName
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static boolean nickName(UUID player, String nickname){
Player p = Bukkit.getServer().getPlayer(player);
p.setDisplayName(nickname);
p.setPlayerListName(nickname);
return true;
}