當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。