Java Code Examples for org.bukkit.inventory.meta.SkullMeta#setOwner()
The following examples show how to use
org.bukkit.inventory.meta.SkullMeta#setOwner() .
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: SkullUtils.java From XSeries with MIT License | 6 votes |
@SuppressWarnings("deprecation") @Nonnull public static SkullMeta applySkin(@Nonnull ItemMeta head, @Nonnull String player) { boolean isId = isUUID(getFullUUID(player)); SkullMeta meta = (SkullMeta) head; if (isId || isUsername(player)) { if (isId) return getSkullByValue(meta, getSkinValue(player, true)); if (XMaterial.isNewVersion()) meta.setOwningPlayer(Bukkit.getOfflinePlayer(player)); else meta.setOwner(player); } if (player.contains("textures.minecraft.net")) return getValueFromTextures(meta, player); if (player.length() > 100 && isBase64(player)) return getSkullByValue(meta, player); return getTexturesFromUrlValue(meta, player); }
Example 2
Source File: Utils.java From IridiumSkyblock with GNU General Public License v2.0 | 5 votes |
public static ItemStack makeItem(Inventories.Item item) { try { ItemStack itemstack = makeItem(item.material, item.amount, item.title, item.lore); if (item.material == XMaterial.PLAYER_HEAD && item.headOwner != null) { SkullMeta m = (SkullMeta) itemstack.getItemMeta(); m.setOwner(item.headOwner); itemstack.setItemMeta(m); } return itemstack; } catch (Exception e) { return makeItem(XMaterial.STONE, item.amount, item.title, item.lore); } }
Example 3
Source File: AdventurersGuildGUI.java From EliteMobs with GNU General Public License v3.0 | 5 votes |
private static ItemStack skullItemInitializer(String mhfValue, String title, List<String> lore) { ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); ItemMeta itemMeta = item.getItemMeta(); SkullMeta skullMeta = (SkullMeta) itemMeta; skullMeta.setOwner(mhfValue); item.setItemMeta(skullMeta); itemMeta.setDisplayName(title); itemMeta.setLore(lore); item.setItemMeta(itemMeta); return item; }
Example 4
Source File: ExprSkull.java From Skript with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @Override @Nullable public ItemType convert(final Object o) { ItemType skull = playerSkull.clone(); SkullMeta meta = (SkullMeta) skull.getItemMeta(); if (newSkullOwner) meta.setOwningPlayer((OfflinePlayer) o); else meta.setOwner(((OfflinePlayer) o).getName()); skull.setItemMeta(meta); return skull; }
Example 5
Source File: Items.java From StaffPlus with GNU General Public License v3.0 | 5 votes |
public static ItemStack createSkull(String name) { ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1); SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); skullMeta.setOwner(name); skull.setItemMeta(skullMeta); return skull; }
Example 6
Source File: ItemStackBuilder.java From AstralEdit with Apache License 2.0 | 5 votes |
/** * Sets the skin of the itemStack. Only works on playerHeads * * @param skin skin * @return builder */ public ItemStackBuilder setSkin(String skin) { if (this.getItemMeta() instanceof SkullMeta) { final SkullMeta skullMeta = (SkullMeta) this.getItemMeta(); skullMeta.setOwner(skin); this.setItemMeta(skullMeta); } return this; }
Example 7
Source File: VersionUtils_1_12.java From UhcCore with GNU General Public License v3.0 | 5 votes |
@Override public ItemStack createPlayerSkull(String name, UUID uuid) { ItemStack item = UniversalMaterial.PLAYER_HEAD.getStack(); SkullMeta im = (SkullMeta) item.getItemMeta(); im.setOwner(name); item.setItemMeta(im); return item; }
Example 8
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 9
Source File: ExampleTransformationPlugin.java From RuntimeTransformer with MIT License | 5 votes |
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { ItemStack stack = ((Player) sender).getInventory().getItemInMainHand(); SkullMeta itemMeta = (SkullMeta) stack.getItemMeta(); itemMeta.setOwner("Yamakaja"); stack.setItemMeta(itemMeta); ((Player) sender).getInventory().setItemInMainHand(stack); return true; }
Example 10
Source File: KitParser.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
public ItemStack parseHead(Element el) throws InvalidXMLException { ItemStack itemStack = parseItem(el, Material.SKULL_ITEM, (short) 3); SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); meta.setOwner( XMLUtils.parseUsername(Node.fromChildOrAttr(el, "name")), XMLUtils.parseUuid(Node.fromRequiredChildOrAttr(el, "uuid")), XMLUtils.parseUnsignedSkin(Node.fromRequiredChildOrAttr(el, "skin"))); itemStack.setItemMeta(meta); return itemStack; }
Example 11
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 12
Source File: Utils.java From IridiumSkyblock with GNU General Public License v2.0 | 5 votes |
public static ItemStack makeItem(Inventories.Item item, Island island) { try { ItemStack itemstack = makeItem(item.material, item.amount, processIslandPlaceholders(item.title, island), color(processIslandPlaceholders(item.lore, island))); if (item.material == XMaterial.PLAYER_HEAD && item.headOwner != null) { SkullMeta m = (SkullMeta) itemstack.getItemMeta(); m.setOwner(item.headOwner); itemstack.setItemMeta(m); } return itemstack; } catch (Exception e) { return makeItem(XMaterial.STONE, item.amount, processIslandPlaceholders(item.title, island), color(processIslandPlaceholders(item.lore, island))); } }
Example 13
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 14
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("deprecation") public void updateSkull(SkullMeta meta1, Player player) {meta1.setOwner(player.getName()); }
Example 15
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; }
Example 16
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void updateSkull(SkullMeta meta1, Player player) { meta1.setOwner(player.getName()); }
Example 17
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void updateSkull(SkullMeta meta1, Player player) { meta1.setOwner(player.getName()); }
Example 18
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void updateSkull(SkullMeta meta1, Player player) { meta1.setOwner(player.getName()); }
Example 19
Source File: NMSHandler.java From SkyWarsReloaded with GNU General Public License v3.0 | 4 votes |
@Override public void updateSkull(SkullMeta meta1, Player player) { meta1.setOwner(player.getName()); }
Example 20
Source File: InventoryConvIO.java From BetonQuest with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("deprecation") protected SkullMeta setSkullMeta(SkullMeta meta) { meta.setOwner(npcName); return meta; }