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