本文整理汇总了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));
}
}
示例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;
}
示例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();
}
示例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;
}
示例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 "";
}
}
示例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();
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例12: getSkullMetaString
import org.bukkit.inventory.meta.SkullMeta; //导入方法依赖的package包/类
private static String getSkullMetaString(final SkullMeta meta) {
return meta.getOwner();
}