@Override
  public void run() {

    Skill skill = getSkill();

    if (skill != null && lifeTask == null) skill.useSkill(owner, x, y, z);

    deleteMe();
  }
 /** @return ид темплейта ловушки. */
 @Override
 public int getTemplateId() {
   return skill != null ? skill.getIconId() : 0;
 }
Exemple #3
0
  @Override
  public void execution(String command, Player player, String values) {
    switch (command) {
      case "event_reg":
        {
          if (values == null) {
            return;
          }

          EventManager eventManager = EventManager.getInstance();
          eventManager.registerPlayer(values, player);
          break;
        }
      case "restore_characters":
        {
          PlayerManager playerManager = PlayerManager.getInstance();
          playerManager.restoreCharacters(player);

          break;
        }
      case "help":
        player.sendMessage(help);
        break;
      case "time":
        {
          synchronized (date) {
            date.setTime(System.currentTimeMillis());
            player.sendMessage(timeFormat.format(date));
          }

          break;
        }
      case "end_pay":
        {
          Account account = player.getAccount();

          long time = account.getEndPay();

          if (System.currentTimeMillis() > time)
            player.sendMessage("У вас не проплаченный аккаунт.");
          else {
            synchronized (date) {
              date.setTime(time);
              player.sendMessage("Дата завершения проплаты: " + timeFormat.format(date));
            }
          }

          break;
        }
      case "restore_skills":
        {
          Table<IntKey, Skill> current = player.getSkills();

          DataBaseManager dbManager = DataBaseManager.getInstance();

          for (Skill skill : current) {
            if (skill.getClassId() == -15) continue;

            player.removeSkill(skill, false);

            dbManager.deleteSkill(player, skill);

            skill.fold();
          }

          current.clear();

          player.getTemplate().giveSkills(player);
          player.sendPacket(SkillListInfo.getInstance(player), true);
          break;
        }
      case "kill_me":
        {
          if (player.isBattleStanced()) {
            player.sendMessage("Нельзя использовать в бою.");
            return;
          }

          synchronized (player) {
            player.setCurrentHp(0);
            player.doDie(player);
          }

          break;
        }
      case "version":
        player.sendMessage("Текущая версия сервера: " + Config.SERVER_VERSION);
        break;
      case "online":
        {
          OnlineManager onlineManager = OnlineManager.getInstance();

          player.sendMessage("Текущий онлаин: " + onlineManager.getCurrentOnline());

          break;
        }
      case "player_info":
        {
          if (player.getName().equals(values)) return;

          Player target = World.getAroundByName(Player.class, player, values);

          if (target == null) target = World.getPlayer(values);

          if (target == null) {
            player.sendMessage(MessageType.THAT_CHARACTER_ISNT_ONLINE);
            return;
          }

          StringBuilder builder =
              new StringBuilder("\n--------\nPlayer: \"").append(target.getName()).append("\":\n");

          builder.append("attack:").append(target.getAttack(null, null)).append(";\n");
          builder.append("defense:").append(target.getDefense(null, null)).append(";\n");
          builder.append("impact:").append(target.getImpact(null, null)).append(";\n");
          builder.append("balance:").append(target.getBalance(null, null)).append(";\n");
          builder.append("max hp:").append(target.getMaxHp()).append(".\n");
          builder.append("--------");

          player.sendMessage(builder.toString());

          break;
        }
    }
  }