Java Code Examples for org.bukkit.entity.EntityType#SKELETON

The following examples show how to use org.bukkit.entity.EntityType#SKELETON . 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: SentinelVersionCompat.java    From Sentinel with MIT License 6 votes vote down vote up
static EntityType[] v1_16_monsters() {
    return new EntityType[]{
            // 1.8 minus PigZombie
            EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE,
            EntityType.MAGMA_CUBE, EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE,
            EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN,
            EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH,
            // 1.9
            EntityType.SHULKER,
            // 1.11
            EntityType.VEX, EntityType.HUSK, EntityType.ELDER_GUARDIAN,
            EntityType.EVOKER, EntityType.STRAY, EntityType.ZOMBIE_VILLAGER,
            EntityType.WITHER_SKELETON, EntityType.VINDICATOR,
            // 1.12
            EntityType.ILLUSIONER,
            // 1.13
            EntityType.DROWNED, EntityType.PHANTOM,
            // 1.14
            EntityType.RAVAGER, EntityType.PILLAGER,
            // 1.15
            EntityType.BEE,
            // 1.16
            EntityType.HOGLIN, EntityType.PIGLIN, EntityType.ZOGLIN, EntityType.ZOMBIFIED_PIGLIN
    };
}
 
Example 2
Source File: EffCitizenHold.java    From skRayFall with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void execute(Event evt) {
    NPCRegistry registry = CitizensAPI.getNPCRegistry();
    NPC getter = registry.getById(id.getSingle(evt).intValue());
    if (getter.getEntity().getType().equals(EntityType.PLAYER)
            || getter.getEntity().getType() == EntityType.ENDERMAN
            || getter.getEntity().getType() == EntityType.ZOMBIE
            || getter.getEntity().getType() == EntityType.SKELETON) {
        Equipment equ = getter.getTrait(Equipment.class);
        equ.set(EquipmentSlot.HAND, item.getSingle(evt));
    } else {
        Skript.error("Entity must be equipable!");
    }

}
 
Example 3
Source File: CraftSkeleton.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public EntityType getType() {
    return EntityType.SKELETON;
}
 
Example 4
Source File: SentinelVersionCompat.java    From Sentinel with MIT License 4 votes vote down vote up
static EntityType[] v1_8_monsters() {
    return new EntityType[]{EntityType.GUARDIAN, EntityType.CREEPER, EntityType.SKELETON, EntityType.ZOMBIE,
            EntityType.MAGMA_CUBE, EntityType.valueOf("PIG_ZOMBIE"), EntityType.SILVERFISH, EntityType.BAT, EntityType.BLAZE,
            EntityType.GHAST, EntityType.GIANT, EntityType.SLIME, EntityType.SPIDER, EntityType.CAVE_SPIDER, EntityType.ENDERMAN,
            EntityType.ENDERMITE, EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.WITCH};
}
 
Example 5
Source File: EliteSkeleton.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public EliteSkeleton() {

        this.name = ConfigValues.translationConfig.getString(TranslationConfig.NAME_SKELETON);

        this.entityType = EntityType.SKELETON;

        this.defaultMaxHealth = 20;

        SkeletonTrackingArrow skeletonTrackingArrow = new SkeletonTrackingArrow();
        SkeletonPillar skeletonPillar = new SkeletonPillar();
        this.validMajorPowers = new HashSet<>(Arrays.asList(skeletonPillar, skeletonTrackingArrow));

        this.validDefensivePowers.addAll(super.getAllDefensivePowers());
        this.validOffensivePowers.addAll(super.getAllOffensivePowers());
        this.validMiscellaneousPowers.addAll(super.getAllMiscellaneousPowers());

        this.isEnabled = ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.VALID_AGGRESSIVE_ELITEMOBS + getEntityType().toString()) &&
                ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.ALLOW_AGGRESSIVE_ELITEMOBS);

        if (this.isEnabled)
            eliteMobData.add(this);

    }
 
Example 6
Source File: CraftSkeleton.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public EntityType getType() {
    return EntityType.SKELETON;
}
 
Example 7
Source File: DMobType.java    From DungeonsXL with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Entity toEntity(Location loc) {
    World world = loc.getWorld();
    GameWorld gameWorld = plugin.getGameWorld(world);
    if (gameWorld == null) {
        return null;
    }
    LivingEntity entity = (LivingEntity) world.spawnEntity(loc, type);

    /* Set the Items */
    entity.getEquipment().setItemInHand(itemHand);
    entity.getEquipment().setHelmet(itemHelmet);
    entity.getEquipment().setChestplate(itemChestplate);
    entity.getEquipment().setLeggings(itemLeggings);
    entity.getEquipment().setBoots(itemBoots);

    /* Check mob specified stuff */
    if (type == EntityType.SKELETON) {
        if (witherSkeleton) {
            ((Skeleton) entity).setSkeletonType(SkeletonType.WITHER);
        } else {
            ((Skeleton) entity).setSkeletonType(SkeletonType.NORMAL);
        }
    }

    if (type == EntityType.OCELOT) {
        Ocelot ocelot = (Ocelot) entity;
        if (EnumUtil.isValidEnum(Ocelot.Type.class, ocelotType.toUpperCase())) {
            ocelot.setCatType(Ocelot.Type.valueOf(ocelotType.toUpperCase()));
        }
    }

    /* Set Health */
    if (maxHealth > 0) {
        entity.setMaxHealth(maxHealth);
        entity.setHealth(maxHealth);
    }

    /* Disable Despawning */
    entity.setRemoveWhenFarAway(false);

    /* Spawn Mob */
    new DMob(entity, gameWorld, this);
    return entity;
}
 
Example 8
Source File: EffEquipCitizen.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void execute(Event evt) {
    NPCRegistry registry = CitizensAPI.getNPCRegistry();
    NPC getter = registry.getById(id.getSingle(evt).intValue());
    EquipmentSlot slot = EquipmentSlot.HAND;
    switch (item.getSingle(evt).getType()) {
        case LEATHER_BOOTS:
        case IRON_BOOTS:
        case GOLD_BOOTS:
        case CHAINMAIL_BOOTS:
        case DIAMOND_BOOTS:
            slot = EquipmentSlot.BOOTS;
            break;
        case LEATHER_LEGGINGS:
        case IRON_LEGGINGS:
        case GOLD_LEGGINGS:
        case CHAINMAIL_LEGGINGS:
        case DIAMOND_LEGGINGS:
            slot = EquipmentSlot.LEGGINGS;
            break;
        case LEATHER_CHESTPLATE:
        case IRON_CHESTPLATE:
        case GOLD_CHESTPLATE:
        case CHAINMAIL_CHESTPLATE:
        case DIAMOND_CHESTPLATE:
            slot = EquipmentSlot.CHESTPLATE;
            break;
        case LEATHER_HELMET:
        case IRON_HELMET:
        case GOLD_HELMET:
        case CHAINMAIL_HELMET:
        case DIAMOND_HELMET:
            slot = EquipmentSlot.HELMET;
            break;
        default:
            break;

    }
    if (getter.getEntity().getType().equals(EntityType.PLAYER)
            || getter.getEntity().getType() == EntityType.ENDERMAN
            || getter.getEntity().getType() == EntityType.ZOMBIE
            || getter.getEntity().getType() == EntityType.SKELETON) {
        Equipment equ = getter.getTrait(Equipment.class);
        equ.set(slot, item.getSingle(evt));
    } else {
        Skript.error("Entity must be equipable!");
    }
}
 
Example 9
Source File: ScrubEntityType.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Convert a string to a bukkit entity type.
 *
 * @param exprs The string to be converted.
 */
public static EntityType getType(String exprs) {
    switch (exprs.replace("\"", "").toLowerCase().replace("_", " ").replaceFirst("the ", "")) {
        case "player":
        case "the player":
            return EntityType.PLAYER;
        case "pig":
            return EntityType.PIG;
        case "blaze":
            return EntityType.BLAZE;
        case "bat":
            return EntityType.BAT;
        case "chicken":
            return EntityType.CHICKEN;
        case "creeper":
            return EntityType.CREEPER;
        case "cow":
            return EntityType.COW;
        case "enderman":
            return EntityType.ENDERMAN;
        case "ender dragon":
            return EntityType.ENDER_DRAGON;
        case "ghast":
            return EntityType.GHAST;
        case "giant":
            return EntityType.GIANT;
        case "iron golem":
            return EntityType.IRON_GOLEM;
        case "magma cube":
            return EntityType.MAGMA_CUBE;
        case "mushroom cow":
            return EntityType.MUSHROOM_COW;
        case "ocelot":
            return EntityType.OCELOT;
        case "pig zombie":
            return EntityType.PIG_ZOMBIE;
        case "sheep":
            return EntityType.SHEEP;
        case "silverfish":
            return EntityType.SILVERFISH;
        case "squid":
            return EntityType.SQUID;
        case "snowman":
            return EntityType.SNOWMAN;
        case "wolf":
            return EntityType.WOLF;
        case "skeleton":
            return EntityType.SKELETON;
        case "slime":
            return EntityType.SLIME;
        case "spider":
            return EntityType.SPIDER;
        case "witch":
            return EntityType.WITCH;
        case "wither":
            return EntityType.WITHER;
        case "villager":
            return EntityType.VILLAGER;
        case "zombie":
            return EntityType.ZOMBIE;
        case "armor stand":
            return EntityType.ARMOR_STAND;
        case "guardian":
            return EntityType.GUARDIAN;
        default:
            return EntityType.PLAYER;
    }
}
 
Example 10
Source File: EntityNBTBase.java    From NBTEditor with GNU General Public License v3.0 4 votes vote down vote up
public static EntityNBT fromEntityData(NBTTagCompound data) {
	EntityType entityType = EntityTypeMap.getByName(data.getString("id"));

	EntityType entityTypeNew = entityType;
	// Backward compatibility with pre-1.11.
	if (entityType == EntityType.GUARDIAN) {
		if (data.hasKey("Elder")) {
			if (data.getByte("Elder") != 0) {
				entityTypeNew = EntityType.ELDER_GUARDIAN;
			}
			data.remove("Elder");
		}
	} else if (entityType == EntityType.SKELETON) {
		if (data.hasKey("SkeletonType")) {
			switch (data.getByte("SkeletonType")) {
			case 1: entityTypeNew = EntityType.WITHER_SKELETON; break;
			case 2: entityTypeNew = EntityType.STRAY; break;
			}
			data.remove("SkeletonType");
		}
	} else if (entityType == EntityType.ZOMBIE) {
		// pre-1.10
		if (data.hasKey("IsVillager")) {
			if (data.getByte("IsVillager") != 0) {
				entityTypeNew = EntityType.ZOMBIE_VILLAGER;
				if (data.hasKey("VillagerProfession")) {
					data.setInt("Profession", data.getInt("VillagerProfession"));
					data.remove("VillagerProfession");
				}
			}
			data.remove("IsVillager");
		}
		// pre-1.11
		if (data.hasKey("ZombieType")) {
			int zombieType = data.getInt("ZombieType");
			if (zombieType == 0) {
				entityTypeNew = EntityType.ZOMBIE;
			} else if (zombieType >= 1 && zombieType <= 5) {
				entityTypeNew = EntityType.ZOMBIE_VILLAGER;
				data.setInt("Profession", zombieType - 1);
			} else if (zombieType == 6) {
				entityTypeNew = EntityType.HUSK;
			}
			data.remove("ZombieType");
		}
	} else if (entityType == EntityType.HORSE) {
		if (data.hasKey("Type")) {
			switch (data.getInt("Type")) {
			case 1: entityTypeNew = EntityType.DONKEY; break;
			case 2: entityTypeNew = EntityType.MULE; break;
			case 3: entityTypeNew = EntityType.ZOMBIE_HORSE; break;
			case 4: entityTypeNew = EntityType.SKELETON_HORSE; break;
			}
			data.remove("Type");
		}
		if (entityTypeNew != EntityType.DONKEY && entityTypeNew != EntityType.MULE) {
			data.remove("ChestedHorse");
		}
	}

	data.setString("id", EntityTypeMap.getName(entityTypeNew));
	entityType = entityTypeNew;

	// Convert custom names to JSON (1.13).
	refreshEntityName(data);

	if (entityType != null) {
		return EntityNBT.newInstance(entityType, data);
	}
	return null;
}