当前位置: 首页>>代码示例>>Java>>正文


Java Player.setDisplayName方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:22,代码来源:PlayerAppearanceChanger.java

示例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);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:30,代码来源:KCPlayer.java

示例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()));
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:14,代码来源:CloudServer.java

示例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);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:29,代码来源:Spectator.java

示例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);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:28,代码来源:Spectator.java

示例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());
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:11,代码来源:Team.java

示例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;
  }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:36,代码来源:TeamCmd.java

示例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);
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:11,代码来源:CPlayer.java

示例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;
	
}
 
开发者ID:RedNyanCat,项目名称:UselessAPI,代码行数:11,代码来源:Api.java


注:本文中的org.bukkit.entity.Player.setDisplayName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。