Package org.bukkit.entity

Examples of org.bukkit.entity.Entity


    @Override
    public void onEntityDamage(EntityDamageEvent event)
    {
        if (!event.isCancelled())
        {
            Entity e = event.getEntity();
            EpicZone sancZone = General.GetZoneForPlayer(null, e.getLocation().getWorld().getName(), e.getLocation().getBlockY(), new Point(e.getLocation().getBlockX(), e.getLocation().getBlockZ()));
            if ((sancZone != null && !sancZone.getSanctuary()) || sancZone == null)
            {
                if (event.getCause() == DamageCause.ENTITY_ATTACK)
                {
                    if (event instanceof EntityDamageByEntityEvent)
                    {
                        EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
                        if (isPlayer(sub.getEntity()) && isPlayer(sub.getDamager()))
                        {
                            Player player = (Player) sub.getEntity();
                            EpicZonePlayer ezp = General.getPlayer(player.getName());
                            EpicZone zone = ezp.getCurrentZone();
                            if (zone != null)
                            {
                                if (!zone.getPVP())
                                {
                                    event.setCancelled(true);
                                }
                            }
                            else
                            {
                                if (!General.myGlobalZones.get(e.getWorld().getName().toLowerCase()).getPVP())
                                {
                                    event.setCancelled(true);
                                }
                            }
                        }
                        else if (sub.getDamager().toString().equalsIgnoreCase("CraftGhast"))
                        {
                            if (sancZone != null)
                            {
                                if (!sancZone.getExplode().getGhast())
                                {
                                    event.setCancelled(true);
                                }
                            }
                        }
                    }
                }
                else if (event.getCause() == DamageCause.BLOCK_EXPLOSION)
                {
                    if (sancZone != null)
                    {
                        if (!sancZone.getExplode().getTNT())
                        {
                            event.setCancelled(true);
                        }
                    }
                }
                else if (event.getCause() == DamageCause.ENTITY_EXPLOSION)
                {
                    if (sancZone != null)
                    {
                        if (!sancZone.getExplode().getCreeper())
                        {
                            event.setCancelled(true);
                        }
                    }
                }
                else if (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)
                {
                    if (sancZone != null)
                    {
                        if (!sancZone.getFire().getIgnite())
                        {
                            if (isPlayer(e))
                            {
                                e.setFireTicks(0);
                                event.setCancelled(true);
                            }
                            else if (!sancZone.getFireBurnsMobs())
                            {
                                e.setFireTicks(0);
                                event.setCancelled(true);
                            }
                        }
                    }
                }
            }
            else //This is a sanctuary zone, no damage allowed to players.
            {
                if (isPlayer(e))
                {
                    e.setFireTicks(0);
                    event.setCancelled(true);
                }
            }
        }
    }
View Full Code Here


  public EntityEvents(ChallengeMaps instance)
  {}

  public @Override void onEntityDeath(EntityDeathEvent event)
  {
    Entity entity = event.getEntity();
    if (entity != null)
    {
      if (entity instanceof Player)
      {
        Player player = (Player) event.getEntity();
View Full Code Here

  public @Override void onVehicleMove(VehicleMoveEvent event)
  {

    Vehicle vehicle = event.getVehicle();
    Entity passenger = vehicle.getPassenger();

    if(passenger != null)
    {
      EpicZonePlayer ezp = General.getPlayer(passenger.getEntityId());

      if(ezp != null)
      {
        int playerHeight = event.getTo().getBlockY();
        Point playerPoint = new Point(event.getTo().getBlockX(), event.getTo().getBlockZ());
View Full Code Here

  }

  public @Override void onCreatureSpawn(CreatureSpawnEvent event)
  {

    Entity mob = event.getEntity();
    EpicZone zone = General.getZoneForPoint(event.getLocation().getBlockY(),new Point(event.getLocation().getBlockX(),event.getLocation().getBlockZ()), event.getLocation().getWorld().getName());

    if(zone != null)
    {
      if(!zone.getAllowedMobs().contains("all"))
      {
        if (zone.getAllowedMobs().contains("none") || !zone.getAllowedMobs().contains(mob.getClass().getName()))
        {
          //System.out.println("Creature Class:" + event.getEntity().getClass().getName() + " Not Allowed Within " + zone.getTag());
          event.setCancelled(true);
        }
      }
View Full Code Here

    public
    @Override
    void onVehicleMove(VehicleMoveEvent event)
    {
        Vehicle vehicle = event.getVehicle();
        Entity passenger = vehicle.getPassenger();
        if (passenger != null)
        {
            if (passenger instanceof Player)
            {
                Player player = (Player) passenger;
View Full Code Here

  public @Override void onVehicleMove(VehicleMoveEvent event)
  {

    Vehicle vehicle = event.getVehicle();
    Entity passenger = vehicle.getPassenger();

    if(passenger != null)
    {
      EpicZonePlayer ezp = General.getPlayer(passenger.getEntityId());

      if(ezp != null)
      {
        int playerHeight = event.getTo().getBlockY();
        Point playerPoint = new Point(event.getTo().getBlockX(), event.getTo().getBlockZ());
View Full Code Here

    prevent(event, event.getPlayer(), "breakblock." + event.getBlock().getTypeId() + ",build." + event.getBlock().getTypeId());
  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void paintingBreakblock(PaintingBreakByEntityEvent event) {
    Entity remover = event.getRemover();
    if (remover instanceof Player) {
      prevent(event, (Player) remover, "breakblock." + Material.PAINTING.getId() + ",build." + Material.PAINTING.getId());
    }
  }
View Full Code Here

            ((CommandMinecart)toCart).setCommand(((CommandMinecart)toCart).getCommand());
            ((CommandMinecart)toCart).setName(((CommandMinecart)toCart).getName());
        } else
            toCart = cart.getWorld().spawn(destination, RideableMinecart.class);

        final Entity passenger = cart.getPassenger();
        if (passenger != null) {
            cart.eject();
            passenger.teleport(destination);
            Bukkit.getScheduler().runTask(CraftBookPlugin.inst(), new Runnable() {

                @Override
                public void run() {

                    toCart.setPassenger(passenger);
                    passenger.setVelocity(cart.getVelocity());
                }
            });
        }
        toCart.getLocation().setYaw(cart.getLocation().getYaw());
        toCart.getLocation().setPitch(cart.getLocation().getPitch());
View Full Code Here

        }
        // if you use just
        // cart.getPassenger().teleport(ejectTarget.getLocation());
        // the client tweaks as bukkit tries to teleport you, then changes its mind and leaves you in the cart.
        // the cart also comes to a dead halt at the time of writing, and i have no idea why.
        Entity ent = event.getMinecart().getPassenger();
        event.getMinecart().eject();
        ent.teleport(BukkitUtil.center(ejectTarget.getLocation()));

        // notice!
        // if a client tries to board a cart immediately before it crosses an ejector,
        // it may appear to them that they crossed the ejector and it failed to activate.
        // what's actually happening is that the server didn't see them enter the cart
View Full Code Here

        if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
            return;
        }

        FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
        Entity caught = event.getCaught();

        switch (event.getState()) {
            case FISHING:
                if (fishingManager.canMasterAngler()) {
                    fishingManager.masterAngler(event.getHook());
View Full Code Here

TOP

Related Classes of org.bukkit.entity.Entity

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.