Java Code Examples for org.bukkit.entity.EntityType#isSpawnable()

The following examples show how to use org.bukkit.entity.EntityType#isSpawnable() . 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: ImportManager.java    From Statz with GNU General Public License v3.0 6 votes vote down vote up
private void importMobsKilled(PlayerInfo playerInfo, String worldName) {
    Optional<JSONObject> object = getCustomSection(playerInfo.getUUID(), worldName);

    if (!object.isPresent()) {
        return;
    }

    Optional<JSONObject> killedSection = getKilledSection(playerInfo.getUUID(), worldName);

    if (!killedSection.isPresent()) return;

    for (EntityType entityType : EntityType.values()) {

        if (entityType.isSpawnable()) {
            long killed = (Long) getStatistic(killedSection.get(), entityType.getKey().toString()).orElse(0L);

            if (killed <= 0) continue;

            playerInfo.addRow(PlayerStat.KILLS_MOBS,
                    StatzUtil.makeQuery(playerInfo.getUUID(), "value", killed, "world",
                            worldName, "weapon", "HAND", "mob", entityType.toString()));
        }
    }
}
 
Example 2
Source File: CommandCloudServer.java    From CloudNet with Apache License 2.0 5 votes vote down vote up
private boolean mobList(CommandSender commandSender) {
    if (checkMobSelectorActive(commandSender)) {
        return true;
    }

    for (EntityType entityType : EntityType.values()) {
        if (entityType.isAlive() && entityType.isSpawnable()) {
            commandSender.sendMessage("- " + entityType.name());
        }
    }
    return false;
}
 
Example 3
Source File: PlayerEggThrowEvent.java    From Kettle with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Change the type of mob being hatched by the egg
 *
 * @param hatchType The type of the mob being hatched by the egg
 */
public void setHatchingType(EntityType hatchType) {
    if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
    this.hatchType = hatchType;
}