Exemplo n.º 1
0
  @Override
  public boolean effect(Player p, Block b) {
    Location loc = b.getLocation().add(0, 1, 0);

    if (!loc.getBlock().isEmpty()) {
      return false;
    }

    for (int x = -1; x <= 1; x++) {
      for (int z = -1; z <= 1; z++) {
        Location l = loc;
        Effects.play(l.add(x, 0, z), Effect.TILE_BREAK, NUM);
      }
    }
    Zombie z = p.getWorld().spawn(loc, Zombie.class);

    for (Entity e : p.getNearbyEntities(20, 20, 20)) {
      if (e instanceof Player && !e.equals(p)) {
        z.setTarget((Player) e);
        break;
      }
    }

    return true;
  }
 /** Remove all the old shop items who aren't deleted for some reason */
 public void removeDupedItems() {
   Chunk c = getBlock().getChunk();
   for (Entity e : c.getEntities()) {
     if (e.getLocation().getBlock().equals(getBlock()) && e instanceof Item && !e.equals(item)) {
       e.remove();
     }
     if (e.getLocation()
             .getBlock()
             .equals(
                 getWorld()
                     .getBlockAt(getBlock().getX(), getBlock().getY() + 1, getBlock().getZ()))
         && e instanceof Item
         && !e.equals(item)) {
       e.remove();
     }
   }
 }
Exemplo n.º 3
0
  public void manageAirVectors() {
    for (int i = 0; i < tasks.size(); i++) {
      if (((FireComboStream) tasks.get(i)).isCancelled()) {
        tasks.remove(i);
        i--;
      }
    }
    if (tasks.size() == 0) {
      remove();
      return;
    }
    for (int i = 0; i < tasks.size(); i++) {
      FireComboStream fstream = (FireComboStream) tasks.get(i);
      Location loc = fstream.getLocation();

      if (GeneralMethods.isRegionProtectedFromBuild(this, loc)) {
        fstream.remove();
        return;
      }

      if (!isTransparent(loc.getBlock())) {
        if (!isTransparent(loc.clone().add(0, 0.2, 0).getBlock())) {
          fstream.remove();
          return;
        }
      }
      if (i % 3 == 0) {
        for (Entity entity : GeneralMethods.getEntitiesAroundPoint(loc, 2.5)) {
          if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
            remove();
            return;
          }
          if (!entity.equals(player) && !affectedEntities.contains(entity)) {
            affectedEntities.add(entity);
            if (knockback != 0) {
              Vector force = fstream.getDirection();
              entity.setVelocity(force.multiply(knockback));
            }
            if (damage != 0) {
              if (entity instanceof LivingEntity) {
                if (fstream.getAbility().equalsIgnoreCase("AirSweep")) {
                  DamageHandler.damageEntity(entity, damage, this);
                } else {
                  DamageHandler.damageEntity(entity, damage, this);
                }
              }
            }
          }
        }

        if (GeneralMethods.blockAbilities(player, FireCombo.getBlockableAbilities(), loc, 1)) {
          fstream.remove();
        } else AirAbility.removeAirSpouts(loc, player);
        WaterAbility.removeWaterSpouts(loc, player);
        EarthAbility.removeSandSpouts(loc, player);
      }
    }
  }
  private void aoe(Entity projectile, ProjectileInfo info) {
    playSpellEffects(EffectPosition.SPECIAL, projectile.getLocation());
    List<Entity> entities = projectile.getNearbyEntities(aoeRadius, aoeRadius, aoeRadius);
    for (Entity entity : entities) {
      if (entity instanceof LivingEntity
          && (targetPlayers || !(entity instanceof Player))
          && !entity.equals(info.player)) {
        LivingEntity target = (LivingEntity) entity;
        float power = info.power;

        // call target event
        SpellTargetEvent evt = new SpellTargetEvent(this, info.player, target, power);
        Bukkit.getPluginManager().callEvent(evt);
        if (evt.isCancelled()) {
          continue;
        } else if (allowTargetChange) {
          target = evt.getTarget();
        }
        power = evt.getPower();

        // run spells
        for (Subspell spell : spells) {
          if (spell.isTargetedEntitySpell()) {
            spell.castAtEntity(info.player, target, power);
            playSpellEffects(EffectPosition.TARGET, target);
          } else if (spell.isTargetedLocationSpell()) {
            spell.castAtLocation(info.player, target.getLocation(), power);
            playSpellEffects(EffectPosition.TARGET, target.getLocation());
          }
        }

        // send message if player
        if (target instanceof Player) {
          sendMessage(
              formatMessage(strHitTarget, "%a", info.player.getDisplayName()),
              (Player) target,
              MagicSpells.NULL_ARGS);
        }
      }
    }
    sendMessage(strHitCaster, info.player, MagicSpells.NULL_ARGS);
  }
Exemplo n.º 5
0
  public Suffocate(Player player) {
    this.player = player;
    bplayer = GeneralMethods.getBendingPlayer(player.getName());
    targets = new ArrayList<LivingEntity>();
    tasks = new ArrayList<BukkitRunnable>();
    time = System.currentTimeMillis();

    // reloadVariables();
    reqConstantAim = REQUIRE_CONSTANT_AIM;
    canSuffUndead = CAN_SUFFOCATE_UNDEAD;
    chargeTime = CHARGE_TIME;
    cooldown = COOLDOWN;
    particleScale = ANIM_PARTICLE_AMOUNT;
    range = RANGE;
    radius = ANIM_RADIUS;
    speedFactor = ANIM_SPEED;
    aimRadius = AIM_RADIUS;
    damage = DAMAGE;
    damageDelay = DAMAGE_INITIAL_DELAY;
    damageRepeat = DAMAGE_INTERVAL;
    slow = SLOW;
    slowRepeat = SLOW_INTERVAL;
    slowDelay = SLOW_DELAY;
    blind = BLIND;
    blindDelay = BLIND_DELAY;
    blindRepeat = BLIND_INTERVAL;

    if (instances.containsKey(player)) {
      return;
    }

    if (AvatarState.isAvatarState(player)) {
      cooldown = 0;
      chargeTime = 0;
      reqConstantAim = false;
      damage = AvatarState.getValue(damage);
      range *= 2;
      slow = AvatarState.getValue(slow);
      slowRepeat = AvatarState.getValue(slowRepeat);
      blind = AvatarState.getValue(blind);
      blindRepeat = AvatarState.getValue(blindRepeat);
    }
    if (particleScale < 1) particleScale = 1;
    else if (particleScale > 2) particleScale = 2;

    if (AvatarState.isAvatarState(player)) {
      for (Entity ent : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), range))
        if (ent instanceof LivingEntity && !ent.equals(player)) targets.add((LivingEntity) ent);
    } else {
      // Entity ent = GeneralMethods.getTargetedEntity(player, range, new ArrayList<Entity>());
      List<Entity> entities = new ArrayList<Entity>();
      for (int i = 0; i < 6; i++) {
        Location location = GeneralMethods.getTargetedLocation(player, i, transparent);
        entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
        if (entities.contains(player)) entities.remove(player);
        if (entities != null && !entities.isEmpty() && !entities.contains(player)) {
          break;
        }
      }
      if (entities == null || entities.isEmpty()) {
        return;
      }
      Entity target = entities.get(0);
      if (target != null && target instanceof LivingEntity) targets.add((LivingEntity) target);
    }

    if (!canSuffUndead) {
      for (int i = 0; i < targets.size(); i++) {
        LivingEntity target = targets.get(i);
        if (GeneralMethods.isUndead(target)) {
          targets.remove(i);
          i--;
        }
      }
    }

    if (targets.size() == 0) return;
    else if (bplayer.isOnCooldown("suffocate")) return;
    bplayer.addCooldown("suffocate", cooldown);
    instances.put(player, this);
  }
Exemplo n.º 6
0
  @Override
  public void progress() {
    progressCounter++;
    if (player.isDead() || !player.isOnline()) {
      remove();
      return;
    } else if (currentLoc != null && GeneralMethods.isRegionProtectedFromBuild(this, currentLoc)) {
      remove();
      return;
    }

    if (abilityName.equalsIgnoreCase("Twister")) {
      if (destination == null) {
        state = AbilityState.TWISTER_MOVING;
        direction = player.getEyeLocation().getDirection().clone().normalize();
        direction.setY(0);
        origin = player.getLocation().add(direction.clone().multiply(2));
        destination = player.getLocation().add(direction.clone().multiply(range));
        currentLoc = origin.clone();
      }
      if (origin.distanceSquared(currentLoc) < origin.distanceSquared(destination)
          && state == AbilityState.TWISTER_MOVING) {
        currentLoc.add(direction.clone().multiply(speed));
      } else if (state == AbilityState.TWISTER_MOVING) {
        state = AbilityState.TWISTER_STATIONARY;
        time = System.currentTimeMillis();
      } else if (System.currentTimeMillis() - time >= twisterRemoveDelay) {
        remove();
        return;
      } else if (GeneralMethods.isRegionProtectedFromBuild(this, currentLoc)) {
        remove();
        return;
      }

      Block topBlock = GeneralMethods.getTopBlock(currentLoc, 3, -3);
      if (topBlock == null) {
        remove();
        return;
      }
      currentLoc.setY(topBlock.getLocation().getY());

      double height = twisterHeight;
      double radius = twisterRadius;
      for (double y = 0; y < height; y += twisterHeightParticles) {
        double animRadius = ((radius / height) * y);
        for (double i = -180; i <= 180; i += twisterDegreeParticles) {
          Vector animDir = GeneralMethods.rotateXZ(new Vector(1, 0, 1), i);
          Location animLoc = currentLoc.clone().add(animDir.multiply(animRadius));
          animLoc.add(0, y, 0);
          playAirbendingParticles(animLoc, 1, 0, 0, 0);
        }
      }
      playAirbendingSound(currentLoc);

      for (int i = 0; i < height; i += 3) {
        for (Entity entity :
            GeneralMethods.getEntitiesAroundPoint(currentLoc.clone().add(0, i, 0), radius * 0.75)) {
          if (!affectedEntities.contains(entity) && !entity.equals(player)) {
            affectedEntities.add(entity);
          }
        }
      }

      for (Entity entity : affectedEntities) {
        Vector forceDir =
            GeneralMethods.getDirection(entity.getLocation(), currentLoc.clone().add(0, height, 0));
        if (entity instanceof Player) {
          if (Commands.invincible.contains(((Player) entity).getName())) {
            break;
          }
        }
        entity.setVelocity(forceDir.clone().normalize().multiply(0.3));
      }
    } else if (abilityName.equalsIgnoreCase("AirStream")) {
      if (destination == null) {
        origin = player.getEyeLocation();
        currentLoc = origin.clone();
      }
      Entity target = GeneralMethods.getTargetedEntity(player, range);
      if (target instanceof Player) {
        if (Commands.invincible.contains(((Player) target).getName())) {
          return;
        }
      }

      if (target != null && target.getLocation().distanceSquared(currentLoc) > 49) {
        destination = target.getLocation();
      } else {
        destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterial());
      }

      direction = GeneralMethods.getDirection(currentLoc, destination).normalize();
      currentLoc.add(direction.clone().multiply(speed));

      if (player.getWorld() != currentLoc.getWorld()) {
        remove();
        return;
      } else if (!player.isSneaking()) {
        remove();
        return;
      } else if (player.getWorld().equals(currentLoc.getWorld())
          && Math.abs(player.getLocation().distanceSquared(currentLoc)) > range * range) {
        remove();
        return;
      } else if (affectedEntities.size() > 0
          && System.currentTimeMillis() - time >= airStreamEntityCarryDuration) {
        remove();
        return;
      } else if (!isTransparent(currentLoc.getBlock())) {
        remove();
        return;
      } else if (currentLoc.getY() - origin.getY() > airStreamMaxEntityHeight) {
        remove();
        return;
      } else if (GeneralMethods.isRegionProtectedFromBuild(this, currentLoc)) {
        remove();
        return;
      } else if (FireAbility.isWithinFireShield(currentLoc)) {
        remove();
        return;
      } else if (isWithinAirShield(currentLoc)) {
        remove();
        return;
      } else if (!isTransparent(currentLoc.getBlock())) {
        currentLoc.subtract(direction.clone().multiply(speed));
      }

      for (int i = 0; i < 10; i++) {
        BukkitRunnable br =
            new BukkitRunnable() {
              final Location loc = currentLoc.clone();
              final Vector dir = direction.clone();

              @Override
              public void run() {
                for (int angle = -180; angle <= 180; angle += 45) {
                  Vector orthog = GeneralMethods.getOrthogonalVector(dir.clone(), angle, 0.5);
                  playAirbendingParticles(loc.clone().add(orthog), 1, 0F, 0F, 0F);
                }
              }
            };
        br.runTaskLater(ProjectKorra.plugin, i * 2);
        tasks.add(br);
      }

      for (Entity entity : GeneralMethods.getEntitiesAroundPoint(currentLoc, 2.8)) {
        if (affectedEntities.size() == 0) {
          // Set the timer to remove the ability
          time = System.currentTimeMillis();
        }
        if (!entity.equals(player) && !affectedEntities.contains(entity)) {
          affectedEntities.add(entity);
          if (entity instanceof Player) {
            flights.add(new Flight((Player) entity, player));
          }
        }
      }

      for (Entity entity : affectedEntities) {
        Vector force = GeneralMethods.getDirection(entity.getLocation(), currentLoc);
        entity.setVelocity(force.clone().normalize().multiply(speed));
        entity.setFallDistance(0F);
      }
    } else if (abilityName.equalsIgnoreCase("AirSweep")) {
      if (origin == null) {
        direction = player.getEyeLocation().getDirection().normalize();
        origin = player.getLocation().add(direction.clone().multiply(10));
      }
      if (progressCounter < 8) {
        return;
      }
      if (destination == null) {
        destination =
            player
                .getLocation()
                .add(player.getEyeLocation().getDirection().normalize().multiply(10));
        Vector origToDest = GeneralMethods.getDirection(origin, destination);
        for (double i = 0; i < 30; i++) {
          Vector vec =
              GeneralMethods.getDirection(
                  player.getLocation(), origin.clone().add(origToDest.clone().multiply(i / 30)));

          FireComboStream fs =
              new FireComboStream(null, vec, player.getLocation(), range, speed, "AirSweep");
          fs.setDensity(1);
          fs.setSpread(0F);
          fs.setUseNewParticles(true);
          fs.setParticleEffect(getAirbendingParticles());
          fs.setCollides(false);
          fs.runTaskTimer(ProjectKorra.plugin, (long) (i / 2.5), 1L);
          tasks.add(fs);
        }
      }
      manageAirVectors();
    }
  }
Exemplo n.º 7
0
  public Suffocate(Player player) {
    super(player);
    ability = this;
    if (bPlayer.isOnCooldown(this)) {
      return;
    } else if (hasAbility(player, Suffocate.class)) {
      return;
    }

    this.started = false;
    this.requireConstantAim = getConfig().getBoolean("Abilities.Air.Suffocate.RequireConstantAim");
    this.canSuffocateUndead =
        getConfig().getBoolean("Abilities.Air.Suffocate.CanBeUsedOnUndeadMobs");
    this.particleCount = getConfig().getInt("Abilities.Air.Suffocate.AnimationParticleAmount");
    this.animationSpeed = getConfig().getDouble("Abilities.Air.Suffocate.AnimationSpeed");
    this.chargeTime = getConfig().getLong("Abilities.Air.Suffocate.ChargeTime");
    this.cooldown = getConfig().getLong("Abilities.Air.Suffocate.Cooldown");
    this.range = getConfig().getDouble("Abilities.Air.Suffocate.Range");
    this.radius = getConfig().getDouble("Abilities.Air.Suffocate.AnimationRadius");
    this.constantAimRadius =
        getConfig().getDouble("Abilities.Air.Suffocate.RequireConstantAimRadius");
    this.damage = getConfig().getDouble("Abilities.Air.Suffocate.Damage");
    this.damageDelay = getConfig().getDouble("Abilities.Air.Suffocate.DamageInitialDelay");
    this.damageRepeat = getConfig().getDouble("Abilities.Air.Suffocate.DamageInterval");
    this.slow = getConfig().getInt("Abilities.Air.Suffocate.SlowPotency");
    this.slowRepeat = getConfig().getDouble("Abilities.Air.Suffocate.SlowInterval");
    this.slowDelay = getConfig().getDouble("Abilities.Air.Suffocate.SlowDelay");
    this.blind = getConfig().getInt("Abilities.Air.Suffocate.BlindPotentcy");
    this.blindDelay = getConfig().getDouble("Abilities.Air.Suffocate.BlindDelay");
    this.blindRepeat = getConfig().getDouble("Abilities.Air.Suffocate.BlindInterval");
    this.targets = new ArrayList<>();
    this.tasks = new ArrayList<>();

    if (bPlayer.isAvatarState()) {
      cooldown = 0;
      chargeTime = 0;
      requireConstantAim = false;
      damage = AvatarState.getValue(damage);
      range *= 2;
      slow = AvatarState.getValue(slow);
      slowRepeat = AvatarState.getValue(slowRepeat);
      blind = AvatarState.getValue(blind);
      blindRepeat = AvatarState.getValue(blindRepeat);
    }

    if (particleCount < 1) {
      particleCount = 1;
    } else if (particleCount > 2) {
      particleCount = 2;
    }

    if (bPlayer.isAvatarState()) {
      for (Entity ent : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), range)) {
        if (ent instanceof LivingEntity && !ent.equals(player)) {
          targets.add((LivingEntity) ent);
        }
      }
    } else {
      // Location location = GeneralMethods.getTargetedLocation(player, 6,
      // getTransparentMaterial());
      // List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
      List<Entity> entities = new ArrayList<Entity>();
      for (int i = 0; i < 6; i++) {
        Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
        entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
        if (entities.contains(player)) entities.remove(player);
        if (entities != null && !entities.isEmpty() && !entities.contains(player)) {
          break;
        }
      }
      if (entities == null || entities.isEmpty()) {
        return;
      }
      Entity target = entities.get(0);
      if (target != null && target instanceof LivingEntity) {
        targets.add((LivingEntity) target);
      }
    }

    if (!canSuffocateUndead) {
      for (int i = 0; i < targets.size(); i++) {
        LivingEntity target = targets.get(i);
        if (GeneralMethods.isUndead(target)) {
          targets.remove(i);
          i--;
        }
      }
    }

    bPlayer.addCooldown(this);
    start();
  }
Exemplo n.º 8
0
  @Override
  public void run() {
    for (Location l : Storage.blackholes.keySet()) {
      for (Entity e : Utilities.getNearbyEntities(l, 10, 10, 10)) {
        if (e instanceof Player) {
          if (((Player) e).getGameMode().equals(CREATIVE)) {
            continue;
          }
        }
        if (Storage.blackholes.get(l)) {
          Vector v = l.clone().subtract(e.getLocation()).toVector();
          v.setX(v.getX() + (-.5f + Storage.rnd.nextFloat()) * 10);
          v.setY(v.getY() + (-.5f + Storage.rnd.nextFloat()) * 10);
          v.setZ(v.getZ() + (-.5f + Storage.rnd.nextFloat()) * 10);
          e.setVelocity(v.multiply(.35f));
          e.setFallDistance(0);
        } else {
          Vector v = e.getLocation().subtract(l.clone()).toVector();
          v.setX(v.getX() + (-.5f + Storage.rnd.nextFloat()) * 2);
          v.setY(v.getY() + Storage.rnd.nextFloat());
          v.setZ(v.getZ() + (-.5f + Storage.rnd.nextFloat()) * 2);
          e.setVelocity(v.multiply(.35f));
        }
      }
    }
    // Arrows
    toRemove.clear();
    for (Set<CustomArrow> pro : Storage.advancedProjectiles.values()) {
      for (CustomArrow a : pro) {
        a.onFlight();
        a.tick++;
        if (a.entity.isDead() || a.tick > 600) {
          toRemove.add(a);
        }
      }
    }
    for (CustomArrow pro : toRemove) {
      Storage.advancedProjectiles.remove(pro.entity);
      pro.entity.remove();
    }
    for (Block block : Storage.webs) {
      if (Storage.rnd.nextInt(175) == 0 && block.getChunk().isLoaded()) {
        block.setType(AIR);
        websToRemove.add(block);
      }
    }
    for (Block block : websToRemove) {
      Storage.webs.remove(block);
    }
    websToRemove.clear();
    for (LivingEntity ent : Storage.derpingEntities) {
      Location loc = ent.getLocation();
      loc.setYaw(Storage.rnd.nextFloat() * 360F);
      loc.setPitch(Storage.rnd.nextFloat() * 180F - 90F);
      ent.teleport(loc);
    }
    tick++;
    // Other stuff
    for (FallingBlock b : Storage.anthMobs2) {
      if (!Storage.anthVortex.contains(Storage.anthMobs.get(b))) {
        for (Entity e : b.getNearbyEntities(7, 7, 7)) {
          if (e instanceof LivingEntity) {
            LivingEntity lE = (LivingEntity) e;
            if (!(lE instanceof Player) && lE instanceof Monster) {
              b.setVelocity(e.getLocation().subtract(b.getLocation()).toVector().multiply(.25));
              if (lE.getLocation().getWorld().equals(b.getLocation().getWorld())) {
                if (lE.getLocation().distance(b.getLocation()) < 1.2) {
                  EntityDamageEvent evt =
                      new EntityDamageEvent(lE, EntityDamageEvent.DamageCause.SUFFOCATION, 100);
                  Bukkit.getPluginManager().callEvent(evt);
                  lE.setLastDamageCause(evt);
                  if (!evt.isCancelled()) {
                    lE.damage(8f);
                  }
                }
              }
            }
          }
        }
      }
    }
    boolean r = Storage.fallBool;
    Storage.fallBool = !Storage.fallBool;
    for (FallingBlock b : Storage.anthMobs.keySet()) {
      if (Storage.anthVortex.contains(Storage.anthMobs.get(b))) {
        Location loc = Storage.anthMobs.get(b).getLocation();
        Vector v;
        if (b.getLocation().getWorld().equals(Storage.anthMobs.get(b).getLocation().getWorld())) {
          if (r && b.getLocation().distance(Storage.anthMobs.get(b).getLocation()) < 10) {
            v = b.getLocation().subtract(loc).toVector();
          } else {
            int x = Storage.rnd.nextInt(12) - 6;
            int z = Storage.rnd.nextInt(12) - 6;
            Location tLoc = loc.clone();
            tLoc.setX(tLoc.getX() + x);
            tLoc.setZ(tLoc.getZ() + z);
            v = tLoc.subtract(b.getLocation()).toVector();
          }
          v.multiply(.05);
          boolean close = false;
          for (int x = -3; x < 0; x++) {
            if (b.getLocation().getBlock().getRelative(0, x, 0).getType() != AIR) {
              close = true;
            }
          }
          if (close) {
            v.setY(5);
          } else {
            v.setY(-.1);
          }
          b.setVelocity(v);
        }
      }
    }

    for (Arrow e : Storage.tracer.keySet()) {
      Entity close = null;
      double distance = 100;
      int level = Storage.tracer.get(e);
      level = level + 2;
      for (Entity e1 : e.getNearbyEntities(level, level, level)) {
        if (e1.getLocation().getWorld().equals(e.getLocation().getWorld())) {
          double d = e1.getLocation().distance(e.getLocation());
          if (e.getLocation()
              .getWorld()
              .equals(((Entity) e.getShooter()).getLocation().getWorld())) {
            if (d < distance
                && e1 instanceof LivingEntity
                && !e1.equals(e.getShooter())
                && e.getLocation().distance(((Entity) e.getShooter()).getLocation()) > 15) {
              distance = d;
              close = e1;
            }
          }
        }
      }
      if (close != null) {
        Location location = close.getLocation();
        org.bukkit.util.Vector v = new org.bukkit.util.Vector(0D, 0D, 0D);
        Location pos = e.getLocation();
        double its =
            Math.sqrt(
                (location.getBlockX() - pos.getBlockX()) * (location.getBlockX() - pos.getBlockX())
                    + (location.getBlockY() - pos.getBlockY())
                        * (location.getBlockY() - pos.getBlockY())
                    + (location.getBlockZ() - pos.getBlockZ())
                        * (location.getBlockZ() - pos.getBlockZ()));
        if (its == 0) {
          its = (double) 1;
        }
        v.setX((location.getBlockX() - pos.getBlockX()) / its);
        v.setY((location.getBlockY() - pos.getBlockY()) / its);
        v.setZ((location.getBlockZ() - pos.getBlockZ()) / its);
        e.setVelocity(v.multiply(2));
      }
    }

    for (Guardian g : Storage.guardianMove.keySet()) {
      if (g.getLocation().distance(Storage.guardianMove.get(g).getLocation()) > 2
          && g.getTicksLived() < 160) {
        g.setVelocity(
            Storage.guardianMove
                .get(g)
                .getLocation()
                .toVector()
                .subtract(g.getLocation().toVector()));
      } else {
        Storage.guardianMove.remove(g);
      }
    }

    for (Player player : Bukkit.getOnlinePlayers()) {
      Config config = Config.get(player.getWorld());
      for (ItemStack stk : player.getInventory().getArmorContents()) {
        HashMap<CustomEnchantment, Integer> map = config.getEnchants(stk);
        for (CustomEnchantment ench : map.keySet()) {
          ench.onFastScan(player, map.get(ench));
        }
      }
      HashMap<CustomEnchantment, Integer> map = config.getEnchants(player.getItemInHand());
      for (CustomEnchantment ench : map.keySet()) {
        ench.onFastScanHand(player, map.get(ench));
      }
    }
    HashSet<Player> toDelete = new HashSet<>();
    for (Player player : Storage.hungerPlayers.keySet()) {
      if (Storage.hungerPlayers.get(player) < 1) {
        toDelete.add(player);
      } else {
        Storage.hungerPlayers.put(player, Storage.hungerPlayers.get(player) - 1);
      }
    }
    for (Player p : toDelete) {
      Storage.hungerPlayers.remove(p);
    }
    toDelete.clear();
    for (Player player : Storage.moverBlockDecay.keySet()) {
      Storage.moverBlockDecay.put(player, Storage.moverBlockDecay.get(player) + 1);
      if (Storage.moverBlockDecay.get(player) > 5) {
        Storage.moverBlocks.remove(player);
        toDelete.add(player);
      }
    }
    for (Player p : toDelete) {
      Storage.moverBlockDecay.remove(p);
    }
  }