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


Java Player.getDisplayName方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java Player.getDisplayName方法的具体用法?Java Player.getDisplayName怎么用?Java Player.getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.getDisplayName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run() {
    for (Player player : this.plugin.getServer().getOnlinePlayers()) {
        String currentName;
        if (plugin.getConfig().getBoolean("tablist.show-real-name")) {
            currentName = player.getName();
        } else {
            currentName = player.getDisplayName();
        }
        String prefix = plugin.getConfig().getString("tablist.prefix");
        if (!prefix.equals("")) {
            player.setPlayerListName(ChatColor.translateAlternateColorCodes('&',
                    prefix.replace("%ping%", "" + PingUtil.getPing(player))) + " " + currentName);
        }
        String suffix = plugin.getConfig().getString("tablist.suffix");
        if (!suffix.equals("")) {
            player.setPlayerListName(currentName + " " + ChatColor.translateAlternateColorCodes('&',
                    suffix.replace("%ping%", "" + PingUtil.getPing(player))));
        }
    }
}
 
开发者ID:xDefcon,项目名称:spigot-ping,代码行数:21,代码来源:PingTabList.java

示例2: sendSpectatorMessage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendSpectatorMessage(Player player, String message) {
	GamePlayer sender = SkyWarsReloaded.getPC().getPlayer(player.getUniqueId());
	int score = sender.getScore();
   	String sValue;
	if (score < 0) {
           sValue = ChatColor.RED + "(-" + score + ")";
   	} else {
   		sValue = ChatColor.GREEN + "(+" + score + ")";
   	}
	String name = player.getDisplayName();
	for (GamePlayer gPlayer: getSpectators()) {
		if (gPlayer.getP() != null) {
			gPlayer.getP().sendMessage(new Messaging.MessageFormatter()
			.setVariable("score", sValue)
			.setVariable("player", name)
			.setVariable("message", message)
			.format("spectatorchat"));
		}
	}
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:21,代码来源:Game.java

示例3: getDisplayName

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static String getDisplayName(@Nullable PlayerId target, CommandSender viewer) {
    if(target == null) {
        return CONSOLE_DISPLAY_NAME;
    } else {
        Player targetPlayer = Bukkit.getPlayerExact(target.username(), viewer);
        if(targetPlayer == null) {
            return ChatColor.DARK_AQUA + target.username();
        } else {
            return targetPlayer.getDisplayName(viewer);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:13,代码来源:CommandUtils.java

示例4: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    String list = "";
    
    for (Player p : Utils.getPlayers()) {
        list += "&f" + p.getDisplayName() + "&f, ";
    }
    list = list.substring(0, list.length() - 2);
    
    Chat.simple(sender, "&6Currently &c" + Utils.getPlayers().length + "/" + Bukkit.getMaxPlayers() + " &6players online:");
    Chat.simple(sender, "&6Player List: " + list);
    return true;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:14,代码来源:ListCmd.java

示例5: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    Chat.player(sender, "&6Currently &c" + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers() + " &6players online:");
    String players = "";
    for (Player p : Bukkit.getOnlinePlayers()) {
    	Gamer g = Gamer.get(p);
    	players += g.getPrefix() + "&7" + p.getDisplayName() + "&f, ";
    }
    if (players.length() > 4)
    	players = players.substring(0, players.length() - 4);
    
    Chat.player(sender, "&6Player List: " + players);
	
    return true;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:16,代码来源:ListCmd.java

示例6: executeCommandsSync

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Execute la liste des commandes immédiatement. A faire uniquement en synchrone !
 * @param name Le pseudo du joueur
 */
public void executeCommandsSync(final String name) {
	@SuppressWarnings("deprecation")
	final Player player = this.plugin.getServer().getPlayerExact(name);
	if (player == null) {
		this.plugin.debug( name + " not found.");
		return;
	}
	
	if (player.hasPermission(BukkitSayNoToMcLeaks.PERMISSION_BYPASS)) {
		this.plugin.debug("The player " + name + " is an alt account but he has bypass permission.");
		return;
	}
	
	final String uuid = player.getUniqueId().toString();
	final String displayname = player.getDisplayName();
	final String ip = player.getAddress().getAddress().getHostAddress();
	
	for (String command : this.commands) {
		this.plugin.getServer().dispatchCommand(this.plugin.getServer().getConsoleSender(), command
				.replaceAll("<player>", name)
				.replaceAll("<uuid>", uuid)
				.replaceAll("<displayname>", displayname)
				.replaceAll("<ip>", ip));
	}
	this.plugin.debug("The player " + name + " is an alt account.");
}
 
开发者ID:EverCraft,项目名称:SayNoToMcLeaks,代码行数:31,代码来源:Manager.java

示例7: KvantumPlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Construct a Kvantum player from a Bukkit player
 *
 * @param bukkitPlayer Bukkit player
 */
public KvantumPlayer(@NonNull final Player bukkitPlayer)
{
    this.username = bukkitPlayer.getDisplayName();
    this.uuid = bukkitPlayer.getUniqueId().toString();
    this.world = bukkitPlayer.getWorld().getName();
    this.complete = true;
    this.online = true;
}
 
开发者ID:Sauilitired,项目名称:KvantumBukkit,代码行数:14,代码来源:KvantumPlayer.java

示例8: onShear

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onShear(PlayerShearEntityEvent event) {
    Entity entity = event.getEntity();

    String username = webPlayerBridge.entityId2Username.get(entity.getEntityId());
    if (username == null) {
        return;
    }

    Player player = event.getPlayer();
    String playerName = player.getDisplayName();

    webPlayerBridge.notifySheared(username, playerName);
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:15,代码来源:EntityListener.java

示例9: resolve

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public String resolve(Player player, String id) {
    return player.getDisplayName();
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:5,代码来源:PlayerDisplayNamePlaceholder.java

示例10: formatStaffChatMessage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static String formatStaffChatMessage(Player from, String message) {
    return ChatColor.RED + "" + ChatColor.BOLD + "[STAFF] " + ChatColor.BOLD + from.getDisplayName() + ChatColor.DARK_GRAY + "" + ChatColor.BOLD + " >> " + ChatColor.WHITE + message;
}
 
开发者ID:inventor02,项目名称:RLStaffChat,代码行数:4,代码来源:MessageFormatUtil.java

示例11: formatStaffChatReply

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static String formatStaffChatReply(Player from, Player to, String message) {
    return ChatColor.RED + "" + ChatColor.BOLD + "[STAFF] " + ChatColor.BOLD + from.getDisplayName() + ChatColor.GRAY + " -> " + ChatColor.BOLD + to.getDisplayName() + ChatColor.DARK_GRAY + "" + ChatColor.BOLD + " >> " + ChatColor.WHITE + message;
}
 
开发者ID:inventor02,项目名称:RLStaffChat,代码行数:4,代码来源:MessageFormatUtil.java

示例12: formatAdminChatMessage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static String formatAdminChatMessage(Player from, String message) {
    return ChatColor.DARK_RED + "" + ChatColor.BOLD + "[ADMIN] " + ChatColor.BOLD + from.getDisplayName() + ChatColor.DARK_GRAY + "" + ChatColor.BOLD + " >> " + ChatColor.WHITE + message;
}
 
开发者ID:inventor02,项目名称:RLStaffChat,代码行数:4,代码来源:MessageFormatUtil.java

示例13: formatAdminChatReply

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static String formatAdminChatReply(Player from, Player to, String message) {
    return ChatColor.DARK_RED + "" + ChatColor.BOLD + "[ADMIN] " + ChatColor.BOLD + from.getDisplayName() + ChatColor.GRAY + " -> " + ChatColor.BOLD + to.getDisplayName() + ChatColor.DARK_GRAY + "" + ChatColor.BOLD + " >> " + ChatColor.WHITE + message;
}
 
开发者ID:inventor02,项目名称:RLStaffChat,代码行数:4,代码来源:MessageFormatUtil.java

示例14: sendMessageToViewer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void sendMessageToViewer(Player sender, CommandSender viewer, String sanitizedMessage, ChannelMessageEvent event, boolean offensive, int violationsAttached, PlayerViolationManager violationManager, boolean forceNoSend) {
    boolean senderPresent = sender != null;

    String senderName = senderPresent ? sender.getName(viewer) : "Console";
    String senderDisplayName = senderPresent ? sender.getDisplayName(viewer) : ChatColor.GOLD + "*" + ChatColor.AQUA + "Console";

    String message = MessageFormat.format(
            this.getFormat(),
            senderName,
            senderDisplayName,
            event.getMessage(),
            sanitizedMessage
    );

    boolean allowSend = true;

    if (viewer instanceof Player) {
        switch (PlayerSettings.getManager((Player) viewer).getValue(Settings.FILTER_SETTING, FilterOptions.class)) {
            case NONE:
                allowSend = true;
                break;
            case OFFENSIVE:
                allowSend = !offensive;
                break;
            case ALL:
                allowSend = violationsAttached == 0;
                break;
        }
    }

    boolean isSender = viewer.equals(event.getSender());

    StringBuilder builder = new StringBuilder();

    if (isSender) {
        if (offensive || violationsAttached != 0) {
            if (violationManager.getScore() * this.partial < this.scoreThreshold) {
                builder.append(ChatColor.GOLD);
            } else {
                builder.append(ChatColor.RED);
            }

            builder.append(ChatColor.BOLD).append(WARNING_SYMBOL).append(ChatColor.RESET);
        }
        builder.append(this.underlineViolations(violationManager, message, event));
        viewer.sendMessage(builder.toString());
    } else if (allowSend && !forceNoSend) {
        this.sendMessageToViewer(sender, viewer, sanitizedMessage, event);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ChatModerator,代码行数:51,代码来源:SimpleFilteredChannel.java


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