Пример #1
0
  /**
   * Removes a warp from the configuration file.
   *
   * @param player The player who sent the command.
   * @param name The name of the warp.
   */
  public void delWarp(Player player, String name) {
    if (!config.checkWarp(name))
      player.sendMessage("§cInvalid warp. Use §6/expugn warplist §cfor a list of warps.");
    else {
      config.set("warps." + name, null);
      config.set("data.cooldown." + name, null);
      config.set("data.limit." + name, null);

      player.sendMessage("§aWarp §6" + name + " §ahas been removed.");
    }
  }
Пример #2
0
  /**
   * Sets the 'type' setting of a warp.
   *
   * @param player The player who sent the command.
   * @param name The name of the warp.
   * @param param 'cooldown' or 'limit', alternate warp, or a value to determine the hourly cooldown
   *     or daily limit
   */
  public void warpSetting(Player player, String name, String param) {
    if (!config.checkWarp(name)) {
      player.sendMessage("§cInvalid warp. Use §6/expugn warplist §cfor a list of warps.");
      return;
    }

    if (param.equals("cooldown") || param.equals("limit")) {
      config.set("warps." + name + ".type", param);
      player.sendMessage("§aWarp " + name + " type modified to §6" + param);
    } else if (config.checkWarp(param)) {
      if (param.equalsIgnoreCase(name))
        player.sendMessage("§cYou cannot assign the same warp to be an alternate warp.");
      else {
        config.set("warps." + name + ".else", param);
        player.sendMessage("§aWarp " + name + " alternate warp modified to §6" + param);
      }
    } else {
      int value = Integer.parseInt(param);
      config.set("warps." + name + ".value", value);
      player.sendMessage("§aWarp " + name + " value modified to §6" + value);
    }
  }
Пример #3
0
  /**
   * Gets the player's location and saves it onto the configuration file.
   *
   * @param player The player who sent the command.
   * @param name The name of the warp.
   */
  public void setWarp(Player player, String name) {
    Location loc = player.getLocation();

    if (!config.checkWarp(name)) {
      player.sendMessage("§6Warp does not exist. Creating a new warp.");

      config.set("warps." + name + ".x", loc.getX());
      config.set("warps." + name + ".y", loc.getY());
      config.set("warps." + name + ".z", loc.getZ());
      config.set("warps." + name + ".yaw", loc.getYaw());
      config.set("warps." + name + ".pitch", loc.getPitch());
      config.set("warps." + name + ".world", player.getWorld().getName());
      config.set("warps." + name + ".type", "cooldown");
      config.set("warps." + name + ".value", 0);

      player.sendMessage(
          "§a- Use /expugn warpsetting " + name + " <cooldown|limit> to modify the type of warp.");
      player.sendMessage(
          "§a- Use /expugn warpsetting "
              + name
              + " [number] to modify the cooldown/daily limit of the warp.");
      player.sendMessage(
          "§a- Use /expugn warpsetting "
              + name
              + " [warpname] to add a alternate location to send the player if they failed to warp.");
    } else {
      player.sendMessage("§6There is an existing warp. Defining new position.");

      config.set("warps." + name + ".x", loc.getX());
      config.set("warps." + name + ".y", loc.getY());
      config.set("warps." + name + ".z", loc.getZ());
      config.set("warps." + name + ".yaw", loc.getYaw());
      config.set("warps." + name + ".pitch", loc.getPitch());
      config.set("warps." + name + ".world", player.getWorld().getName());
    }
  }