Java Code Examples for org.bukkit.inventory.meta.SkullMeta#setDisplayName()
The following examples show how to use
org.bukkit.inventory.meta.SkullMeta#setDisplayName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LootGUI.java From EliteMobs with GNU General Public License v3.0 | 6 votes |
private void lootNavigationConstructor(Inventory inventory) { ItemStack arrowLeft = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta arrowLeftSkullMeta = (SkullMeta) arrowLeft.getItemMeta(); arrowLeftSkullMeta.setOwner("MHF_ArrowLeft"); arrowLeftSkullMeta.setDisplayName("Previous Loot Page"); arrowLeft.setItemMeta(arrowLeftSkullMeta); inventory.setItem(27, arrowLeft); ItemStack arrowRight = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta arrowRightSkullMeta = (SkullMeta) arrowRight.getItemMeta(); arrowRightSkullMeta.setOwner("MHF_ArrowRight"); arrowRightSkullMeta.setDisplayName("Next Loot Page"); arrowRight.setItemMeta(arrowRightSkullMeta); inventory.setItem(35, arrowRight); }
Example 2
Source File: MatchManager.java From SkyWarsReloaded with GNU General Public License v3.0 | 6 votes |
private void prepareSpectateInv(Player player, GameMap gameMap) { int slot = 9; for (Player player1: gameMap.getAlivePlayers()) { if (player1 != null) { ItemStack playerhead1 = SkyWarsReloaded.getNMS().getBlankPlayerHead(); SkullMeta meta1 = (SkullMeta)playerhead1.getItemMeta(); SkyWarsReloaded.getNMS().updateSkull(meta1, player1); meta1.setDisplayName(ChatColor.YELLOW + player1.getName()); List<String> lore = new ArrayList<>(); lore.add(new Messaging.MessageFormatter().setVariable("player", player1.getName()).format("spectate.playeritemlore")); meta1.setLore(lore); playerhead1.setItemMeta(meta1); if (player != null) { player.getInventory().setItem(slot, playerhead1); } else { break; } slot++; } } if (player != null) { player.updateInventory(); } }
Example 3
Source File: SkinsGUI.java From SkinsRestorerX with GNU General Public License v3.0 | 5 votes |
private ItemStack createSkull(String name, Object property) { ItemStack is = XMaterial.PLAYER_HEAD.parseItem(); SkullMeta sm = (SkullMeta) is.getItemMeta(); List<String> lore = new ArrayList<>(); lore.add(Locale.SKINSMENU_SELECT_SKIN.replace("&", "ยง")); sm.setDisplayName(name); sm.setLore(lore); is.setItemMeta(sm); setSkin(is, ((Property) property).getValue()); return is; }
Example 4
Source File: GuiFactionList.java From factions-top with MIT License | 5 votes |
private ItemStack getItem(FactionWorth worth, Map<String, String> placeholders, Settings settings, String owner) { String text = insertPlaceholders(settings, worth, replace(this.text, placeholders)); List<String> lore = insertPlaceholders(settings, worth, replace(this.lore, placeholders)); ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta meta = (SkullMeta) item.getItemMeta(); meta.setDisplayName(text); meta.setLore(lore); meta.setOwner(owner); item.setItemMeta(meta); return item; }
Example 5
Source File: LootGUI.java From EliteMobs with GNU General Public License v3.0 | 5 votes |
private void headerConstructor(Inventory inventory) { ItemStack arrowLeft = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta arrowLeftSkullMeta = (SkullMeta) arrowLeft.getItemMeta(); arrowLeftSkullMeta.setOwner("MHF_ArrowLeft"); arrowLeftSkullMeta.setDisplayName("Previous Item Ranks"); arrowLeft.setItemMeta(arrowLeftSkullMeta); inventory.setItem(0, arrowLeft); ItemStack arrowRight = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta arrowRightSkullMeta = (SkullMeta) arrowRight.getItemMeta(); arrowRightSkullMeta.setOwner("MHF_ArrowRight"); arrowRightSkullMeta.setDisplayName("Next Item Ranks"); arrowRight.setItemMeta(arrowRightSkullMeta); inventory.setItem(8, arrowRight); ItemStack signature = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta signatureSkullMeta = (SkullMeta) signature.getItemMeta(); signatureSkullMeta.setOwner("magmaguy"); signatureSkullMeta.setDisplayName("EliteMobs by MagmaGuy"); List<String> signatureList = new ArrayList<>(); signatureList.add("Support the plugins you enjoy!"); signatureSkullMeta.setLore(signatureList); signature.setItemMeta(signatureSkullMeta); inventory.setItem(4, signature); }
Example 6
Source File: ItemFactory.java From TradePlus with GNU General Public License v3.0 | 5 votes |
static ItemStack getPlayerSkull(Player player, String displayName) { ItemStack skull = UMaterial.PLAYER_HEAD_ITEM.getItemStack(); Preconditions.checkNotNull(skull, "Failed to load skull."); if (Sounds.version < 113) skull.getData().setData((byte) 3); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName)); if (Sounds.version >= 112) meta.setOwningPlayer(player); else meta.setOwner(player.getName()); skull.setItemMeta(meta); return skull; }
Example 7
Source File: ItemManager.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static ItemStack spawnPlayerHead(String playerName, String itemDisplayName) { ItemStack skull = ItemManager.createItemStack(ItemManager.getId(Material.SKULL_ITEM), 1, (short)3); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setOwner(playerName); meta.setDisplayName(itemDisplayName); skull.setItemMeta(meta); return skull; }
Example 8
Source File: ContributorsMenu.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
private static ItemStack getContributorHead(Player p, Contributor contributor) { ItemStack skull = SlimefunUtils.getCustomHead(contributor.getTexture()); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setDisplayName(contributor.getDisplayName()); List<String> lore = new LinkedList<>(); lore.add(""); for (Map.Entry<String, Integer> entry : contributor.getContributions()) { String info = entry.getKey(); if (!info.startsWith("&")) { String[] segments = PatternUtils.COMMA.split(info); info = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.roles." + segments[0]); if (segments.length == 2) { info += " &7(" + SlimefunPlugin.getLocalization().getMessage(p, "languages." + segments[1]) + ')'; } } if (entry.getValue() > 0) { String commits = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits." + (entry.getValue() > 1 ? "commits" : "commit")); info += " &7(" + entry.getValue() + ' ' + commits + ')'; } lore.add(ChatColors.color(info)); } if (contributor.getProfile() != null) { lore.add(""); lore.add(ChatColors.color("&7\u21E8 &e") + SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.profile-link")); } meta.setLore(lore); skull.setItemMeta(meta); return skull; }
Example 9
Source File: TopTen.java From askyblock with GNU General Public License v2.0 | 5 votes |
/** * Adds a player to the top ten, if the level is good enough * * @param ownerUUID * @param l */ public void topTenAddEntry(UUID ownerUUID, long l) { if (DEBUG) { plugin.getLogger().info("DEBUG: adding top ten entry " + ownerUUID + " " + l); } // Special case for removals. If a level of zero is given the player // needs to be removed from the list if (l < 1) { topTenList.remove(ownerUUID); return; } // Try and see if the player is online Player player = plugin.getServer().getPlayer(ownerUUID); if (player != null) { // Online if (!player.hasPermission(Settings.PERMPREFIX + "intopten")) { topTenList.remove(ownerUUID); return; } } topTenList.put(ownerUUID, l); topTenList = topTenList.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByValue())).limit(10) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); // Add head to cache if (Settings.warpHeads) { if (topTenList.containsKey(ownerUUID) && !topTenHeads.containsKey(ownerUUID)) { String name = plugin.getPlayers().getName(ownerUUID); if (name != null && !name.isEmpty()) { ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); SkullMeta meta = (SkullMeta) playerSkull.getItemMeta(); meta.setDisplayName(name); playerSkull.setItemMeta(meta); topTenHeads.put(ownerUUID, playerSkull); // Get skull async plugin.getHeadGetter().getHead(ownerUUID, this); } } } }
Example 10
Source File: FlagTrackingSpectate.java From HeavySpleef with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @Subscribe public void onPlayerJoinGame(PlayerJoinGameEvent event) { SpleefPlayer player = event.getPlayer(); GuiInventory trackerInventory = getTrackerInventory(); //Insert the player's head somewhere in the tracker inventory for (int y = 0; y < trackerInventory.getLines(); y++) { for (int x = 0; x < GuiInventory.SLOTS_PER_LINE; x++) { trackerInventory.getSlot(x, y); GuiInventorySlot slot = trackerInventory.getSlot(x, y); if (slot.getItem() != null) { continue; } MaterialData data = new MaterialData(Material.SKULL_ITEM, (byte)SkullType.PLAYER.ordinal()); ItemStack skull = data.toItemStack(1); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setDisplayName(getI18N().getVarString(Messages.Player.TRACKER_SKULL_TITLE) .setVariable("tracking", player.getDisplayName()) .toString()); meta.setOwner(player.getName()); skull.setItemMeta(meta); slot.setItem(skull); slot.setValue(player); break; } } trackerInventory.updateViews(); }
Example 11
Source File: UHPluginListener.java From KTP with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerDeath(final PlayerDeathEvent ev) { Location l = ev.getEntity().getLocation(); for (Player ps : Bukkit.getOnlinePlayers()) { ps.playSound(ps.getLocation(), Sound.ENTITY_WITHER_SPAWN, 1F, 1F); } this.p.addDead(ev.getEntity().getName()); Bukkit.getScheduler().runTaskLater(this.p, new BukkitRunnable() { @Override public void run() { p.setLife((Player)ev.getEntity(), 0); } }, 1L); if (this.p.getConfig().getBoolean("kick-on-death.kick", true)) { Bukkit.getScheduler().runTaskLater(this.p, new BukkitRunnable() { @Override public void run() { ev.getEntity().kickPlayer("jayjay"); } }, 20L*this.p.getConfig().getInt("kick-on-death.time", 30)); } try { ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal()); SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); skullMeta.setOwner(((Player)ev.getEntity()).getName()); skullMeta.setDisplayName(ChatColor.RESET + ((Player)ev.getEntity()).getName()); skull.setItemMeta(skullMeta); l.getWorld().dropItem(l, skull); } catch (Exception e) { e.printStackTrace(); } }
Example 12
Source File: SkyBlockMenu.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
public Inventory displayPartyPlayerGUI(final Player player, final String pname) { List<String> lores = new ArrayList<>(); String emptyTitle = tr("{0} <{1}>", "", tr("Permissions")); String title = tr("{0} <{1}>", pname.substring(0, Math.min(32-emptyTitle.length(), pname.length())), tr("Permissions")); Inventory menu = Bukkit.createInventory(new UltimateHolder(player, title, MenuType.DEFAULT), 9, title); final ItemStack pHead = new ItemStack(Material.PLAYER_HEAD, 1); final SkullMeta meta3 = (SkullMeta) pHead.getItemMeta(); ItemMeta meta2 = sign.getItemMeta(); meta2.setDisplayName(tr("\u00a79Player Permissions")); addLore(lores, tr("\u00a7eClick here to return to\n\u00a7eyour island group''s info.")); meta2.setLore(lores); sign.setItemMeta(meta2); menu.addItem(sign); lores.clear(); meta3.setOwner(pname); meta3.setDisplayName(tr("\u00a7e{0}''\u00a79s Permissions", pname)); addLore(lores, tr("\u00a7eHover over an icon to view\n\u00a7ea permission. Change the\n\u00a7epermission by clicking it.")); meta3.setLore(lores); pHead.setItemMeta(meta3); menu.addItem(pHead); lores.clear(); IslandInfo islandInfo = plugin.getIslandInfo(player); boolean isLeader = islandInfo.isLeader(player); for (PartyPermissionMenuItem menuItem : permissionMenuItems) { ItemStack itemStack = menuItem.getIcon(); meta2 = itemStack.getItemMeta(); if (islandInfo.hasPerm(pname, menuItem.getPerm())) { meta2.setDisplayName("\u00a7a" + menuItem.getTitle()); lores.add(tr("\u00a7fThis player \u00a7acan")); addLore(lores, "\u00a7f", menuItem.getDescription()); if (isLeader) { addLore(lores, "\u00a7f", tr("Click here to remove this permission.")); } } else { meta2.setDisplayName("\u00a7c" + menuItem.getTitle()); lores.add(tr("\u00a7fThis player \u00a7ccannot")); addLore(lores, "\u00a7f", menuItem.getDescription()); if (isLeader) { addLore(lores, "\u00a7f", tr("Click here to grant this permission.")); } } meta2.setLore(lores); itemStack.setItemMeta(meta2); menu.addItem(itemStack); lores.clear(); } return menu; }
Example 13
Source File: SkyBlockMenu.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
public Inventory displayPartyGUI(final Player player) { List<String> lores = new ArrayList<>(); String title = "\u00a79" + tr("Island Group Members"); Inventory menu = Bukkit.createInventory(new UltimateHolder(player, title, MenuType.DEFAULT), 18, title); IslandInfo islandInfo = plugin.getIslandInfo(player); final Set<String> memberList = islandInfo.getMembers(); final ItemMeta meta2 = sign.getItemMeta(); meta2.setDisplayName("\u00a7a" + tr("Island Group Members")); lores.add(tr("Group Members: \u00a72{0}\u00a77/\u00a7e{1}", islandInfo.getPartySize(), islandInfo.getMaxPartySize())); if (islandInfo.getPartySize() < islandInfo.getMaxPartySize()) { addLore(lores, tr("\u00a7aMore players can be invited to this island.")); } else { addLore(lores, tr("\u00a7cThis island is full.")); } addLore(lores, tr("\u00a7eHover over a player''s icon to\n\u00a7eview their permissions. The\n\u00a7eleader can change permissions\n\u00a7eby clicking a player''s icon.")); meta2.setLore(lores); sign.setItemMeta(meta2); menu.addItem(sign.clone()); lores.clear(); for (String temp : memberList) { ItemStack headItem = new ItemStack(Material.PLAYER_HEAD, 1); SkullMeta meta3 = (SkullMeta) headItem.getItemMeta(); meta3.setDisplayName(tr("\u00a7e{0}''s\u00a79 Permissions", temp)); meta3.setOwner(temp); boolean isLeader = islandInfo.isLeader(temp); if (isLeader) { addLore(lores, "\u00a7a\u00a7l", tr("Leader")); } else { addLore(lores, "\u00a7e\u00a7l", tr("Member")); } for (PartyPermissionMenuItem perm : permissionMenuItems) { if (isLeader || islandInfo.hasPerm(temp, perm.getPerm())) { lores.add("\u00a7a" + tr("Can {0}", "\u00a7f" + perm.getShortDescription())); } else { lores.add("\u00a7c" + tr("Cannot {0}", "\u00a7f" + perm.getShortDescription())); } } if (islandInfo.isLeader(player.getName())) { addLore(lores, tr("\u00a7e<Click to change this player''s permissions>")); } meta3.setLore(lores); headItem.setItemMeta(meta3); menu.addItem(headItem); lores.clear(); } return menu; }