org.bukkit.inventory.meta.SkullMeta Java Examples

The following examples show how to use org.bukkit.inventory.meta.SkullMeta. 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: SkullItem.java    From CS-CoreLib with GNU General Public License v3.0 6 votes vote down vote up
@Deprecated
public SkullItem(String name, String owner, String... lore) {
	super(new ItemStack(MaterialHook.parse("PLAYER_HEAD", "SKULL_ITEM")));

	if (ReflectionUtils.isVersion("v1_10_", "v1_11_", "v1_12_")) {
		setDurability((short) 3);
	}
	
	ItemMeta im = getItemMeta();
	im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
	List<String> lines = new ArrayList<>();
	for (String line: lore) {
		lines.add(ChatColor.translateAlternateColorCodes('&', line));
	}
	im.setLore(lines);
	((SkullMeta) im).setOwner(owner);
	setItemMeta(im);
	this.owner = owner;
}
 
Example #2
Source File: GoldenHeadsModule.java    From UHC with MIT License 6 votes vote down vote up
@EventHandler
public void on(PrepareItemCraftEvent event) {
    if (event.getRecipe().getResult().getType() != Material.GOLDEN_APPLE) return;

    final ItemStack centre = event.getInventory().getMatrix()[CRAFTING_INVENTORY_CENTRE_SLOT_ID];

    if (centre == null || centre.getType() != Material.SKULL_ITEM) return;

    if (!isEnabled()) {
        event.getInventory().setResult(new ItemStack(Material.AIR));
        return;
    }

    final SkullMeta meta = (SkullMeta) centre.getItemMeta();
    final ItemStack goldenHeadItem = getGoldenHeadItem(meta.hasOwner() ? meta.getOwner() : "Manually Crafted");
    event.getInventory().setResult(goldenHeadItem);
}
 
Example #3
Source File: LootGUI.java    From EliteMobs with GNU General Public License v3.0 6 votes vote down vote up
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 #4
Source File: MatchManager.java    From SkyWarsReloaded with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: Utils.java    From Shopkeepers with GNU General Public License v3.0 6 votes vote down vote up
public static boolean isCustomHeadItem(ItemStack item) {
	if (item == null) return false;
	if (item.getType() != Material.SKULL_ITEM) {
		return false;
	}
	if (item.getDurability() != SkullType.PLAYER.ordinal()) {
		return false;
	}

	ItemMeta meta = item.getItemMeta();
	if (meta instanceof SkullMeta) {
		SkullMeta skullMeta = (SkullMeta) meta;
		if (skullMeta.hasOwner() && skullMeta.getOwner() == null) {
			// custom head items usually don't have a valid owner
			return true;
		}
	}
	return false;
}
 
Example #6
Source File: TabooMenuMigrater.java    From TrMenu with MIT License 6 votes vote down vote up
private static String migrateMat(Icon icon) {
    if (icon.getItemSource() != null) {
        ItemStack itemStack = icon.getItemSource();
        if (itemStack.getItemMeta() instanceof SkullMeta) {
            String hdb = HookHeadDatabase.getId(itemStack);
            return Strings.nonEmpty(hdb) ? "<hdb:" + hdb + ">" : "<skull:" + Skulls.getTexture(itemStack) + ">";
        }
    }
    if (Strings.nonEmpty(icon.getSkullTexture())) {
        return "<skull:" + icon.getSkullTexture() + ">";
    } else if (Strings.nonEmpty(icon.getSkullOwner())) {
        return "<head:" + icon.getSkullOwner() + ">";
    } else if (icon.getColor() != null && !(icon.getColor().getRed() == 0 && icon.getColor().getGreen() == 0 && icon.getColor().getBlue() == 0)) {
        return icon.getMaterial().name().toLowerCase() + "<dye:" + icon.getColor().getRed() + "," + icon.getColor().getGreen() + "," + icon.getColor().getBlue() + ">";
    } else if (icon.getBannerPatterns() != null) {
        return icon.getMaterial().name().toLowerCase() + "<banner:" + String.join(",", icon.getBannerPatterns()) + ">";
    } else if (icon.getData() > 0) {
        return icon.getMaterial().name().toLowerCase() + ":" + icon.getData();
    }
    return icon.getMaterial().name().toLowerCase();
}
 
Example #7
Source File: CommandTemplate.java    From TrMenu with MIT License 6 votes vote down vote up
private ConfigurationSection display(ItemStack item) {
    ConfigurationSection section = new MemoryConfiguration();
    ItemMeta meta = item.getItemMeta();
    String mat = item.getType().name();
    if (meta instanceof SkullMeta) {
        String texture = Skulls.getTexture(item);
        mat = texture != null ? "<skull:" + Skulls.getTexture(item) + ">" : mat;
    }
    if (item.getAmount() > 1) {
        section.set("amount", item.getAmount());
    }
    if (meta != null) {
        if (meta.hasDisplayName()) {
            section.set("name", meta.getDisplayName());
        }
        if (meta.hasLore()) {
            section.set("lore", meta.getLore());
        }
    }
    section.set("mats", mat);
    return section;
}
 
Example #8
Source File: MaterialStorage.java    From QualityArmory with GNU General Public License v3.0 6 votes vote down vote up
public static MaterialStorage getMS(ItemStack is, int variant) {

		if (is == null) {
			return EMPTY;
		}

		String extraData = is.getType() == MultiVersionLookup.getSkull() ? ((SkullMeta) is.getItemMeta()).getOwner()
				: null;
		String temp = null;
		if (extraData != null)
			temp = SkullHandler.getURL64(is);
		try {
			return getMS(is.getType(), is.getItemMeta().hasCustomModelData() ? is.getItemMeta().getCustomModelData() : 0, variant,
					is.getType() == MultiVersionLookup.getSkull() ? ((SkullMeta) is.getItemMeta()).getOwner() : null, temp);

		} catch (Error | Exception e4) {
		}
		return getMS(is.getType(), is.getDurability(), variant,
				is.getType() == MultiVersionLookup.getSkull() ? ((SkullMeta) is.getItemMeta()).getOwner() : null, temp);
	}
 
Example #9
Source File: Config.java    From CS-CoreLib with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the ItemStack at the specified Path
 *
 * @param  path The path in the Config File
 * @return      The ItemStack at that Path
 */ 
public ItemStack getItem(String path) {
	ItemStack item = config.getItemStack(path);
	if (item == null) return null;
	try {
		if (item.hasItemMeta() && item.getItemMeta() instanceof SkullMeta) {
			if (this.contains(path + "_extra.custom-skull")) item = CustomSkull.getItem((ItemStack) item, this.getString(path + "_extra.custom-skull"));
			if (this.contains(path + "_extra.custom-skullOwner") && !((ItemStack) item).getItemMeta().hasDisplayName()) {
				ItemMeta im = ((ItemStack) item).getItemMeta();
				im.setDisplayName(ChatColor.RESET + this.getString(path + "_extra.custom-skullOwner") + "'s Head");
				((ItemStack) item).setItemMeta(im);
			}
		}
		else {
			this.store(path + "_extra.custom-skull", null);
			this.store(path + "_extra.custom-skullOwner", null);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	return item;
}
 
Example #10
Source File: SkullUtils.java    From XSeries with MIT License 6 votes vote down vote up
@Nonnull
public static SkullMeta getSkullByValue(@Nonnull SkullMeta head, @Nonnull String value) {
    Validate.notEmpty(value, "Skull value cannot be null or empty");
    GameProfile profile = new GameProfile(UUID.randomUUID(), null);

    profile.getProperties().put("textures", new Property("textures", value));
    try {
        Field profileField = head.getClass().getDeclaredField("profile");
        profileField.setAccessible(true);
        profileField.set(head, profile);
    } catch (SecurityException | NoSuchFieldException | IllegalAccessException ex) {
        ex.printStackTrace();
    }

    return head;
}
 
Example #11
Source File: SkullUtils.java    From XSeries with MIT License 6 votes vote down vote up
@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 #12
Source File: SkullUtils.java    From Guilds with MIT License 6 votes vote down vote up
/**
 * Get the skull from a url
 * @param skinUrl url to use
 * @return skull
 */
public static ItemStack getSkull(String skinUrl) {
    ItemStack head = XMaterial.PLAYER_HEAD.parseItem();
    if (skinUrl.isEmpty()) return head;

    SkullMeta headMeta = (SkullMeta) head.getItemMeta();
    GameProfile profile = getGameProfile(skinUrl);
    Field profileField;
    try {
        profileField = headMeta.getClass().getDeclaredField("profile");
        profileField.setAccessible(true);
        profileField.set(headMeta, profile);
    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
        e1.printStackTrace();
    }
    head.setItemMeta(headMeta);
    return head;
}
 
Example #13
Source File: Recipes.java    From ProRecipes with GNU General Public License v2.0 6 votes vote down vote up
public ItemStack checkTexture(ItemStack i, ConfigurationSection s, String path){
	if(i == null || i.getType() != MinecraftVersion.getMaterial("SKULL_ITEM","PLAYER_HEAD")){
		return i;
	}
	if(s == null){
		return i;
	}
	SkullMeta meta = (SkullMeta) i.getItemMeta();
	if(meta.hasOwner()){
		return i;
	}
	if(s.contains(path)){
		String texture = s.getString(path + ".texture");
		String id = s.getString(path + ".uuid");
		return ItemUtils.createHead(UUID.fromString(id), i, texture);
	}else{
		return i;
	}
}
 
Example #14
Source File: ItemUtils.java    From ProRecipes with GNU General Public License v2.0 6 votes vote down vote up
public static ItemStack createHead(UUID id, ItemStack c, String texture)
 {
   GameProfile profile = createGameProfile(texture, id);
   ItemStack head = c.clone();
   ItemMeta headMeta = head.getItemMeta();
   try {
	ReflectionUtils.setValue(headMeta, headMeta.getClass(), true, "profile", profile);
} catch (IllegalArgumentException | IllegalAccessException
		| NoSuchFieldException | SecurityException e) {
	e.printStackTrace();
}
   head.setItemMeta(headMeta);
   SkullMeta skullMeta = (SkullMeta)head.getItemMeta();
   head.setItemMeta(skullMeta);
   return head.clone();
 }
 
Example #15
Source File: SkullItem.java    From CS-CoreLib with GNU General Public License v3.0 6 votes vote down vote up
@Deprecated
public SkullItem(String name, String owner) {
	super(new ItemStack(MaterialHook.parse("PLAYER_HEAD", "SKULL_ITEM")));
	
	if (ReflectionUtils.isVersion("v1_10_", "v1_11_", "v1_12_")) {
		setDurability((short) 3);
	}
	
	ItemMeta im = getItemMeta();
	im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));

	((SkullMeta) im).setOwner(owner);
	
	setItemMeta(im);
	this.owner = owner;
}
 
Example #16
Source File: ItemService.java    From Transport-Pipes with MIT License 6 votes vote down vote up
public ItemStack createHeadItem(String uuid, String textureValue, String textureSignature) {
    WrappedGameProfile wrappedProfile = new WrappedGameProfile(UUID.fromString(uuid), null);
    wrappedProfile.getProperties().put("textures", new WrappedSignedProperty("textures", textureValue, textureSignature));

    ItemStack skull = new ItemStack(Material.PLAYER_HEAD);
    SkullMeta sm = (SkullMeta) skull.getItemMeta();
    sm.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(uuid)));

    Field profileField;
    try {
        profileField = sm.getClass().getDeclaredField("profile");
        profileField.setAccessible(true);
        profileField.set(sm, wrappedProfile.getHandle());
    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
        e1.printStackTrace();
    }

    skull.setItemMeta(sm);
    return skull;
}
 
Example #17
Source File: Headless.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void effect(Event e, ItemStack item, int level) {
    EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
    final Player player = (Player) event.getDamager();
    final LivingEntity ent = (LivingEntity) event.getEntity();

    new BukkitRunnable() {
        @Override
        public void run() {

            if (ent.getHealth() <= 0) {
                byte type = 3;

                if (ent instanceof Skeleton) {
                    type = 0;
                    if (((Skeleton) ent).getSkeletonType().equals(SkeletonType.WITHER))
                        type = 1;
                } else if (ent instanceof Zombie)
                    type = 2;
                else if (ent instanceof Creeper)
                    type = 4;

                ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, type);
                if (type == 3) {
                    SkullMeta sm = (SkullMeta) skull.getItemMeta();
                    sm.setOwner(ent.getName());
                    skull.setItemMeta(sm);
                }
                ent.getWorld().dropItem(ent.getLocation(), skull);
                EffectManager.playSound(player.getLocation(), "BLOCK_ANVIL_LAND", 0.1f, 1.5f);
            }
        }
    }.runTaskLater(getPlugin(), 5l);

}
 
Example #18
Source File: TopTen.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 #19
Source File: ContributorsMenu.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
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 #20
Source File: PlayerHeadProvider.java    From UHC with MIT License 5 votes vote down vote up
public ItemStack getPlayerHeadItem(String name) {
    final ItemStack stack = new ItemStack(Material.SKULL_ITEM, 1);
    stack.setDurability(PLAYER_HEAD_DATA);

    final SkullMeta meta = (SkullMeta) stack.getItemMeta();
    meta.setOwner(name);
    stack.setItemMeta(meta);

    return stack;
}
 
Example #21
Source File: ItemManager.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
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 #22
Source File: SkyBlockMenu.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
private void onClickPartyMenu(InventoryClickEvent event, ItemStack currentItem, Player p, ItemMeta meta, SkullMeta skull, int slotIndex) {
    event.setCancelled(true);
    if (slotIndex < 0 || slotIndex > 35) {
        return;
    }
    if (meta == null || currentItem.getType() == SIGN_MATERIAL) {
        p.closeInventory();
        p.performCommand("island");
    } else if (skull != null && plugin.getIslandInfo(p).isLeader(p)) {
        p.closeInventory();
        p.openInventory(displayPartyPlayerGUI(p, skull.getOwner()));
    }
}
 
Example #23
Source File: CustomSkull.java    From CS-CoreLib with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the Base64 String representing the Texture of the specified item
 *
 * @param  item The ItemStack you want to retrieve the Data from
 * @return      The found Base64 String representing the Texture
 * @throws InvocationTargetException 
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */ 
public static String getTexture(ItemStack item) {
	if (!(item.getItemMeta() instanceof SkullMeta)) return null;
	Object profile = null;
	try {
		profile = ReflectionUtils.getFieldValue(item.getItemMeta(), "profile");
		Collection<?> collection = (Collection<?>) map_list.invoke(property.invoke(profile), "textures");
		for (Object p: collection) {
			if (get_name.invoke(p).equals("textures")) return (String) get_value.invoke(p);
		}
	} catch (Exception e) {
		return null;
	}
	return null;
}
 
Example #24
Source File: HeadGetter.java    From askyblock with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void runPlayerHeadGetter() {
    plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, () -> {
        synchronized(names) {
            Iterator<Entry<UUID,String>> it = names.entrySet().iterator();
            if (it.hasNext()) {
                Entry<UUID,String> en = it.next();
                //Bukkit.getLogger().info("DEBUG: getting " + en.getValue());
                ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                SkullMeta meta = (SkullMeta) playerSkull.getItemMeta();
                meta.setOwner(en.getValue());
                meta.setDisplayName(ChatColor.WHITE + en.getValue());
                playerSkull.setItemMeta(meta);
                //Bukkit.getLogger().info("DEBUG: Got it!");
                // Save in cache
                cachedHeads.put(en.getKey(), new HeadInfo(en.getValue(), en.getKey(), playerSkull));
                // Tell requesters the head came in
                if (headRequesters.containsKey(en.getKey())) {
                    for (Requester req : headRequesters.get(en.getKey())) {
                        //Bukkit.getLogger().info("DEBUG: Telling requester");
                        plugin.getServer().getScheduler().runTask(plugin, () -> req.setHead(new HeadInfo(en.getValue(), en.getKey(), playerSkull)));
                    }
                }
                it.remove();
            }
        }
    }, 0L, 20L);
}
 
Example #25
Source File: SkyBlockMenu.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
private void onClickPermissionMenu(InventoryClickEvent event, ItemStack currentItem, Player p, String inventoryName, int slotIndex) {
    event.setCancelled(true);
    if (slotIndex < 0 || slotIndex > 35) {
        return;
    }
    IslandInfo islandInfo = plugin.getIslandInfo(p);
    if (!plugin.getIslandInfo(p).isLeader(p)) {
        p.closeInventory();
        p.openInventory(displayPartyGUI(p));
    }
    String[] playerPerm = inventoryName.split(" ");
    String pname = playerPerm[0];
    ItemStack skullItem = event.getInventory().getItem(1);
    if (skullItem != null && skullItem.getType().equals(Material.PLAYER_HEAD)) {
        ItemMeta meta = skullItem.getItemMeta();
        if (meta instanceof SkullMeta) {
            pname = ((SkullMeta) meta).getOwner();
        }
    }
    for (PartyPermissionMenuItem item : permissionMenuItems) {
        if (currentItem.getType() == item.getIcon().getType()) {
            p.closeInventory();
            islandInfo.togglePerm(pname, item.getPerm());
            p.openInventory(displayPartyPlayerGUI(p, pname));
            return;
        }
    }
    if (currentItem.getType() == SIGN_MATERIAL) {
        p.closeInventory();
        p.openInventory(displayPartyGUI(p));
    } else {
        p.closeInventory();
        p.openInventory(displayPartyPlayerGUI(p, pname));
    }
}
 
Example #26
Source File: AdventurersGuildGUI.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
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 #27
Source File: LootGUI.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
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 #28
Source File: Utils.java    From IridiumSkyblock with GNU General Public License v2.0 5 votes vote down vote up
public static ItemStack makeItem(Inventories.Item item, List<Placeholder> placeholders) {
    try {
        ItemStack itemstack = makeItem(item.material, item.amount, processMultiplePlaceholders(item.title, placeholders), processMultiplePlaceholders(item.lore, placeholders));
        if (item.material == XMaterial.PLAYER_HEAD && item.headOwner != null) {
            SkullMeta m = (SkullMeta) itemstack.getItemMeta();
            m.setOwner(processMultiplePlaceholders(item.headOwner, placeholders));
            itemstack.setItemMeta(m);
        }
        return itemstack;
    } catch (Exception e) {
        return makeItem(XMaterial.STONE, item.amount, processMultiplePlaceholders(item.title, placeholders), processMultiplePlaceholders(item.lore, placeholders));
    }
}
 
Example #29
Source File: SkullItem.java    From CS-CoreLib with GNU General Public License v3.0 5 votes vote down vote up
public SkullItem(OfflinePlayer player) {
	super(new ItemStack(MaterialHook.parse("PLAYER_HEAD", "SKULL_ITEM")));
	this.owner = player.getName();
	SkullMeta meta = (SkullMeta) getItemMeta();
	meta.setOwningPlayer(player);
	setItemMeta(meta);
}
 
Example #30
Source File: SkullItem.java    From CS-CoreLib with GNU General Public License v3.0 5 votes vote down vote up
@Deprecated
public SkullItem(String owner) {
	super(new ItemStack(MaterialHook.parse("PLAYER_HEAD", "SKULL_ITEM")));

	if (ReflectionUtils.isVersion("v1_10_", "v1_11_", "v1_12_")) {
		setDurability((short) 3);
	}
	
	ItemMeta im = getItemMeta();
	((SkullMeta) im).setOwner(owner);
	setItemMeta(im);
	this.owner = owner;
}