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