Package org.bukkit

Examples of org.bukkit.SkullType


  }
 
  @Override
  @Nullable
  public ItemType convert(final Object o) {
    final SkullType type;
    if (o instanceof Skeleton || o instanceof SkeletonData) {
      if (o instanceof SkeletonData ? ((SkeletonData) o).isWither() : ((Skeleton) o).getSkeletonType() == SkeletonType.WITHER) {
        type = SkullType.WITHER;
      } else {
        type = SkullType.SKELETON;
      }
    } else if (o instanceof Zombie || o instanceof EntityData && Zombie.class.isAssignableFrom(((EntityData<?>) o).getType())) {
      type = SkullType.ZOMBIE;
    } else if (o instanceof OfflinePlayer || o instanceof PlayerData) {
      type = SkullType.PLAYER;
    } else if (o instanceof Creeper || o instanceof CreeperData) {
      type = SkullType.CREEPER;
    } else {
      return null;
    }
    @SuppressWarnings("deprecation")
    final ItemType i = new ItemType(Material.SKULL_ITEM.getId(), (short) type.ordinal());
    if (o instanceof OfflinePlayer) {
      final SkullMeta s = (SkullMeta) Bukkit.getItemFactory().getItemMeta(Material.SKULL_ITEM);
      s.setOwner(((OfflinePlayer) o).getName());
      i.setItemMeta(s);
    }
View Full Code Here

TOP

Related Classes of org.bukkit.SkullType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.