当前位置: 首页>>代码示例>>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;未经允许,请勿转载。