コード例 #1
0
ファイル: MineZListener.java プロジェクト: BlueNinjar/MyMineZ
 @EventHandler
 public void onEntityCombust(EntityCombustEvent event) {
   if (event.getEntity() instanceof Zombie) {
     if (!inGameWorld(event.getEntity())) return;
     event.setCancelled(true);
   }
 }
コード例 #2
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onEntityCombust(EntityCombustEvent event) {
   if (event.isCancelled()) return;
   FlagPermissions perms = Residence.getPermsByLoc(event.getEntity().getLocation());
   if (!perms.has("burn", true)) {
     event.setCancelled(true);
   }
 }
コード例 #3
0
	@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
	public void onEntityCombust(final EntityCombustEvent event)
	{
		if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
		{
			event.setCancelled(true);
		}
	}
コード例 #4
0
  @Override
  public void onEntityCombust(EntityCombustEvent event) {
    if (ignoreListener) return;

    removeDeadEntities();

    if (modifiedEntities.contains(event.getEntity())) {
      event.setCancelled(true);
    }
  }
コード例 #5
0
  public void onEntityCombust(EntityCombustEvent event) {
    if (event.isCancelled()) return;

    if (event.getEntity() instanceof Player) {
      String playerName = ((Player) event.getEntity()).getName();
      if (AdminHandler.isGod(playerName)) {
        event.setCancelled(true);
        plugin
            .getServer()
            .getScheduler()
            .scheduleSyncDelayedTask(plugin, new douse((Player) event.getEntity()), 2);
      }
    }
  }
コード例 #6
0
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onEntityCombust(EntityCombustEvent event) {
   Entity entity = event.getEntity();
   if (entity instanceof Player) {
     Player player = (Player) entity;
     ArenaPlayer ap = plugin.getArenaPlayer(player);
     if (ap != null) {
       Arena arena = ap.getArena();
       if (arena.isInLobby()) {
         player.setFireTicks(0);
         event.setCancelled(true);
       }
     }
   }
 }
コード例 #7
0
ファイル: WarEntityListener.java プロジェクト: hazyarc/war
 public void onEntityCombust(EntityCombustEvent event) {
   Entity entity = event.getEntity();
   if (entity instanceof Player) {
     Player player = (Player) entity;
     Team team = war.getPlayerTeam(player.getName());
     if (team != null && team.getSpawnVolume().contains(player.getLocation())) {
       // smother out the fire that didn't burn out when you respawned
       // Stop fire (upcast, watch out!)
       if (player instanceof CraftPlayer) {
         net.minecraft.server.Entity playerEntity = ((CraftPlayer) player).getHandle();
         playerEntity.fireTicks = 0;
       }
       event.setCancelled(true);
     }
   }
 }
コード例 #8
0
ファイル: Entity.java プロジェクト: dested/CraftbukkitMaps
  protected void aa() {
    if (!this.bD) {
      // CraftBukkit start - TODO: this event spams!
      if (this instanceof EntityLiving) {
        CraftServer server = ((WorldServer) this.world).getServer();
        // TODO: shouldn't be sending null for the block.
        org.bukkit.block.Block damager =
            null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
        org.bukkit.entity.Entity damagee = this.getBukkitEntity();
        DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
        int damageDone = 4;

        EntityDamageByBlockEvent event =
            new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
        server.getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
          this.damageEntity((Entity) null, event.getDamage());
        }

        if (this.fireTicks <= 0) {
          // not on fire yet
          EntityCombustEvent combustEvent = new EntityCombustEvent(damagee);
          server.getPluginManager().callEvent(combustEvent);
          if (!combustEvent.isCancelled()) {
            this.fireTicks = 600;
          }
        } else {
          // reset fire level back to max
          this.fireTicks = 600;
        }
        return;
      }
      // CraftBukkit end

      this.damageEntity((Entity) null, 4);
      this.fireTicks = 600;
    }
  }
コード例 #9
0
ファイル: Entity.java プロジェクト: dested/CraftbukkitMaps
  public void move(double d0, double d1, double d2) {
    if (this.bt) {
      this.boundingBox.d(d0, d1, d2);
      this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
      this.locY = this.boundingBox.b + (double) this.height - (double) this.br;
      this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
    } else {
      this.br *= 0.4F;
      double d3 = this.locX;
      double d4 = this.locZ;

      if (this.bf) {
        this.bf = false;
        d0 *= 0.25D;
        d1 *= 0.05000000074505806D;
        d2 *= 0.25D;
        this.motX = 0.0D;
        this.motY = 0.0D;
        this.motZ = 0.0D;
      }

      double d5 = d0;
      double d6 = d1;
      double d7 = d2;
      AxisAlignedBB axisalignedbb = this.boundingBox.clone();
      boolean flag = this.onGround && this.isSneaking();

      if (flag) {
        double d8;

        for (d8 = 0.05D;
            d0 != 0.0D
                && this.world.getEntities(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0;
            d5 = d0) {
          if (d0 < d8 && d0 >= -d8) {
            d0 = 0.0D;
          } else if (d0 > 0.0D) {
            d0 -= d8;
          } else {
            d0 += d8;
          }
        }

        for (;
            d2 != 0.0D
                && this.world.getEntities(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0;
            d7 = d2) {
          if (d2 < d8 && d2 >= -d8) {
            d2 = 0.0D;
          } else if (d2 > 0.0D) {
            d2 -= d8;
          } else {
            d2 += d8;
          }
        }
      }

      List list = this.world.getEntities(this, this.boundingBox.a(d0, d1, d2));

      for (int i = 0; i < list.size(); ++i) {
        d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
      }

      this.boundingBox.d(0.0D, d1, 0.0D);
      if (!this.bg && d6 != d1) {
        d2 = 0.0D;
        d1 = 0.0D;
        d0 = 0.0D;
      }

      boolean flag1 = this.onGround || d6 != d1 && d6 < 0.0D;

      int j;

      for (j = 0; j < list.size(); ++j) {
        d0 = ((AxisAlignedBB) list.get(j)).a(this.boundingBox, d0);
      }

      this.boundingBox.d(d0, 0.0D, 0.0D);
      if (!this.bg && d5 != d0) {
        d2 = 0.0D;
        d1 = 0.0D;
        d0 = 0.0D;
      }

      for (j = 0; j < list.size(); ++j) {
        d2 = ((AxisAlignedBB) list.get(j)).c(this.boundingBox, d2);
      }

      this.boundingBox.d(0.0D, 0.0D, d2);
      if (!this.bg && d7 != d2) {
        d2 = 0.0D;
        d1 = 0.0D;
        d0 = 0.0D;
      }

      double d9;
      double d10;
      int k;

      if (this.bs > 0.0F && flag1 && (flag || this.br < 0.05F) && (d5 != d0 || d7 != d2)) {
        d9 = d0;
        d10 = d1;
        double d11 = d2;

        d0 = d5;
        d1 = (double) this.bs;
        d2 = d7;
        AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();

        this.boundingBox.b(axisalignedbb);
        list = this.world.getEntities(this, this.boundingBox.a(d5, d1, d7));

        for (k = 0; k < list.size(); ++k) {
          d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
        }

        this.boundingBox.d(0.0D, d1, 0.0D);
        if (!this.bg && d6 != d1) {
          d2 = 0.0D;
          d1 = 0.0D;
          d0 = 0.0D;
        }

        for (k = 0; k < list.size(); ++k) {
          d0 = ((AxisAlignedBB) list.get(k)).a(this.boundingBox, d0);
        }

        this.boundingBox.d(d0, 0.0D, 0.0D);
        if (!this.bg && d5 != d0) {
          d2 = 0.0D;
          d1 = 0.0D;
          d0 = 0.0D;
        }

        for (k = 0; k < list.size(); ++k) {
          d2 = ((AxisAlignedBB) list.get(k)).c(this.boundingBox, d2);
        }

        this.boundingBox.d(0.0D, 0.0D, d2);
        if (!this.bg && d7 != d2) {
          d2 = 0.0D;
          d1 = 0.0D;
          d0 = 0.0D;
        }

        if (!this.bg && d6 != d1) {
          d2 = 0.0D;
          d1 = 0.0D;
          d0 = 0.0D;
        } else {
          d1 = (double) (-this.bs);

          for (k = 0; k < list.size(); ++k) {
            d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
          }

          this.boundingBox.d(0.0D, d1, 0.0D);
        }

        if (d9 * d9 + d11 * d11 >= d0 * d0 + d2 * d2) {
          d0 = d9;
          d1 = d10;
          d2 = d11;
          this.boundingBox.b(axisalignedbb1);
        } else {
          double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);

          if (d12 > 0.0D) {
            this.br = (float) ((double) this.br + d12 + 0.01D);
          }
        }
      }

      this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
      this.locY = this.boundingBox.b + (double) this.height - (double) this.br;
      this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
      this.positionChanged = d5 != d0 || d7 != d2;
      this.bc = d6 != d1;
      this.onGround = d6 != d1 && d6 < 0.0D;
      this.bd = this.positionChanged || this.bc;
      this.a(d1, this.onGround);
      if (d5 != d0) {
        this.motX = 0.0D;
      }

      if (d6 != d1) {
        this.motY = 0.0D;
      }

      if (d7 != d2) {
        this.motZ = 0.0D;
      }

      d9 = this.locX - d3;
      d10 = this.locZ - d4;
      int l;
      int i1;
      int j1;

      // CraftBukkit start
      if ((this.positionChanged) && (getBukkitEntity() instanceof Vehicle)) {
        Vehicle vehicle = (Vehicle) getBukkitEntity();
        org.bukkit.World wrld = ((WorldServer) world).getWorld();
        org.bukkit.block.Block block =
            wrld.getBlockAt(
                MathHelper.floor(locX),
                MathHelper.floor(locY - 0.20000000298023224D - (double) this.height),
                MathHelper.floor(locZ));

        if (d5 > d0) {
          block = block.getFace(BlockFace.SOUTH);
        } else if (d5 < d0) {
          block = block.getFace(BlockFace.NORTH);
        } else if (d7 > d2) {
          block = block.getFace(BlockFace.WEST);
        } else if (d7 < d2) {
          block = block.getFace(BlockFace.EAST);
        }

        VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
        ((WorldServer) world).getServer().getPluginManager().callEvent(event);
      }
      // CraftBukkit end

      if (this.n() && !flag && this.vehicle == null) {
        this.bm = (float) ((double) this.bm + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
        l = MathHelper.floor(this.locX);
        i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
        j1 = MathHelper.floor(this.locZ);
        k = this.world.getTypeId(l, i1, j1);
        if (this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) {
          k = this.world.getTypeId(l, i1 - 1, j1);
        }

        if (this.bm > (float) this.b && k > 0) {
          ++this.b;
          StepSound stepsound = Block.byId[k].stepSound;

          if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) {
            stepsound = Block.SNOW.stepSound;
            this.world.makeSound(
                this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
          } else if (!Block.byId[k].material.isLiquid()) {
            this.world.makeSound(
                this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
          }

          Block.byId[k].b(this.world, l, i1, j1, this);
        }
      }

      l = MathHelper.floor(this.boundingBox.a + 0.0010D);
      i1 = MathHelper.floor(this.boundingBox.b + 0.0010D);
      j1 = MathHelper.floor(this.boundingBox.c + 0.0010D);
      k = MathHelper.floor(this.boundingBox.d - 0.0010D);
      int k1 = MathHelper.floor(this.boundingBox.e - 0.0010D);
      int l1 = MathHelper.floor(this.boundingBox.f - 0.0010D);

      if (this.world.a(l, i1, j1, k, k1, l1)) {
        for (int i2 = l; i2 <= k; ++i2) {
          for (int j2 = i1; j2 <= k1; ++j2) {
            for (int k2 = j1; k2 <= l1; ++k2) {
              int l2 = this.world.getTypeId(i2, j2, k2);

              if (l2 > 0) {
                Block.byId[l2].a(this.world, i2, j2, k2, this);
              }
            }
          }
        }
      }

      boolean flag2 = this.ab();

      if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
        this.a(1);
        if (!flag2) {
          ++this.fireTicks;
          // CraftBukkit start
          if (this.fireTicks <= 0) {
            // not on fire yet
            CraftServer server = ((WorldServer) this.world).getServer();
            org.bukkit.entity.Entity damagee = this.getBukkitEntity();

            EntityCombustEvent event = new EntityCombustEvent(damagee);
            server.getPluginManager().callEvent(event);

            if (!event.isCancelled()) {
              this.fireTicks = 300;
            }
          } else {
            // CraftBukkit end - reset fire level back to max
            this.fireTicks = 300;
          }
        }
      } else if (this.fireTicks <= 0) {
        this.fireTicks = -this.maxFireTicks;
      }

      if (flag2 && this.fireTicks > 0) {
        this.world.makeSound(
            this,
            "random.fizz",
            0.7F,
            1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
        this.fireTicks = -this.maxFireTicks;
      }
    }
  }
コード例 #10
0
ファイル: ItemBowBauxite.java プロジェクト: DaMarine/Alkazia
  public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i) {
    boolean flag =
        entityhuman.abilities.canInstantlyBuild
            || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;

    if (flag || entityhuman.inventory.b(Items.ARROW)) {
      int j = this.d(itemstack) - i;
      float f = (float) j / 20.0F;

      f = (f * f + f * 2.0F) / 3.0F;
      if ((double) f < 0.1D) {
        return;
      }

      if (f > 1.0F) {
        f = 1.0F;
      }

      EntityArrow entityarrow = new EntityArrow(world, entityhuman, f * 2.0F);
      entityarrow.damage = 2.3D;

      if (f == 1.0F) {
        entityarrow.setCritical(true);
      }

      int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);

      if (k > 0) {
        entityarrow.b(entityarrow.j() + (double) k * 0.5D + 0.5D);
      }

      int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);

      if (l > 0) {
        entityarrow.a(l);
      }

      if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) {
        EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
        entityarrow.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
          entityarrow.setOnFire(event.getDuration());
        }
      }

      // CraftBukkit start
      EntityShootBowEvent event =
          CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
      if (event.isCancelled()) {
        event.getProjectile().remove();
        return;
      }

      if (event.getProjectile() == entityarrow.getBukkitEntity()) {
        world.addEntity(entityarrow);
      }
      // CraftBukkit end

      itemstack.damage(1, entityhuman);

      world.makeSound(
          entityhuman, "random.bow", 1.0F, 1.0F / (g.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
      if (flag) {
        entityarrow.fromPlayer = 2;
      } else {
        entityhuman.inventory.a(Items.ARROW);
      }

      entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]);
    }
  }