@Override
  public void run(SpawnableEntity entity, CommandSender sender, String subCommand, String[] args) {
    String in = getValue(args, 0, "false");
    entity.setSaddled(Boolean.parseBoolean(in));

    PLUGIN.sendMessage(sender, getSuccessMessage(entity, "saddled", in));
  }
  // Load spawners and entities from world files
  public List<Spawner> loadData() {

    Iterator<World> worldItr = PLUGIN.getServer().getWorlds().iterator();
    List<Spawner> loaded = new ArrayList<Spawner>();

    while (worldItr.hasNext()) {
      World w = worldItr.next();

      Iterator<SpawnableEntity> entitiesFromWorld = loadAllEntitiesFromWorld(w).iterator();
      while (entitiesFromWorld.hasNext()) {
        SpawnableEntity e = entitiesFromWorld.next();
        int nextId = PLUGIN.getNextEntityId();
        if (CustomSpawners.entities.containsKey(e.getId())) {
          e = e.cloneWithNewId(nextId);
        }
        CustomSpawners.entities.put(nextId, e);
      }

      Iterator<Spawner> spawnersFromWorld = loadAllSpawnersFromWorld(w).iterator();
      while (spawnersFromWorld.hasNext()) {
        Spawner s = spawnersFromWorld.next();
        boolean sameSpawner = false;

        for (Spawner s1 : CustomSpawners.spawners.values()) {
          if (s1.getLoc().equals(s.getLoc())) {
            sameSpawner = true;
          }
        }

        if (sameSpawner) {
          continue;
        } else {
          int nextId = PLUGIN.getNextSpawnerId();
          Spawner s1 = PLUGIN.cloneWithNewId(s);
          CustomSpawners.spawners.put(nextId, s1);
          loaded.add(s1);
        }
      }
    }

    return loaded;
  }
  @Override
  public void run(SpawnableEntity entity, CommandSender sender, String subCommand, String[] args) {

    /*
     * Syntax:
     *
     * <attribute name> <base> [<modifier name>,<operator>,<amount>;...]
     */

    if (subCommand.equals("clearattributes")) {
      entity.setAttributes(new ArrayList<Attribute>());
      PLUGIN.sendMessage(
          sender,
          ChatColor.GREEN
              + "Successfully cleared attributes on entity "
              + ChatColor.GOLD
              + PLUGIN.getFriendlyName(entity)
              + ChatColor.GREEN
              + ".");
      return;
    }

    String in = getValue(args, 0, "generic.maxHealth");

    VanillaAttribute att = PLUGIN.parseAttribute(in);

    if (att == null) {
      PLUGIN.sendMessage(sender, ChatColor.RED + "That is not an attribute type.");
      return;
    }

    String in0 = getValue(args, 1, "" + att.getDefaultBase());

    if (!CustomSpawners.isDouble(in0)) {
      PLUGIN.sendMessage(sender, ChatColor.RED + "The base value must be number.");
      return;
    }

    double base = Double.parseDouble(in0);

    if (base < att.getMinimum() || (base > att.getMaximum() && att.getMaximum() != -1)) {
      PLUGIN.sendMessage(
          sender,
          ChatColor.RED
              + "The base value must be between the "
              + "minimum and maximum values of the attribute.");
      return;
    }

    Attribute newAtt = new Attribute(att);
    newAtt.setBase(base);

    String in1 = getValue(args, 2, "");

    if (!in1.isEmpty()) {
      String[] splitMods = in1.split(";");

      for (String mod : splitMods) {
        String[] splitCommas = mod.split(",");
        String modName = splitCommas[0];
        String operator = splitCommas[1];
        String amount = splitCommas[2];

        Operation op = Operation.fromName(operator);

        if (op == null && CustomSpawners.isInteger(operator))
          op = Operation.fromId(Integer.parseInt(operator));

        if (op == null) {
          PLUGIN.sendMessage(
              sender, ChatColor.RED + "\"" + modName + "\" is not an operation for modifiers.");
          return;
        }

        if (!CustomSpawners.isDouble(amount)) {
          PLUGIN.sendMessage(sender, ChatColor.RED + "The amount for a modifier must be a number.");
          return;
        }

        double amt = Double.parseDouble(amount);

        Modifier newMod = new Modifier(modName, op, amt);
        newAtt.addModifier(newMod);
      }
    }

    Iterator<Attribute> attItr = entity.getAttributes().iterator();
    while (attItr.hasNext()) {
      Attribute a = attItr.next();
      if (a.getAttribute().equals(newAtt.getAttribute())) {
        attItr.remove();
        PLUGIN.sendMessage(sender, ChatColor.GOLD + "Replaced attribute with same type.");
      }
    }

    if (subCommand.equals("addattribute")) {
      entity.addAttribute(newAtt);
      PLUGIN.sendMessage(
          sender,
          ChatColor.GREEN
              + "Successfully added attribute "
              + ChatColor.GOLD
              + in
              + ChatColor.GREEN
              + " to entity "
              + ChatColor.GOLD
              + PLUGIN.getFriendlyName(entity)
              + ChatColor.GREEN
              + ".");
    } else if (subCommand.equals("setattribute")) {
      List<Attribute> list = new ArrayList<Attribute>();
      list.add(newAtt);
      entity.setAttributes(list);
      PLUGIN.sendMessage(
          sender,
          ChatColor.GREEN
              + "Successfully set attribute to "
              + ChatColor.GOLD
              + in
              + ChatColor.GREEN
              + " on entity "
              + ChatColor.GOLD
              + PLUGIN.getFriendlyName(entity)
              + ChatColor.GREEN
              + ".");
    }
  }