本文整理汇总了Java中org.bukkit.inventory.meta.SkullMeta.setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java SkullMeta.setDisplayName方法的具体用法?Java SkullMeta.setDisplayName怎么用?Java SkullMeta.setDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.meta.SkullMeta
的用法示例。
在下文中一共展示了SkullMeta.setDisplayName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHeadPlayer
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack createHeadPlayer(String displayname, String username, List<String> lore) {
ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta)playerHead.getItemMeta();
sm.setOwner(username);
ArrayList<String> colorLore = new ArrayList<>();
if (lore != null) {
lore.forEach(str -> colorLore.add(Utils.colorize(str)));
sm.setLore(colorLore);
}
sm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
sm.setDisplayName(Utils.colorize(displayname));
playerHead.setItemMeta(sm);
return playerHead;
}
示例2: createPlayerHead
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
private ItemStack createPlayerHead(Player player)
{
AbstractPlayerData playerData = SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId());
ItemStack stack = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
SkullMeta meta = (SkullMeta) stack.getItemMeta();
meta.setOwner(player.getName());
meta.setDisplayName(PlayerUtils.getFullyFormattedPlayerName(player));
List<String> lore = new ArrayList<>();
lore.add(ChatColor.GRAY + "Pièces : " + ChatColor.GOLD + NumberUtils.format(playerData.getCoins()));
lore.add(ChatColor.GRAY + "Perles : " + ChatColor.GREEN + NumberUtils.format(this.hub.getInteractionManager().getGraouManager().getPlayerPearls(player.getUniqueId()).size()));
lore.add(ChatColor.GRAY + "Poussière d'" + ChatColor.AQUA + "\u272F" + ChatColor.GRAY + " : " + ChatColor.AQUA + NumberUtils.format(playerData.getPowders()));
meta.setLore(lore);
stack.setItemMeta(meta);
return stack;
}
示例3: onPlayerDeath
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
/**
* Drop player head on kill
*
* @param event Event
*/
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta skullMeta = (SkullMeta)head.getItemMeta();
skullMeta.setOwner(event.getEntity().getName());
skullMeta.setDisplayName(ChatColor.AQUA + "Tête de " + event.getEntity().getName());
head.setItemMeta(skullMeta);
event.getDrops().add(head);
List<PotionEffect> effectList = new ArrayList<>();
effectList.addAll(event.getEntity().getActivePotionEffects());
this.effects.put(event.getEntity().getName(), effectList);
}
示例4: createHeadPlayer
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack createHeadPlayer(String displayname, String username, List<String> lore) {
ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta) playerHead.getItemMeta();
sm.setOwner(username);
ArrayList<String> colorLore = new ArrayList<>();
if (lore != null) {
lore.forEach(str -> colorLore.add(Utils.colorize(str)));
sm.setLore(colorLore);
}
sm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
sm.setDisplayName(Utils.colorize(displayname));
playerHead.setItemMeta(sm);
return playerHead;
}
示例5: getSkull
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
/**
* Gets the skull for this player UUID
* @param playerUUID
* @return Player skull item
*/
private ItemStack getSkull(UUID playerUUID) {
String playerName = plugin.getPlayers().getName(playerUUID);
if (DEBUG)
plugin.getLogger().info("DEBUG: name of warp = " + playerName);
ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
if (playerName == null) {
if (DEBUG)
plugin.getLogger().warning("Warp for Player: UUID " + playerUUID.toString() + " is unknown on this server, skipping...");
return null;
//playerName = playerUUID.toString().substring(0, 10);
}
SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
meta.setOwner(playerName);
meta.setDisplayName(ChatColor.WHITE + playerName);
playerSkull.setItemMeta(meta);
return playerSkull;
}
示例6: handlePlayer
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public boolean handlePlayer(BytecraftPlayer player, String[] args)
{
if(!player.getRank().canSpawnHeads()){
player.sendMessage(getInvalidPermsMessage());
return true;
}
if (args.length == 1) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
itemMeta.setOwner(args[0]);
itemMeta.setDisplayName(ChatColor.YELLOW + args[0] + "'s head");
item.setItemMeta(itemMeta);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
player.sendMessage(ChatColor.YELLOW + "You received the head of "
+ args[0]);
}
else {
player.sendMessage(ChatColor.RED + "Type /head <player>");
}
return true;
}
示例7: handlePlayer
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
@Override
public boolean handlePlayer(TregminePlayer player, String args[])
{
if (player.getRank().canGetPlayerHead()){
if (args.length == 1) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
itemMeta.setOwner(args[0]);
itemMeta.setDisplayName(ChatColor.YELLOW + args[0] + "'s head");
item.setItemMeta(itemMeta);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
player.sendMessage(ChatColor.YELLOW + "You received the head of " + args[0]);
} else {
player.sendMessage(ChatColor.RED + "Type /head <player>");
}
} else {
player.sendMessage(ChatColor.RED + "Only admins can use this command!");
}
return true;
}
示例8: head
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack head(String playerName, String displayName, String... lore) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta meta = (SkullMeta) item.getItemMeta();
meta.setOwner(playerName);
meta.setDisplayName(displayName);
meta.setLore(Arrays.asList(lore));
item.setItemMeta(meta);
return item;
}
示例9: getPlayerHead
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack getPlayerHead( Player player, String title ) {
ItemStack head = new ItemStack( Material.SKULL_ITEM, 1, (short) 3 );
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
headMeta.setOwner( player.getName() );
headMeta.setDisplayName( title );
head.setItemMeta( headMeta );
return head;
}
示例10: head
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
/**
* Sets the items properties to be a head with the skin of the given player
* @param player name of the player
* @param title title of the head
* <h2>Note:</h2>
* After creating an head item it cant be modified furthermore because of the immutable itemMeta
* @return this ItemBuilder
*/
public ItemBuilder head( String player, String title){
item.setType( Material.SKULL_ITEM );
item.setDurability( (short) 3 );
SkullMeta headMeta = (SkullMeta) item.getItemMeta();
headMeta.setOwner( player );
headMeta.setDisplayName( title );
item.setItemMeta( headMeta );
return this;
}
示例11: createSkull
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack createSkull(String name, List<String> lore, String owner) {
ItemStack i = new ItemStack(397, 1, (byte) 3);
i = applyItemFlags(i);
SkullMeta im = (SkullMeta) i.getItemMeta();
try {
im.setOwner(ChatColor.stripColor(owner));
} catch (Exception ignored) {
}
im.setDisplayName(name);
im.setLore(lore);
i.setItemMeta(im);
return i;
}
示例12: constructGhostSkull
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public ItemStack constructGhostSkull() {
ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
skullMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&f&lGhost Skull"));
itemStack.setItemMeta(skullMeta);
new SkullProfile(this.getConfig().getString("ghost-skull-hash"))
.applyTextures(itemStack);
return itemStack;
}
示例13: getPlayerSkull
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack getPlayerSkull(String Display,int Stack, List<String> Lore, String PlayerName) {
ItemStack i = new ItemStack(Material.SKULL_ITEM, Stack);
i.setDurability((short)3);
SkullMeta meta = (SkullMeta)i.getItemMeta();
meta.setOwner(PlayerName);
meta.setDisplayName(Display);
meta.setLore(Lore);
i.setItemMeta(meta);
return i;
}
示例14: toItemStack
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
/**
* @return the box
*/
public ItemStack toItemStack(int amount) {
ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, amount, (short) 3);
SkullMeta meta = (SkullMeta) itemStack.getItemMeta();
meta.setDisplayName(config.getBoxName());
meta.setOwner("MHF_Chest");
meta.setLore(Arrays.asList(item.getIdLore()));
itemStack.setItemMeta(meta);
return itemStack;
}
示例15: getSkull
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
public static ItemStack getSkull(String player, String name) {
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
SkullMeta sm = (SkullMeta) skull.getItemMeta();
sm.setDisplayName(name.replaceAll("&", "�"));
sm.setOwner(player);
skull.setItemMeta(sm);
return skull;
}