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


Java Player.setPlayerListName方法代码示例

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


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

示例1: onPlayerJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
    Player player = event.getPlayer();
    player.setPlayerListName(player.getDisplayName());
    try {
        PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("SELECT * FROM vale_eco WHERE uuid = '"+player.getUniqueId().toString()+"' LIMIT 1");
        ResultSet set = stmt.executeQuery();
        if (!set.next()) {
            stmt.close();
            stmt = plugin.getDb().getConnection().prepareStatement("INSERT INTO vale_eco (uuid, name, amount) VALUES ('"+player.getUniqueId().toString()+"','"+player.getName()+"', 0)");
            stmt.execute();
            stmt.close();
        }
        set.close();
        ValeUtil.setVale(player, ValeUtil.getVale(player));
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Warvale,项目名称:NetworkCore,代码行数:20,代码来源:PlayerListener.java

示例2: 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

示例3: onJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onJoin(PlayerJoinEvent e) {
	Player player = e.getPlayer();
	player.setPlayerListName(ChatColor.LIGHT_PURPLE + getConfig().getString("players." + player.getName() + ".name") + ChatColor.DARK_AQUA + getConfig().getString("players." + player.getName() + ".suffix"));
	AntiCheat.data.add(new PlayerData(player));

	//player.kickPlayer("Get out of here!");

	if (!getConfig().getString("players." + player.getName() + ".cloaked").equals("yes")) {
		if (!player.isOp()) {
			e.setJoinMessage(ChatColor.LIGHT_PURPLE + player.getName() + ChatColor.GREEN + " has joined the game");
		}
		else if (player.isOp()) {
			e.setJoinMessage(ChatColor.LIGHT_PURPLE + getConfig().getString("players." + e.getPlayer().getName() + ".name") + ChatColor.DARK_AQUA + getConfig().getString("players." + e.getPlayer().getName() + ".suffix") + ChatColor.GREEN + "joined the game");
		}
	}
	else {
		e.setJoinMessage(null);
	}
	for (Player ps : cloaked) {
		player.hidePlayer(ps);
	}
	if (getConfig().getString("players." + player.getName() + ".cloaked").equals("yes")) {
		cloaked.add(player);
	}

	ItemStack gs = new ItemStack(Material.COMPASS, 1);
	ItemMeta gsm = gs.getItemMeta();
	gsm.setDisplayName("&f&lGame Selector".replace('&', '�'));

	gs.setItemMeta(gsm);

	e.getPlayer().getInventory().setItem(8, gs);
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:35,代码来源:SuperiorCraft.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: setPlayerListName

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static boolean setPlayerListName(Player p, String s) {
	Boolean result = true;
	if (s.length() > 16) {
		s = s.substring(0, 16);
		result = false;
	}
	
	p.setPlayerListName(s);
	return result;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:11,代码来源:Chat.java

示例7: onPlayerJoin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
    Player player = event.getPlayer();
    //Put player into database
    try {
        PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("SELECT * FROM users WHERE uuid = '"+player.getUniqueId().toString()+"' LIMIT 1");
        ResultSet set = stmt.executeQuery();
        if (!set.next()) {
            stmt.close();
            stmt = plugin.getDb().getConnection().prepareStatement("INSERT INTO users (uuid, name) VALUES ('"+player.getUniqueId().toString()+"', '"+player.getName()+"')");
            stmt.execute();
            stmt.close();
        }
        set.close();

    } catch (SQLException e) {
        e.printStackTrace();
    }
    pm.setup(player);
    try {
        String prfx = RankManager.getRankPrefix(player);
        player.setPlayerListName(ChatColor.translateAlternateColorCodes('&',prfx+" "+RankManager.getRankNameColor(player))+player.getName());
    }catch(Exception err) {err.printStackTrace();}

}
 
开发者ID:Warvale,项目名称:Ace,代码行数:26,代码来源:PlayerListener.java

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