當前位置: 首頁>>代碼示例>>Java>>正文


Java SkullMeta.getOwner方法代碼示例

本文整理匯總了Java中org.bukkit.inventory.meta.SkullMeta.getOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java SkullMeta.getOwner方法的具體用法?Java SkullMeta.getOwner怎麽用?Java SkullMeta.getOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.inventory.meta.SkullMeta的用法示例。


在下文中一共展示了SkullMeta.getOwner方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNameComponent

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static BaseComponent getNameComponent(ItemStack item) {
    if (item == null) throw new IllegalArgumentException();
    if (item.hasItemMeta() && item.getItemMeta().hasDisplayName())
        return new TextComponent(item.getItemMeta().getDisplayName());
    Material type = item.getType();
    if (type == Material.SKULL_ITEM && item.getDurability() == 3) {
        SkullMeta meta = (SkullMeta) item.getItemMeta();
        if (meta.hasOwner()) {
            return new TranslatableComponent("item.skull.player.name", meta.getOwner());
        } else {
            return new TranslatableComponent("item.skull.char.name");
        }
    } else {
        return new TranslatableComponent(getUnlocalizedName(item));
    }
}
 
開發者ID:NyaaCat,項目名稱:NyaaCore,代碼行數:17,代碼來源:LocaleUtils.java

示例2: isCustomHeadItem

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
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;
}
 
開發者ID:nisovin,項目名稱:Shopkeepers,代碼行數:20,代碼來源:Utils.java

示例3: getItemStackSkin

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static Optional<String> getItemStackSkin(ItemStack itemStack) {
    final ItemMeta meta = itemStack.getItemMeta();
    if (!(meta instanceof SkullMeta)) {
        return Optional.empty();
    }

    final SkullMeta skullMeta = (SkullMeta) meta;
    if (skullMeta.getOwner() != null) {
        return Optional.of(skullMeta.getOwner());
    } else {
        final Optional<String> s = obtainSkinFromSkull(meta);
        if (s != null) return s;
    }
    return Optional.empty();
}
 
開發者ID:Shynixn,項目名稱:PetBlocks,代碼行數:16,代碼來源:SkinHelper.java

示例4: getNameFromItemStack

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static String getNameFromItemStack(ItemStack itemStack) {
    if (itemStack.getItemMeta() instanceof SkullMeta) {
        final SkullMeta meta = (SkullMeta) itemStack.getItemMeta();
        return meta.getOwner();
    }
    return null;
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:8,代碼來源:SSKulls.java

示例5: skullOwner

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private String skullOwner(ItemStack is) {
    if(is == null || is.getItemMeta() == null || !(is.getItemMeta() instanceof SkullMeta)) {
        return "";
    }
    SkullMeta skull = (SkullMeta) is.getItemMeta();
    if(skull.hasOwner()) {
        return ",tag:{SkullOwner:\"" + skull.getOwner() + "\"}";
    } else {
        return "";
    }
}
 
開發者ID:St3venAU,項目名稱:ArmorStandTools,代碼行數:12,代碼來源:NMS.java

示例6: plrHeadName

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private String plrHeadName(ArmorStand as) {
    if(as.getHelmet() == null) return null;
    if(!(as.getHelmet().getItemMeta() instanceof SkullMeta)) return null;
    SkullMeta meta = (SkullMeta) as.getHelmet().getItemMeta();
    if(!meta.hasOwner()) return null;
    return meta.getOwner();
}
 
開發者ID:St3venAU,項目名稱:ArmorStandTools,代碼行數:8,代碼來源:ArmorStandGUI.java

示例7: setSkullOwner

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public ItemMeta setSkullOwner(ItemStack a, ItemStack b) {
	String c = "Unknown";
	SkullMeta d = (SkullMeta) b.getItemMeta();
	if (d.getOwner() != null) {
		c = d.getOwner();
	}
	ItemMeta e = a.getItemMeta();
	e.setLore(Arrays.asList("\u00A77Head of \u00A7a" + c));
	return e;
}
 
開發者ID:Thomaz2Fast,項目名稱:Ultra-Hardcore-1.8,代碼行數:11,代碼來源:GameManager.java

示例8: CardboardMetaSkull

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public CardboardMetaSkull(ItemStack head) {

	this.id = head.getTypeId();
	SkullMeta meta = (SkullMeta) head.getItemMeta();
	if (meta.hasOwner()) {
		this.hasowner = true;
		this.owner = meta.getOwner();
	} else {
		this.hasowner = false;
	}
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:13,代碼來源:CardboardMetaSkull.java

示例9: CardboardMetaSkull

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public CardboardMetaSkull(ItemStack head) {

		this.id = head.getTypeId();
		SkullMeta meta = (SkullMeta) head.getItemMeta();
		if (meta.hasOwner()) {
			this.hasowner = true;
			this.owner = meta.getOwner();
		} else {
			this.hasowner = false;
		}
	}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:12,代碼來源:CardboardMetaSkull.java

示例10: getSkullOwner

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private String getSkullOwner(final ItemStack item) {
	if (item.hasItemMeta() && item.getItemMeta() instanceof SkullMeta) {
		final SkullMeta meta = (SkullMeta) item.getItemMeta();
		return meta.getOwner();
	}
	else {
		CraftoMessenger.warnStaff("getSkullOwner() was called with an item that isnt even a skull?!");
		return BeginComponent.RANDOM_SPAWN_HEAD;
	}
}
 
開發者ID:Craftolution,項目名稱:CraftoPlugin,代碼行數:11,代碼來源:BeginComponent.java

示例11: getName

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
public static String getName(ItemStack item)
{
	if(item == null) //Even though it shouldn't happen
		return "Air";
	
	HashMap<String,String> names = FloAuction.plugin.names;
	int id = item.getTypeId(); //Code needs to be updated eventually, waiting for dura to be completely removed
	short dura = item.getDurability();
	String name = "";

	if(id == 397)
	{
		if(dura == 3)
		{
			SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
			if(skullMeta.hasOwner())
			{
				if(skullMeta.getOwner() != null && !(skullMeta.equals("")))
					return skullMeta.getOwner() + "\'s" + " Head";
			}
		}	
	}
	else if(id == 383) //mob eggs
	{
		return MaterialUtil.getMobEggType(item) + " Spawn Egg";
	}
	
	if(id == 52 && AuctionConfig.getBoolean("allow-mobspawners", null))
	{
		return MaterialUtil.getSpawnerType(item) + " Spawner";
	}
	else if(AuctionConfig.getBoolean("renamed-items-override", null) && Items.getDisplayName(item) != null && id != 52)
	{
		return Items.getDisplayName(item);
	}
	else if(names.get(id + "," + dura) == null && FloAuction.isDamagedAllowed)
	{
		if(names.get(id + "," + 0) != null)
		{
			name = names.get(id + "," + 0);
		}
		else 
		{
			name = MaterialUtil.getItemType(item) + ":" + dura;
		}
	}
	else if(names.get(id + "," + dura) != null)
	{
		name = names.get(id + "," + dura);
	}
	else 
	{
		name = MaterialUtil.getItemType(item);
	}
	return name;
}
 
開發者ID:virustotalop,項目名稱:ObsidianAuctions,代碼行數:57,代碼來源:MaterialUtil.java

示例12: getSkullMetaString

import org.bukkit.inventory.meta.SkullMeta; //導入方法依賴的package包/類
private static String getSkullMetaString(final SkullMeta meta) {
    return meta.getOwner();
}
 
開發者ID:Ribesg,項目名稱:NPlugins,代碼行數:4,代碼來源:ItemMetaUtil.java


注:本文中的org.bukkit.inventory.meta.SkullMeta.getOwner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。