Java 类org.bukkit.entity.Ghast 实例源码

项目:uSkyBlock    文件:LimitLogic.java   
public CreatureType getCreatureType(EntityType entityType) {
    if (Monster.class.isAssignableFrom(entityType.getEntityClass())
            || WaterMob.class.isAssignableFrom(entityType.getEntityClass())
            || Slime.class.isAssignableFrom(entityType.getEntityClass())
            || Ghast.class.isAssignableFrom(entityType.getEntityClass())
            ) {
        return CreatureType.MONSTER;
    } else if (Animals.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.ANIMAL;
    } else if (Villager.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.VILLAGER;
    } else if (Golem.class.isAssignableFrom(entityType.getEntityClass())) {
        return CreatureType.GOLEM;
    }
    return CreatureType.UNKNOWN;
}
项目:uSkyBlock    文件:SpawnEvents.java   
private void checkLimits(Cancellable event, EntityType entityType, Location location) {
    if (entityType == null) {
        return; // Only happens on "other-plugins", i.e. EchoPet
    }
    String islandName = WorldGuardHandler.getIslandNameAt(location);
    if (islandName == null) {
        event.setCancelled(true); // Only allow spawning on active islands...
        return;
    }
    if (entityType.getEntityClass().isAssignableFrom(Ghast.class) && location.getWorld().getEnvironment() != World.Environment.NETHER) {
        // Disallow ghasts for now...
        event.setCancelled(true);
        return;
    }
    us.talabrek.ultimateskyblock.api.IslandInfo islandInfo = plugin.getIslandInfo(islandName);
    if (islandInfo == null) {
        // Disallow spawns on inactive islands
        event.setCancelled(true);
        return;
    }
    if (!plugin.getLimitLogic().canSpawn(entityType, islandInfo)) {
        event.setCancelled(true);
    }
}
项目:BlockLocker    文件:BlockDestroyListener.java   
@EventHandler(ignoreCancelled = true)
public void onEntityExplodeEvent(EntityExplodeEvent event) {
    AttackType attackType = AttackType.UNKNOWN;
    Entity attacker = event.getEntity();
    if (attacker instanceof TNTPrimed) {
        attackType = AttackType.TNT;
    } else if (attacker instanceof Creeper) {
        attackType = AttackType.CREEPER;
    } else if (attacker instanceof Fireball) {
        if (((Fireball) attacker).getShooter() instanceof Ghast) {
            attackType = AttackType.GHAST;
        }
    }
    if (plugin.getChestSettings().allowDestroyBy(attackType)) {
        return;
    }
    for (Iterator<Block> it = event.blockList().iterator(); it.hasNext();) {
        Block block = it.next();
        if (isProtected(block)) {
            it.remove();
        }
    }
}
项目:StarQuestCode    文件:SQSkywatch.java   
@EventHandler
public void onGhastShoot(ProjectileLaunchEvent event) {
    if (event.getEntity() instanceof LargeFireball) {
        // ghast fireball
        LargeFireball frb = (LargeFireball) event.getEntity();
        if (frb.getShooter() instanceof Ghast) {
            Ghast g = (Ghast) frb.getShooter();
            DroneFighter f = getFighter(g);
            if (f == null) {
                g.remove();
                //System.out.println("f for ghast is null, removing!");
                event.setCancelled(true);
            } else {
                event.setCancelled(true);
                //System.out.println("Dud fire!");
            }
        }
    }
}
项目:KTP    文件:UHPluginListener.java   
@EventHandler
public void onEntityDeath(EntityDeathEvent ev) {
    if (ev.getEntity() instanceof Ghast) {
        Bukkit.getLogger().info("Modifying drops for Ghast");
        List<ItemStack> drops = new ArrayList<ItemStack>(ev.getDrops());
        ev.getDrops().clear();
        for (ItemStack i : drops) {
            if (i.getType() == Material.GHAST_TEAR) {
                Bukkit.getLogger().info("Added "+i.getAmount()+" ghast tear(s)");
                ev.getDrops().add(new ItemStack(Material.GOLD_INGOT,i.getAmount()));
            } else {
                Bukkit.getLogger().info("Added "+i.getAmount()+" "+i.getType().toString());
                ev.getDrops().add(i);
            }
        }
    }
}
项目:uSkyBlock    文件:LimitLogic.java   
public CreatureType getCreatureType(LivingEntity creature) {
    if (creature instanceof Monster
            || creature instanceof WaterMob
            || creature instanceof Slime
            || creature instanceof Ghast) {
        return CreatureType.MONSTER;
    } else if (creature instanceof Animals) {
        return CreatureType.ANIMAL;
    } else if (creature instanceof Villager) {
        return CreatureType.VILLAGER;
    } else if (creature instanceof Golem) {
        return CreatureType.GOLEM;
    }
    return CreatureType.UNKNOWN;
}
项目:StarQuestCode    文件:SQSkywatch.java   
DroneFighter getFighter(Ghast g) {
    for (DroneFighter f : activeFighters) {
        if (f.getGhast() == g) {
            return f;
        }
    }
    return null;
}
项目:StarQuestCode    文件:DroneFighter.java   
public DroneFighter(Player target){
    this.target = target;
    Location l = getSafeLocationNearTarget();
    if(l == null) return;
    myGhast = (Ghast) target.getWorld().spawnEntity(l, EntityType.GHAST);
    target.playSound(myGhast.getLocation(), Sound.PORTAL_TRAVEL, 2.0F, 2.0F);
    myGhast.getWorld().playEffect(myGhast.getLocation(), Effect.ENDER_SIGNAL, 0);
}
项目:ce    文件:BeastmastersBow.java   
@Override
    public boolean effect(Event event, Player player) {
//        List<String> lore = e.getBow().getItemMeta().getLore();
//        if(!lore.contains(placeHolder)) {
//            for(int i = descriptionSize; i != 0; i--)
//                lore.remove(i);
//            e.getProjectile().setMetadata("ce." + this.getOriginalName(), new FixedMetadataValue(main, writeType(lore)));
//            player.setMetadata("ce.CanUnleashBeasts", null);
//        } else
//            e.getProjectile().setMetadata("ce." + this.getOriginalName(), null);
          if(event instanceof EntityDamageByEntityEvent) {
          EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
          if(e.getDamager() != player)
              return false;
          Entity ent = e.getEntity();
          Location loc = ent.getLocation();
          World w = ent.getWorld();
            if(ent instanceof Silverfish || ent instanceof EnderDragon || ent instanceof Spider || ent instanceof Slime || ent instanceof Ghast || ent instanceof MagmaCube || ent instanceof CaveSpider || (ent instanceof Wolf && ((Wolf) ent).isAngry()) || ent instanceof PigZombie) {
                    e.setDamage(e.getDamage()*DamageMultiplication);
                    w.playEffect(loc, Effect.SMOKE, 50);
                    w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 50);
                    EffectManager.playSound(loc, "BLOCK_PISTON_RETRACT", 1.3f, 3f);
                return true;
            } else if (ent instanceof Player) {
                for(int i = 0; i < MaximumMobs; i++) {
                    if(rand.nextInt(100) < MobAppearanceChance) {
                        w.spawnEntity(loc, rand.nextInt(2) == 1 ? EntityType.SPIDER : EntityType.SLIME);
                        w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 30);
                        w.playEffect(loc, Effect.SMOKE, 30);
                        EffectManager.playSound(loc, "BLOCK_ANVIL_BREAK", 0.3f, 0.1f);
                    }
                }
            }
        }
          return false;
    }
项目:CanaryBukkit    文件:CanaryGhast.java   
public CanaryGhast(net.canarymod.api.entity.living.monster.Ghast entity) {
    super(entity);
}
项目:StarQuestCode    文件:DroneFighter.java   
public Ghast getGhast(){
    return myGhast;
}
项目:PvPTeleport    文件:WorldCommand.java   
/** Checks that player is not trying to combatlog/is allowed to teleport
 * Returns an error message to be displayed if the player is not allowed
 * to teleport
 * Returns null if the player is allowed to teleport
 */
private static String teleportCheck(Player player) {

    Location pLoc = player.getLocation();

    World world = player.getWorld();

    /* Check if there are any players within 50 blocks */
    for (Player p : world.getPlayers()) {

        if (!p.equals(player)
                && p.getLocation().distance(pLoc) < 50
                && player.canSee(p)
                && !p.isDead()) {
            return ChatColor.RED + "You cannot use this command while within 50 blocks of any other players.";
        }

    }

    /* Check if there are any hostile mobs within 5 blocks */
    for (Entity entity : world.getEntitiesByClasses(
                Blaze.class,
                CaveSpider.class,
                Creeper.class,
                Enderman.class,
                Ghast.class,
                MagmaCube.class,
                PigZombie.class,
                Skeleton.class,
                Silverfish.class,
                Slime.class,
                Spider.class,
                Witch.class,
                Zombie.class)) {

        if (entity.getLocation().distance(pLoc) < 5) {
            return ChatColor.RED + "You cannot use this command while within 5 blocks of any hostile mobs.";
        }

    }

    /* Check if the player is falling */
    if (player.getVelocity().getY() < -0.079
            || player.getVelocity().getY() > 0.08) {
        return ChatColor.RED + "You cannot use this command while falling.";
    }

    /* Check if the player is burning */
    if (player.getFireTicks() > 0
            && !player.hasPotionEffect(
                PotionEffectType.FIRE_RESISTANCE)) {
        return ChatColor.RED + "You cannot use this command while on fire.";
    }

    /* Default to allow teleport */
    return null;

}
项目:modules-extra    文件:ListenerBlockIgnite.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onIgnite(BlockIgniteEvent event)
{
    BlockState oldState = event.getBlock().getState();
    ActionBlock action;
    switch (event.getCause())
    {
    case FIREBALL:
        action = this.newAction(IgniteFireball.class, oldState.getWorld());
        if (action != null)
        {
            ProjectileSource shooter = ((Fireball)event.getIgnitingEntity()).getShooter();
            if (shooter instanceof Entity)
            {
                ((IgniteFireball)action).setShooter((Entity)shooter);
                if (shooter instanceof Ghast)
                {
                    LivingEntity target = BukkitUtils.getTarget((Ghast)shooter);
                    if (target instanceof Player)
                    {
                        ((IgniteFireball)action).setPlayer((Player)target);
                    }
                }
                else if (shooter instanceof Player)
                {
                    ((IgniteFireball)action).setPlayer((Player)shooter);
                }
            }
        }
        break;
    case LAVA:
        action = this.newAction(IgniteLava.class, oldState.getWorld());
        if (action != null)
        {
            ((IgniteLava)action).setSource(event.getIgnitingBlock().getLocation());
        }
        break;
    case LIGHTNING:
        action = this.newAction(IgniteLightning.class, oldState.getWorld());
        break;
    case FLINT_AND_STEEL:
        action = this.newAction(IgniteLighter.class, oldState.getWorld());
        if (action != null && event.getPlayer() != null)
        {
            ((IgniteLighter)action).setPlayer(event.getPlayer());
        }
        break;
    case ENDER_CRYSTAL:
    case EXPLOSION:
        action = this.newAction(IgniteOther.class, oldState.getWorld());
        break;
    case SPREAD:
        return;
    default:
        this.module.getLog().warn("Unknown IgniteCause! {}", event.getCause().name());
        return;
    }
    if (action != null)
    {
        action.setOldBlock(oldState);
        action.setNewBlock(FIRE);
        action.setLocation(oldState.getLocation());
        this.logAction(action);
    }
}
项目:EndHQ-Libraries    文件:RemoteGhast.java   
public RemoteGhast(int inID, RemoteGhastEntity inEntity, EntityManager inManager)
{
    super(inID, RemoteEntityType.Ghast, inManager);
    this.m_entity = inEntity;
}