Esempio n. 1
0
  public static void treeFellerCheck(Player player, Block block, Plugin pluginx) {
    PlayerProfile PP = Users.getProfile(player);
    if (m.isAxes(player.getItemInHand())) {
      if (block != null) {
        if (!m.abilityBlockCheck(block)) return;
      }
      /*
       * CHECK FOR AXE PREP MODE
       */
      if (PP.getAxePreparationMode()) {
        PP.setAxePreparationMode(false);
      }
      int ticks = 2;
      int x = PP.getSkill("woodcutting");
      while (x >= 50) {
        x -= 50;
        ticks++;
      }

      if (!PP.getTreeFellerMode()
          && Skills.cooldownOver(
              player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)) {
        player.sendMessage(Messages.getString("Skills.TreeFellerOn"));
        for (Player y : pluginx.getServer().getOnlinePlayers()) {
          if (y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
            y.sendMessage(
                Messages.getString("Skills.TreeFellerPlayer", new Object[] {player.getName()}));
        }
        PP.setTreeFellerActivatedTimeStamp(System.currentTimeMillis());
        PP.setTreeFellerDeactivatedTimeStamp(System.currentTimeMillis() + (ticks * 1000));
        PP.setTreeFellerMode(true);
      }
      if (!PP.getTreeFellerMode()
          && !Skills.cooldownOver(
              player, PP.getTreeFellerDeactivatedTimeStamp(), LoadProperties.treeFellerCooldown)) {
        player.sendMessage(
            ChatColor.RED
                + "You are too tired to use that ability again."
                + ChatColor.YELLOW
                + " ("
                + Skills.calculateTimeLeft(
                    player,
                    PP.getTreeFellerDeactivatedTimeStamp(),
                    LoadProperties.treeFellerCooldown)
                + "s)");
      }
    }
  }