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


Java SkullMeta.setDisplayName方法代码示例

本文整理汇总了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;
}
 
开发者ID:cadox8,项目名称:WC,代码行数:17,代码来源:ItemUtil.java

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

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

示例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;
}
 
开发者ID:cadox8,项目名称:PA,代码行数:17,代码来源:ItemUtil.java

示例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;
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:23,代码来源:WarpPanel.java

示例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;
}
 
开发者ID:sabersamus,项目名称:Bytecraft,代码行数:25,代码来源:HeadCommand.java

示例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;
}
 
开发者ID:EmilHernvall,项目名称:tregmine,代码行数:22,代码来源:HeadCommand.java

示例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;
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:10,代码来源:GuiUtil.java

示例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;
}
 
开发者ID:LegendOnline,项目名称:InventoryAPI,代码行数:9,代码来源:McGui.java

示例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;
}
 
开发者ID:LegendOnline,项目名称:InventoryAPI,代码行数:19,代码来源:ItemBuilder.java

示例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;
}
 
开发者ID:jusjus112,项目名称:OnlineChecker-Spigot-SQL-Support,代码行数:14,代码来源:UtilItem.java

示例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;
}
 
开发者ID:redraskal,项目名称:GhostScavengerHunt,代码行数:13,代码来源:Main.java

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

示例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;
}
 
开发者ID:DRE2N,项目名称:ItemsXL,代码行数:13,代码来源:ItemBox.java

示例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;
}
 
开发者ID:NacOJerk,项目名称:Pokecraft,代码行数:9,代码来源:ItemStackUtils.java


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