Пример #1
0
  @Override
  public void action() {
    Player player = MyWarp.server().getPlayerExact(type);
    if (player == null) {
      return;
    }

    if (MyWarp.inst().getWarpSettings().economyEnabled) {
      double fee =
          MyWarp.inst().getPermissionsManager().getEconomyPrices(player).getFee(Fee.WARP_TO);

      if (!MyWarp.inst().getEconomyLink().canAfford(player, fee)) {
        player.sendMessage(
            ChatColor.RED
                + MyWarp.inst()
                    .getLocalizationManager()
                    .getString("economy.cannot-afford", player, fee));
        return;
      }
    }

    warp.warp(player, true);
    if (!MyWarp.inst().getPermissionsManager().hasPermission(player, "mywarp.cooldown.disobey")) {
      MyWarp.inst()
          .getTimerFactory()
          .registerNewTimer(
              new WarpCooldown(
                  MyWarp.inst().getTimerFactory(),
                  player,
                  MyWarp.inst().getPermissionsManager().getCooldown(player)));
    }
  }
Пример #2
0
  /**
   * Initializes the warp-warmup.
   *
   * @param timerFactory the {@link TimerFactory} instance this action is registered on
   * @param player the player who is cooling down
   * @param warp the warp that the player wants to use
   * @param duration the duration of the warmup
   */
  public WarpWarmup(TimerFactory timerFactory, Player player, Warp warp, Time duration) {
    timerFactory.super(player.getName(), duration.getTicks());
    this.warp = warp;

    originalLoc = player.getLocation().clone();
    originalHealth = player.getHealth();

    if (MyWarp.inst().getWarpSettings().timersWarmupNotify) {
      player.sendMessage(
          MyWarp.inst()
              .getLocalizationManager()
              .getString(
                  "commands.warp-to.warmup.started",
                  player,
                  warp.getName(),
                  duration.getSeconds()));
    }

    if (MyWarp.inst().getWarpSettings().timersAbortOnDamage) {
      new HealthCheck().runTaskTimer(MyWarp.inst(), 20 * CHECK_FREQUENCY, 20 * CHECK_FREQUENCY);
    }
    if (MyWarp.inst().getWarpSettings().timersAbortOnMove) {
      new MovementCheck().runTaskTimer(MyWarp.inst(), 20 * CHECK_FREQUENCY, 20 * CHECK_FREQUENCY);
    }
  }