public static Agent parse(String name, String data) {
    if (name.equalsIgnoreCase("PROJECTILE")) name = "PROJECTILE_ANY";

    name = name.toUpperCase().replace("PROJECTILE_", "");
    Material mat;
    if (name.equals("FIRE") || name.equals("FIREBALL")) mat = Material.FIRE;
    else if (name.equals("SNOW_BALL")) mat = Material.SNOW_BALL;
    else if (name.equals("EGG")) mat = Material.EGG;
    else if (name.equals("FISH") || name.equals("FISHING_ROD")) mat = Material.FISHING_ROD;
    else if (name.equals("ARROW")) mat = Material.ARROW;
    else if (name.equals("ANY")) mat = null;
    else {
      Log.logInfo("Unknown projectile: " + name, Verbosity.NORMAL);
      return null;
    }
    // Parse data, which is one of the following
    // - A EntityType constant (note that only GHAST and SKELETON will
    // actually do anything
    // unless there's some other plugin making entities shoot things)
    // - One of the special words PLAYER or DISPENSER
    // - Something else, which is taken to be a player name
    // - Nothing
    if (data.isEmpty()) return new ProjectileAgent(mat, false); // Specific projectile, any
    // shooter
    if (data.equalsIgnoreCase("DISPENSER")) return new ProjectileAgent(mat, true);
    else if (data.startsWith("PLAYER")) {
      String[] dataSplit = data.split(";");
      String playerName = null;
      if (dataSplit.length > 1) {
        playerName = dataSplit[1];
      }

      return new ProjectileAgent(mat, playerName);
    }

    EntityType creature = CommonEntity.getCreatureEntityType(data);
    if (creature != null) return new ProjectileAgent(mat, creature);
    return new ProjectileAgent(mat, data);
  }
 private static Material getProjectileType(Projectile missile) {
   return CommonEntity.getProjectileType(missile);
 }