org.bukkit.inventory.meta.SpawnEggMeta Java Examples
The following examples show how to use
org.bukkit.inventory.meta.SpawnEggMeta.
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: I18nOrigin.java From TabooLib with MIT License | 5 votes |
@Override public String getName(Player player, ItemStack itemStack) { if (itemStack == null) { return "-"; } ItemMeta itemMeta = itemStack.getItemMeta(); if (itemMeta instanceof BookMeta && ((BookMeta) itemMeta).getTitle() != null) { return ((BookMeta) itemMeta).getTitle(); } if (!Version.isAfter(Version.v1_11)) { if (itemStack.getType().name().equals("MONSTER_EGG")) { NBTCompound nbtCompound = NMS.handle().loadNBT(itemStack); if (nbtCompound.containsKey("EntityTag")) { return lang.getString("item_monsterPlacer_name") + " " + lang.getString("entity_" + nbtCompound.get("EntityTag").asCompound().get("id").asString() + "_name"); } return lang.getString("item_monsterPlacer_name"); } } else if (!Version.isAfter(Version.v1_13)) { if (itemMeta instanceof SpawnEggMeta) { String spawnEggType = lang.getString("entity_" + ((SpawnEggMeta) itemMeta).getSpawnedType().getEntityClass().getSimpleName().replace(".", "_") + "_name"); if (spawnEggType != null) { return lang.getString(NMS.handle().getName(itemStack).replace(".", "_"), itemStack.getType().name().toLowerCase().replace("_", "")) + " " + spawnEggType; } } } return lang.getString(NMS.handle().getName(itemStack).replace(".", "_"), itemStack.getType().name().toLowerCase().replace("_", "")); }