Exemplo n.º 1
0
  private void tossItem(ItemStack dropItem) {
    Location loc = player.getLocation();
    loc.setY(loc.getY() + 1);

    Item item = loc.getWorld().dropItem(loc, dropItem);
    Vector v = loc.getDirection().multiply(0.2);
    v.setY(0.2);
    item.setVelocity(v);
  }
  public void onActivation(Location location, SpoutPlayer player) {
    // Setting player health
    if (player.getHealth() == 20) return;
    if (player.getHealth() >= 15) player.setHealth(20);
    else player.setHealth(player.getHealth() + 5);

    // Playing red drip particles on player location
    Location loc = player.getLocation();
    Particle healParticle = new Particle(ParticleType.DRIPWATER, loc, new Vector(0.5D, 3.0D, 0.5D));
    healParticle.setParticleBlue(0.0F).setParticleGreen(0.0F).setParticleRed(1.0F);
    healParticle.setMaxAge(40).setAmount(15).setGravity(1.1F);
    healParticle.spawn();
  }
Exemplo n.º 3
0
 /**
  * Spawns this particle - making it visible to the given player
  *
  * @param player to spawn the particle for
  */
 public void spawn(SpoutPlayer player) {
   if (player.isSpoutCraftEnabled() && player.getLocation().distance(location) <= range) {
     player.sendPacket(new PacketParticle(this));
   }
 }