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


Java ItemMeta.setDisplayName方法代码示例

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


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

示例1: createItem

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack createItem(Material material, int amount, short data, String displayname, List<String> lore) {
    ItemStack item = new ItemStack(material, amount, data);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(Utils.colorize(displayname));
    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) {
        lore.forEach(str -> colorLore.add(Utils.colorize(str)));
        meta.setLore(colorLore);
    }

    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
            ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);

    item.setItemMeta(meta);
    return item;
}
 
开发者ID:cadox8,项目名称:WC,代码行数:17,代码来源:ItemUtil.java

示例2: setupGUI

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
private void setupGUI() {
    gui = Bukkit.createInventory(null, 27, FMessage.TRADE_RESOURCE_TITLE.getMessage(resource.getName(), faction.getName()));
    ItemStack banner = faction.getBannerStack();
    ItemMeta meta = banner.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + faction.getName());
    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    banner.setItemMeta(meta);
    gui.setItem(0, BACK);
    gui.setItem(1, banner);
    gui.setItem(2, banner);
    gui.setItem(3, banner);
    gui.setItem(5, banner);
    gui.setItem(6, banner);
    gui.setItem(7, banner);
    gui.setItem(8, banner);
    gui.setItem(13, importButton);
    gui.setItem(22, exportButton);
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:19,代码来源:ResourceMenu.java

示例3: getItem

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemStack getItem() {
	ItemStack is = new ItemStack(Material.PAPER);
	ItemMeta im = is.getItemMeta();
	
	/**
	 * Item:
	 * 
	 * Name = Request #x
	 * Lore 1: Requested by: _name_
	 * Lore :  Ban: 
	 * Lore 2: Reason: reason
	 * Lore 3: Time: time 
	 */
	
	im.setDisplayName(Messager.color("&eRequest #" + id));
	im.setLore(Arrays.asList(Messager.color("&eRequested by: &7" + Bukkit.getOfflinePlayer(UUID.fromString(openerUUID)).getName()), 
			Messager.color("&eBan: &7" + Bukkit.getOfflinePlayer(UUID.fromString(playerToBanUUID)).getName()),
			Messager.color("&eReason: &7" + banReason), 
			Messager.color("&eRequested at: &7" + timeOpenedFormatted)));
	
	is.setItemMeta(im);
	
	return is;
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:25,代码来源:BanRequest.java

示例4: createItemStack

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
static /* varargs */ ItemStack createItemStack(String... lores)
{
    ItemStack stack = new ItemStack(Material.DIAMOND_PICKAXE, 1);
    ItemMeta im = stack.getItemMeta(); 
    im.setDisplayName("");
    ArrayList < String > lore = new ArrayList<>();
    int n = lores.length;
    int n2 = 0; 
    while (n2 < n)
    {
        String str = lores[n2];
        lore.add(str);  ++n2; 
    }
    im.setLore(lore); 
    stack.setItemMeta(im); 
    return stack; 
}
 
开发者ID:ThePhilderbeast,项目名称:prisonPicks,代码行数:18,代码来源:Util.java

示例5: giveKit

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@EventHandler
public void giveKit(final ObserverKitApplyEvent event) {
    final MatchPlayer player = mm.getPlayer(event.getPlayer());
    if(player == null) return;
    if(!player.isObservingType()) return;
    if(!player.getBukkit().hasPermission("pgm.defuse")) return;

    ItemStack shears = new ItemStack(DEFUSE_ITEM);

    // TODO: Update information if locale changes
    ItemMeta meta = shears.getItemMeta();
    meta.addItemFlags(ItemFlag.values());
    meta.setDisplayName(PGMTranslations.t("defuse.displayName", player));
    meta.setLore(Lists.newArrayList(ChatColor.GRAY + PGMTranslations.t("defuse.tooltip", player)));
    shears.setItemMeta(meta);

    event.getPlayer().getInventory().setItem(DEFUSE_SLOT, shears);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:DefuseListener.java

示例6: getLeaveItem

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack getLeaveItem()
{
    ItemStack stack = new ItemStack(Material.BED, 1);
    ItemMeta meta = stack.getItemMeta();

    meta.setDisplayName(ChatColor.RED + "Leave Game " + ChatColor.GRAY + "(Right click)");
    meta.setLore(null);

    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:13,代码来源:ItemHelper.java

示例7: getPowdersIcon

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
protected static ItemStack getPowdersIcon(Player player)
{
    long powders = SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId()).getPowders();

    ItemStack stack = new ItemStack(Material.SUGAR, 1);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(ChatColor.AQUA + "Vous avez " + NumberUtils.format(powders) + " poussières d'\u272F");
    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:12,代码来源:AbstractGui.java

示例8: execute

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@Override
public boolean execute(CommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof Player)) {
        throw new CommandException("Only players can use this command!");
    }
    Player player = (Player) sender;

    ItemStack goditem = new ItemStack(Material.DIAMOND_SWORD);
    ItemMeta goditemMeta = goditem.getItemMeta();
    goditemMeta.setDisplayName(ChatColor.BLUE + "GOD ITEM!");
    goditemMeta.addEnchant(Enchantment.DAMAGE_ALL, 1000, true);
    goditemMeta.addEnchant(Enchantment.DURABILITY, 1000, true);
    goditem.setItemMeta(goditemMeta);
    if (args.length == 0) {
        player.getInventory().addItem(goditem);
        player.sendMessage(ChatColor.AQUA + "Receiving item...");
        return true;
    }
    if (args.length == 1) {
        boolean x = false;
        for (Player p : Bukkit.getOnlinePlayers()) {
            if (p.getName().equals(args[0])) {
                x = true;
                break;
            }
        }
        if (!x) {
            player.sendMessage(ChatColor.RED + "Could not find the specified player.");
            return true;
        }
        Player target = Bukkit.getPlayer(args[0]);
        target.getInventory().addItem(goditem);
        target.sendMessage(ChatColor.AQUA + "Receiving item...");
        return true;
    }
    player.sendMessage(ChatColor.RED + "/givegoditem [player]");
    return true;
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:39,代码来源:GiveGodItem.java

示例9: getItem

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
@Override
public ItemStack getItem() {
    ItemStack item = new ItemStack(Material.END_CRYSTAL);
    List<String> lore = new ArrayList<>();
    lore.add(ChatColor.GRAY + getName());
    lore.add(ChatColor.GRAY + getDescription());
    lore.add(ChatColor.GRAY + "Rarity: " + getRarity().getName());
    ItemMeta itemMeta = item.getItemMeta();
    itemMeta.setDisplayName(getRarity().getColor() + "Enchanted Crystal");
    itemMeta.setLore(lore);
    item.setItemMeta(itemMeta);
    return item;
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:14,代码来源:Endurance.java

示例10: getRepresentation

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public default ItemStack getRepresentation() {
	ItemStack stack = new ItemStack(Material.FIREWORK);
	ItemMeta meta = stack.getItemMeta();
	meta.setDisplayName(ChatColor.GRAY + "Fireworks");
	stack.setItemMeta(meta);
	return stack;
}
 
开发者ID:Jannyboy11,项目名称:CustomRecipes,代码行数:12,代码来源:FireworksRecipe.java

示例11: getItem

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public ItemStack getItem(Material m, String name, int amount, Enchantment e, int enchLevel,
		boolean showEnchantments, int in) {
	ItemStack i = new ItemStack(m, amount, (short) in);
	ItemMeta im = i.getItemMeta();
	im.addEnchant(e, enchLevel, true);
	if (!showEnchantments) {
		im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
	}
	im.setDisplayName(name);
	i.setItemMeta(im);
	return i;
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:13,代码来源:Item.java

示例12: register

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public void register() {
    ItemStack selector = new ItemStack(Material.BOW);
    ItemMeta im = selector.getItemMeta();
    im.setDisplayName("§a弓");
    selector.setItemMeta(im);
    this.setSelector(selector);
    ItemStack show = new ItemStack(Material.BOW);
    im = show.getItemMeta();
    im.setDisplayName("§a弓§7(右键使用)");
    show.setItemMeta(im);
    this.setShow(show);
    this.setSkillType(SkillType.ITEM);
    Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
    SkillManager.getInstance().register(this);
}
 
开发者ID:Soldier233,项目名称:ArchersBattle,代码行数:16,代码来源:Archer.java

示例13: create

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack create(Material m, String name, Enchantment ench, int level, String... lore) {
	ItemStack i = new ItemStack(m);
	ItemMeta im = i.getItemMeta();
	im.setDisplayName(name);
	im.setLore(Arrays.asList(lore));
	i.setItemMeta(im);
	i.addUnsafeEnchantment(ench, level);
	return i;
}
 
开发者ID:jusjus112,项目名称:OnlineChecker-Spigot-SQL-Support,代码行数:10,代码来源:UtilItem.java

示例14: getEventSign

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack getEventSign(String playerName, String kothName)
{
  ItemStack stack = new ItemStack(Material.SIGN, 1);
  ItemMeta meta = stack.getItemMeta();
  meta.setDisplayName(EVENT_SIGN_ITEM_NAME);
  meta.setLore(Lists.newArrayList(new String[] { ChatColor.GOLD + playerName, ChatColor.DARK_PURPLE + "captured by", ChatColor.GOLD + kothName, 
    DateTimeFormats.DAY_MTH_HR_MIN_SECS.format(System.currentTimeMillis()) }));
  stack.setItemMeta(meta);
  return stack;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:11,代码来源:EventSignListener.java

示例15: createItemKey

import org.bukkit.inventory.meta.ItemMeta; //导入方法依赖的package包/类
public static ItemStack createItemKey(Material type,short damage,String world,int x,int y,int z){
	ItemStack is=new ItemStack(type,1,damage);
	ItemMeta im=is.getItemMeta();
	//set Key
	im.setDisplayName(world+Long.toHexString(Long.parseLong((x+""+y+""+z+"").replace("-", "010"))));
	im.setLore(Arrays.asList(world,x+"",y+"",z+""));
	is.setItemMeta(im);
	return is;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:10,代码来源:Items.java


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