private boolean setupSQL() {
    if (config.getSQLValue().equalsIgnoreCase("MySQL")) {
      dataop =
          new MySQLOptions(
              config.getHostname(),
              config.getPort(),
              config.getDatabase(),
              config.getUsername(),
              config.getPassword());
    } else if (config.getSQLValue().equalsIgnoreCase("SQLite")) {
      dataop = new SQLiteOptions(new File(getDataFolder() + "/coupon_data.db"));
    } else if (!config.getSQLValue().equalsIgnoreCase("MySQL")
        && !config.getSQLValue().equalsIgnoreCase("SQLite")) {
      sendErr("The SQLType has the unknown value of: " + config.getSQLValue());
      return false;
    }

    sql = new SQL(this, dataop);

    try {
      sql.open();
      sql.createTable(
          "CREATE TABLE IF NOT EXISTS couponcodes (name VARCHAR(24), ctype VARCHAR(10), usetimes INT(10), usedplayers TEXT(1024), ids VARCHAR(255), money INT(10), groupname VARCHAR(20), timeuse INT(100), xp INT(10))");
      cm = new CouponManager(this, sql);
    } catch (SQLException e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }
 @Override
 public void onDisable() {
   server.getScheduler().cancelTasks(this);
   send("Tasks cancelled");
   try {
     sql.close();
   } catch (SQLException e) {
     sendErr("Could not close SQL connection");
   } catch (NullPointerException e) {
     sendErr("SQL is null. Connection doesn't exist");
   }
   send("SQL connection closed");
   cm = null;
   send("is now disabled.");
 }
  @Override
  public boolean onCommand(
      CommandSender sender, Command command, String commandLabel, String[] args) {
    // Event handling
    CouponCodesCommandEvent ev =
        EventHandle.callCouponCodesCommandEvent(sender, command, commandLabel, args);
    if (ev.isCancelled()) return true;
    sender = ev.getSender();
    command = ev.getCommand();
    commandLabel = ev.getCommandLabel();
    args = ev.getArgs();

    if (args.length == 0) {
      help(sender);
      return true;
    }

    boolean pl = false;
    if (sender instanceof Player) pl = true;

    // Add command 2.0
    if (args[0].equalsIgnoreCase("add")) {
      if (args.length < 2) {
        helpAdd(sender);
        return true;
      }
      if (has(sender, "cc.add")) {
        server
            .getScheduler()
            .scheduleAsyncDelayedTask(this, new QuedAddCommand(this, sender, args));
        return true;
      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
        return true;
      }
    }

    // Remove command
    else if (args[0].equalsIgnoreCase("remove")) {
      if (has(sender, "cc.remove")) {
        server.getScheduler().scheduleAsyncDelayedTask(this, new QuedRemoveCommand(sender, args));
        return true;
      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
        return true;
      }
    }

    // Redeem command
    else if (args[0].equalsIgnoreCase("redeem")) {
      if (!pl) {
        sender.sendMessage("You must be a player to redeem a coupon");
        return true;
      } else {
        Player player = (Player) sender;
        if (has(player, "cc.redeem")) {
          server
              .getScheduler()
              .scheduleAsyncDelayedTask(this, new QuedRedeemCommand(this, player, args));
          return true;
        } else {
          player.sendMessage(ChatColor.RED + "You do not have permission to use this command");
          return true;
        }
      }
    }

    // List command
    else if (args[0].equalsIgnoreCase("list")) {
      if (has(sender, "cc.list")) {
        server.getScheduler().scheduleAsyncDelayedTask(this, new QuedListCommand(sender));
        return true;
      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
        return true;
      }
    }

    // Info command
    else if (args[0].equalsIgnoreCase("info")) {
      if (has(sender, "cc.info")) {
        server
            .getScheduler()
            .scheduleAsyncDelayedTask(this, new QuedInfoCommand(this, sender, args));
        return true;
      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
        return true;
      }
    }

    // Reload command
    else if (args[0].equalsIgnoreCase("reload")) {
      if (has(sender, "cc.reload")) {
        if (!sql.reload()) sender.sendMessage(ChatColor.DARK_RED + "Could not reload the database");
        else sender.sendMessage(ChatColor.GREEN + "Database reloaded");
        reloadConfig();
        config = new Config(this);
        debug = config.getDebug();
        sender.sendMessage(ChatColor.GREEN + "Config reloaded");
        return true;
      } else {
        sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
        return true;
      }
    } else {
      help(sender);
      return true;
    }
  }