org.bukkit.event.entity.CreatureSpawnEvent#SpawnReason ( )源码实例Demo

下面列出了org.bukkit.event.entity.CreatureSpawnEvent#SpawnReason ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: StackMob-3   文件: StackLogic.java
@Override
public boolean makeWaiting(Entity entity, CreatureSpawnEvent.SpawnReason reason){
    if(!sm.getCustomConfig().getBoolean("wait-to-stack.enabled")){
        return false;
    }
    if(!sm.getCustomConfig().getStringList("wait-to-stack.entity-types")
            .contains(entity.getType().toString())){
        return false;
    }
    if(!sm.getCustomConfig().getStringList("wait-to-stack.spawn-reasons")
            .contains(reason.toString())){
        return false;
    }
    int waitingTime = sm.getCustomConfig().getInt("wait-to-stack.wait-time");
    StackTools.addWaiting(entity, waitingTime);
    return true;
}
 
源代码2 项目: PGM   文件: EntitySpawnQuery.java
public EntitySpawnQuery(
    @Nullable Event event, Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
  super(event, entity);
  this.spawnReason = checkNotNull(spawnReason);
}
 
源代码3 项目: PGM   文件: EntitySpawnQuery.java
@Override
public CreatureSpawnEvent.SpawnReason getSpawnReason() {
  return spawnReason;
}
 
源代码4 项目: Kettle   文件: PreCreatureSpawnEvent.java
public PreCreatureSpawnEvent(Location location, EntityType type, CreatureSpawnEvent.SpawnReason reason) {
    this.location = Preconditions.checkNotNull(location, "Location may not be null").clone();
    this.type = Preconditions.checkNotNull(type, "Type may not be null");
    this.reason = Preconditions.checkNotNull(reason, "Reason may not be null");
}
 
源代码5 项目: Kettle   文件: PreCreatureSpawnEvent.java
/**
 * @return Reason this creature is spawning (ie, NATURAL vs SPAWNER)
 */
public CreatureSpawnEvent.SpawnReason getReason() {
    return reason;
}
 
源代码6 项目: ProjectAres   文件: EntitySpawnQuery.java
@Override
public CreatureSpawnEvent.SpawnReason getSpawnReason() {
    return spawnReason;
}
 
源代码7 项目: EliteMobs   文件: TimedBossMobEntity.java
public TimedBossMobEntity(EntityType entityType, Location location, int eliteMobLevel, String name, CreatureSpawnEvent.SpawnReason spawnReason) {
    super(entityType, location, eliteMobLevel, name, spawnReason);
    super.setHasFarAwayUnload(false);
    super.getLivingEntity().setRemoveWhenFarAway(false);
    BossMobDeathCountdown.startDeathCountdown(super.getLivingEntity());
}
 
源代码8 项目: EliteMobs   文件: ActionBossMobEntity.java
public ActionBossMobEntity(EntityType entityType, Location location, int eliteMobLevel, String name, CreatureSpawnEvent.SpawnReason spawnReason) {
    super(entityType, location, eliteMobLevel, name, spawnReason);
}
 
源代码9 项目: EliteMobs   文件: ActionBossMobEntity.java
public ActionBossMobEntity(EntityType entityType, Location location, int eliteMobsLevel, String name, HashSet<ElitePower> elitePowers, CreatureSpawnEvent.SpawnReason spawnReason) {
    super(entityType, location, eliteMobsLevel, name, elitePowers, spawnReason);
}
 
源代码10 项目: EliteMobs   文件: ReinforcementMobEntity.java
public ReinforcementMobEntity(EntityType entityType, Location location, int eliteMobLevel, String name, CreatureSpawnEvent.SpawnReason spawnReason) {
    super(entityType, location, (int) Math.ceil(eliteMobLevel / 2), name, spawnReason);
    super.setHasSpecialLoot(false);
}
 
源代码11 项目: EliteMobs   文件: EliteMobEntity.java
/**
 * This is the generic constructor used in most instances of natural elite mob generation
 *
 * @param livingEntity  Minecraft entity associated to this elite mob
 * @param eliteMobLevel Level of the mob, can be modified during runtime. Dynamically assigned.
 */
public EliteMobEntity(LivingEntity livingEntity, int eliteMobLevel, CreatureSpawnEvent.SpawnReason spawnReason) {

    /*
    Register living entity to keep track of which entity this object is tied to
     */
    this.eliteMob = livingEntity;
    /*
    Register level, this is variable as per stacking rules
     */
    setEliteMobLevel(eliteMobLevel);
    eliteMobTier = MobTierFinder.findMobTier(eliteMobLevel);
    /*
    Sets the spawn reason
     */
    setSpawnReason(spawnReason);
    /*
    Start tracking the entity
     */
    if (!EntityTracker.registerEliteMob(this)) return;
    /*
    Get correct instance of plugin data, necessary for settings names and health among other things
     */
    EliteMobProperties eliteMobProperties = EliteMobProperties.getPluginData(livingEntity);
    /*
    Handle name, variable as per stacking rules
     */
    setCustomName(eliteMobProperties);
    /*
    Handle health, max is variable as per stacking rules
    Currently #setHealth() resets the health back to maximum
     */
    setMaxHealth(eliteMobProperties);
    setHealth();
    /*
    Set the armor
     */
    setArmor();
    /*
    Register whether or not the elite mob is natural
     */
    this.isNaturalEntity = EntityTracker.isNaturalEntity(livingEntity);
    /*
    Set the power list
     */
    randomizePowers(eliteMobProperties);

    eliteMob.setCanPickupItems(false);

}
 
源代码12 项目: CardinalPGM   文件: SpawnFilterParser.java
public CreatureSpawnEvent.SpawnReason getReason() {
    return reason;
}
 
源代码13 项目: EliteMobs   文件: EliteMobEntity.java
/**
     * Spawning method for boss mobs.
     * Assumes custom powers and custom names.
     *
     * @param entityType    type of mob that this entity is slated to become
     * @param location      location at which the elite mob will spawn
     * @param eliteMobLevel boss mob level, should be automatically generated based on the highest player tier online
     * @param name          the name for this boss mob, overrides the usual elite mob name format
     * @see BossMobEntity
     */
    public EliteMobEntity(EntityType entityType, Location location, int eliteMobLevel, String name, CreatureSpawnEvent.SpawnReason spawnReason) {

        /*
        Register living entity to keep track of which entity this object is tied to
         */
        this.eliteMob = spawnBossMobLivingEntity(entityType, location);
        /*
        Register level, this is variable as per stacking rules
         */
        setEliteMobLevel(eliteMobLevel);
        eliteMobTier = MobTierFinder.findMobTier(eliteMobLevel);
        /*
        Sets the spawn reason
         */
        setSpawnReason(spawnReason);
        /*
        Start tracking the entity
         */
        if (!EntityTracker.registerEliteMob(this)) return;
        /*
        Get correct instance of plugin data, necessary for settings names and health among other things
         */
        EliteMobProperties eliteMobProperties = EliteMobProperties.getPluginData(entityType);
        /*
        Handle name, variable as per stacking rules
         */
        setCustomName(name);
        /*
        Handle health, max is variable as per stacking rules
        Currently #setHealth() resets the health back to maximum
         */
        setMaxHealth(eliteMobProperties);
        setHealth();
        /*
        Register whether or not the elite mob is natural
         */
        this.isNaturalEntity = EntityTracker.isNaturalEntity(this.eliteMob);
        /*
        These have custom powers
         */
        this.hasCustomPowers = true;
        /*
        Start tracking the entity
         */
//        EntityTracker.registerEliteMob(this);

        eliteMob.setCanPickupItems(false);

        this.setHasStacking(false);
        this.setHasCustomArmor(true);

    }
 
/**
 * This manages Elite Mob that are spawned naturally. It takes a mob that spawns normally in the world, randomizes
 * its chance to become an Elite Mob, scans the area around it for players, finds what combat tier those players,
 * finds if there are additional players, increases the tier of the Elite Mob accordingly and adds sets it as a new
 * Elite Mob
 *
 * @param entity      Entity to check for Elite Mob conversion
 * @param spawnReason Reason for the mob spawning
 */
public static void naturalMobProcessor(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {

    int eliteMobLevel = getNaturalMobLevel(entity.getLocation());
    if (eliteMobLevel < 0) return;

    EliteMobEntity eliteMobEntity = new EliteMobEntity((LivingEntity) entity, eliteMobLevel, spawnReason);

    if (spawnReason.equals(CreatureSpawnEvent.SpawnReason.SPAWNER))
        eliteMobEntity.setHasSpecialLoot(false);

}
 
源代码15 项目: EliteMobs   文件: EliteMobEntity.java
/**
 * Gets the spawn reason for the LivingEntity. Used for the API.
 *
 * @return Spawn reason for the LivingEntity.
 */
public CreatureSpawnEvent.SpawnReason getSpawnReason() {
    return this.spawnReason;
}
 
源代码16 项目: EliteMobs   文件: EliteMobSpawnEvent.java
/**
 * Cancelling this event will prevent the Elite Mob from being constructed.
 *
 * @param entity         Entity associated to the Elite Mob
 * @param eliteMobEntity EliteMobEntity being formed
 * @param spawnReason    Reason for the Entity's spawn
 */
public EliteMobSpawnEvent(Entity entity, EliteMobEntity eliteMobEntity, CreatureSpawnEvent.SpawnReason spawnReason) {
    this.entity = entity;
    this.eliteMobEntity = eliteMobEntity;
    this.spawnReason = spawnReason;
}
 
源代码17 项目: EliteMobs   文件: EliteMobEntity.java
/**
 * Sets the spawn reason for the Living Entity. Used for the API.
 *
 * @param spawnReason Spawn reason for the Living Entity.
 */
public void setSpawnReason(CreatureSpawnEvent.SpawnReason spawnReason) {
    this.spawnReason = spawnReason;
}
 
源代码18 项目: PGM   文件: EntitySpawnQuery.java
CreatureSpawnEvent.SpawnReason getSpawnReason(); 
源代码19 项目: ProjectAres   文件: IEntitySpawnQuery.java
CreatureSpawnEvent.SpawnReason getSpawnReason(); 
源代码20 项目: StackMob-3   文件: IStackLogic.java
boolean makeWaiting(Entity entity, CreatureSpawnEvent.SpawnReason reason);