    public static boolean checkScript(String type, String script, String player, String password,
    String email, String ipAddress) throws SQLException {
        boolean caseSensitive = false;
        if (Util.databaseManager.getDatabaseType().equalsIgnoreCase("ebean")) {
            EBean eBeanClass = EBean.checkPlayer(player, true);
            if (type.equalsIgnoreCase("checkuser")) {
                if (eBeanClass.getRegistered().equalsIgnoreCase("true")) {
                    return true;
                }
                return false;
            } else if (type.equalsIgnoreCase("checkpassword")) {
                String storedPassword = eBeanClass.getPassword();
                if (Encryption.SHA512(password).equals(storedPassword)) {
                    return true;
                }
                return false;
            } else if (type.equalsIgnoreCase("adduser")) {
                Custom.adduser(player, email, password, ipAddress);
                eBeanClass.setEmail(email);
                eBeanClass.setPassword(Encryption.SHA512(password));
                eBeanClass.setRegistered("true");
                eBeanClass.setIp(ipAddress);
            } else if (type.equalsIgnoreCase("numusers")) {
                int amount = EBean.getUsers();
                logging.Info(amount + " user registrations in database");
            }
        } else if (Config.database_ison) {
            String usertable = null, usernamefield = null, passwordfield = null, saltfield = "";
            boolean bans = false;
            PreparedStatement ps = null;
            int number = 0;
            if (Config.custom_enabled) {
                if (type.equalsIgnoreCase("checkuser")) {
                    String check = MySQL.getfromtable(Config.custom_table, "*", Config.custom_userfield, player);
                    if (check != "fail") {
                        Config.hasForumBoard = true;
                        return true;
                    }
                    return false;
                } else if (type.equalsIgnoreCase("checkpassword")) {
                    EBean eBeanClass = EBean.find(player);
                    String storedPassword = eBeanClass.getPassword();
                    if (Custom.check_hash(password, storedPassword)) {
                        return true;
                    }
                    String hash = MySQL.getfromtable(Config.custom_table, "`" + Config.custom_passfield + "`", "" + Config.custom_userfield + "", player);
                    EBean.checkPassword(player, hash);
                    if (Custom.check_hash(password, hash)) {
                        return true;
                    }
                    return false;
                } else if (type.equalsIgnoreCase("syncpassword")) {
                    String hash = MySQL.getfromtable(Config.custom_table, "`" + Config.custom_passfield + "`", "" + Config.custom_userfield + "", player);
                    EBean.checkPassword(player, hash);
                    return true;
                } else if (type.equalsIgnoreCase("adduser")) {
                    Custom.adduser(player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                } else if (type.equalsIgnoreCase("numusers")) {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `" + Config.custom_table + "`");
                    ResultSet rs = ps.executeQuery();
                    if (rs.next()) {
                        logging.Info(rs.getInt("countit") + " user registrations in database");
                    }
                }
            } else if (script.equalsIgnoreCase(PhpBB.Name) || script.equalsIgnoreCase(PhpBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(PhpBB.VersionRange)) {
                    usernamefield = "username_clean";
                    passwordfield = "user_password";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PhpBB.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (PhpBB.check_hash(password, hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(PhpBB.VersionRange2)) {
                    usernamefield = "username_clean"; 
                    passwordfield = "user_password";
                    Config.hasForumBoard = true;
                    bans = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PhpBB.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (PhpBB.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     PhpBB.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(SMF.Name) || script.equalsIgnoreCase(SMF.ShortName)) {
                usertable = "members";
                if (checkVersionInRange(SMF.VersionRange)) {
                    usernamefield = "memberName";
                    passwordfield = "passwd";
                    saltfield = "passwordSalt";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && SMF.check_hash(SMF.hash(1, player, password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (SMF.check_hash(SMF.hash(1, player, password), hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(SMF.VersionRange2) || checkVersionInRange("2.0-2.0")
                || checkVersionInRange("2.0.0-2.0.0")) {
                    usernamefield = "member_name";
                    passwordfield = "passwd";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && SMF.check_hash(SMF.hash(2, player, password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (SMF.check_hash(SMF.hash(2, player, password), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     SMF.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(MyBB.Name) || script.equalsIgnoreCase(MyBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(MyBB.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    bans = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && MyBB.check_hash(MyBB.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (MyBB.check_hash(MyBB.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     MyBB.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(VBulletin.Name) || script.equalsIgnoreCase(VBulletin.ShortName)) {
                usertable = "user";
                if (checkVersionInRange(VBulletin.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && VBulletin.check_hash(VBulletin.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (VBulletin.check_hash(VBulletin.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(VBulletin.VersionRange2)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    bans = true;
                    number = 2;
                    caseSensitive = true;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && VBulletin.check_hash(VBulletin.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (VBulletin.check_hash(VBulletin.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     VBulletin.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Drupal.Name) || script.equalsIgnoreCase(Drupal.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(Drupal.VersionRange)) {
                    usernamefield = "name";
                    passwordfield = "pass";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Encryption.md5(password).equals(storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Encryption.md5(password).equals(hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(Drupal.VersionRange2)) {
                    usernamefield = "name";
                    passwordfield = "pass";
                    Config.hasForumBoard = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && storedPassword.equals(Drupal.user_check_password(password, storedPassword))) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (hash.equals(Drupal.user_check_password(password, hash))) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     Drupal.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Joomla.Name) || script.equalsIgnoreCase(Joomla.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(Joomla.VersionRange)) {
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Joomla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Joomla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(Joomla.VersionRange2)) {
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Joomla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Joomla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     Joomla.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Vanilla.Name) || script.equalsIgnoreCase(Vanilla.ShortName)) {
                if (checkVersionInRange(Vanilla.VersionRange)) {
                    usertable = "User";
                    usernamefield = "Name";
                    passwordfield = "Password";
                    caseSensitive = true;
                    if (Vanilla.check() == 2) {
                        usertable = usertable.toLowerCase();
                    }
                    Config.hasForumBoard = true;
                    number = Vanilla.check();
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Vanilla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Vanilla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    String emailcheck =  MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + usernamefield + "`", "Email", email);
                    if (emailcheck.equalsIgnoreCase("fail")) {
                        Vanilla.adduser(number, player, email, password, ipAddress);
                        EBean.sync(player);
                        return true;
                    }
                    return false;
                }
            } else if (script.equalsIgnoreCase(PunBB.Name) || script.equalsIgnoreCase(PunBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(PunBB.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PunBB.check_hash(PunBB.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (PunBB.check_hash(PunBB.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    PunBB.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(XenForo.Name) || script.equalsIgnoreCase(XenForo.ShortName)) {
                usertable = "user";
                if (checkVersionInRange(XenForo.VersionRange)) {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    usernamefield = "username";
                    passwordfield = "password";
                    caseSensitive = true;
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                        if (hash != null) {
                            int offset = -1;
                            int chunkSize = 1024;
                            long blobLength = hash.length();
                            if (chunkSize > blobLength) {
                                chunkSize = (int) blobLength;
                            }
                            char buffer[] = new char[chunkSize];
                            StringBuilder stringBuffer = new StringBuilder();
                            Reader reader = new InputStreamReader(hash.getBinaryStream());
                            try {
                                while ((offset = reader.read(buffer)) != -1) {
                                    stringBuffer.append(buffer, 0, offset);
                                }
                            } catch (IOException e) {
                                logging.StackTrace(e.getStackTrace(), Thread.currentThread().getStackTrace()[1].getMethodName(), Thread.currentThread().getStackTrace()[1].getLineNumber(), Thread.currentThread().getStackTrace()[1].getClassName(), Thread.currentThread().getStackTrace()[1].getFileName());
                            }
                            String cache = stringBuffer.toString();
                            String thehash = forumCacheValue(cache, "hash");
                            String thesalt = forumCacheValue(cache, "salt");
                            EBean eBeanClass = EBean.find(player);
                            String storedPassword = eBeanClass.getPassword();
                            String storedSalt = eBeanClass.getSalt();
                            if (storedPassword != null && storedSalt != null && XenForo.check_hash(XenForo.hash(1, storedSalt, password), storedPassword)) {
                                return true;
                            }
                            EBean.checkSalt(player, thesalt);
                            EBean.checkPassword(player, thehash);
                            if (XenForo.check_hash(XenForo.hash(1, thesalt, password), thehash)) {
                                return true;
                            }
                        } else {
                            return false;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    XenForo.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncpassword") && !Config.custom_enabled) {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                    int offset = -1;
                    int chunkSize = 1024;
                    long blobLength = hash.length();
                    if (chunkSize > blobLength) {
                        chunkSize = (int) blobLength;
                    }
                    char buffer[] = new char[chunkSize];
                    StringBuilder stringBuffer = new StringBuilder();
                    Reader reader = new InputStreamReader(hash.getBinaryStream());
                    try {
                        while ((offset = reader.read(buffer)) != -1) {
                            stringBuffer.append(buffer, 0, offset);
                        }
                    } catch (IOException e) {
                        logging.StackTrace(e.getStackTrace(), Thread.currentThread().getStackTrace()[1].getMethodName(), Thread.currentThread().getStackTrace()[1].getLineNumber(), Thread.currentThread().getStackTrace()[1].getClassName(), Thread.currentThread().getStackTrace()[1].getFileName());
                    }
                    String cache = stringBuffer.toString();
                    String thehash = forumCacheValue(cache, "hash");
                    EBean.checkPassword(player, thehash);
                    return true;
                } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncsalt") && !Config.custom_enabled && saltfield != null && saltfield != "") {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                    int offset = -1;
                    int chunkSize = 1024;
                    long blobLength = hash.length();
                    if (chunkSize > blobLength) {
                    chunkSize = (int) blobLength;
                    }
                    char buffer[] = new char[chunkSize];
                    StringBuilder stringBuffer = new StringBuilder();
                    Reader reader = new InputStreamReader(hash.getBinaryStream());
                    try {
                        while ((offset = reader.read(buffer)) != -1) {
                            stringBuffer.append(buffer, 0, offset);
                        }
                    } catch (IOException e) {
                        logging.StackTrace(e.getStackTrace(),
                        Thread.currentThread().getStackTrace()[1].getMethodName(),
                        Thread.currentThread().getStackTrace()[1].getLineNumber(),
                        Thread.currentThread().getStackTrace()[1].getClassName(),
                        Thread.currentThread().getStackTrace()[1].getFileName());
                    }
                    String cache = stringBuffer.toString();
                    String thesalt = forumCacheValue(cache, "salt");
                    EBean.checkSalt(player, thesalt);
                    return true;
                }
            } else if (script.equalsIgnoreCase(BBPress.Name) || script.equalsIgnoreCase(BBPress.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(BBPress.VersionRange)) {
                    usernamefield = "user_login";
                    passwordfield = "user_pass";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && BBPress.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (BBPress.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    BBPress.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(DLE.Name) || script.equalsIgnoreCase(DLE.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(DLE.VersionRange)) {
                    usernamefield = "name";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && DLE.check_hash(DLE.hash(password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (DLE.check_hash(DLE.hash(password), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    DLE.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(IPB.Name) || script.equalsIgnoreCase(IPB.ShortName)) {
                usertable = "members";
                if (checkVersionInRange(IPB.VersionRange)) {
                    saltfield = "members_pass_salt";
                    usernamefield = "members_l_username";
                    passwordfield = "members_pass_hash";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && IPB.check_hash(IPB.hash("find", player, password.toLowerCase(), null), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (IPB.check_hash(IPB.hash("find", player.toLowerCase(), password, null), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    IPB.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(WordPress.Name) || script.equalsIgnoreCase(WordPress.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(WordPress.VersionRange)) {
                    usernamefield = "user_login";
                    passwordfield = "user_pass";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && WordPress.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (WordPress.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    WordPress.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } 
            if (!Config.hasForumBoard) {
                if (!Config.custom_enabled) {
                    String tempVers = Config.script_version;
                    Config.script_version = scriptVersion();
                    logging.Info(System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|" + System.getProperty("line.separator")
                        + "|--------------------------------AUTHDB WARNING-------------------------------|" + System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|" + System.getProperty("line.separator")
                        + "| COULD NOT FIND A COMPATIBLE SCRIPT VERSION!                                 |" + System.getProperty("line.separator")
                        + "| PLEASE CHECK YOUR SCRIPT VERSION AND TRY AGAIN. PLUGIN MAY OR MAY NOT WORK. |" + System.getProperty("line.separator")
                        + "| YOUR SCRIPT VERSION FOR " + Config.script_name + " HAS BEEN SET FROM " + tempVers + " TO " + Config.script_version + "             |" + System.getProperty("line.separator")
                        + "| FOR A LIST OF SCRIPT VERSIONS,                                              |" + System.getProperty("line.separator")
                        + "| CHECK: http://wiki.bukkit.org/AuthDB#Scripts_Supported                      |" + System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|");
                }
            }
            if (!caseSensitive && player != null) {
                player = player.toLowerCase();
            }
            if (Config.hasForumBoard && type.equalsIgnoreCase("checkuser") && !Config.custom_enabled) {
                String check = MySQL.getfromtable(Config.script_tableprefix + usertable, "*", usernamefield, player);
                if (check != "fail") { return true; }
                return false;
            }  else if (Config.hasForumBoard && type.equalsIgnoreCase("numusers") && !Config.custom_enabled) {
                if (script.equalsIgnoreCase(PhpBB.Name) || script.equalsIgnoreCase(PhpBB.ShortName)) {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `"
                     + Config.script_tableprefix + usertable + "` WHERE  `group_id` !=6");
                } else {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `"
                     + Config.script_tableprefix + usertable + "`");
                }
                ResultSet rs = ps.executeQuery();
                if (rs.next()) { logging.Info(rs.getInt("countit") + " user registrations in database"); }
            } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncpassword") && !Config.custom_enabled) {
                String hash = MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + passwordfield + "`", usernamefield, player);
                EBean.checkPassword(player, hash);
                return true;
            } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncsalt") && !Config.custom_enabled && saltfield != null && saltfield != "") {
                String salt = MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + saltfield + "`", usernamefield, player);
                EBean.checkSalt(player, salt);
                return true;
            }
        }

    public static boolean checkScript(String type, String script, String player, String password,
    String email, String ipAddress) throws SQLException {
        boolean caseSensitive = false;
        if (Util.databaseManager.getDatabaseType().equalsIgnoreCase("ebean")) {
            EBean eBeanClass = EBean.checkPlayer(player, true);
            if (type.equalsIgnoreCase("checkuser")) {
                if (eBeanClass.getRegistered().equalsIgnoreCase("true")) {
                    return true;
                }
                return false;
            } else if (type.equalsIgnoreCase("checkpassword")) {
                String storedPassword = eBeanClass.getPassword();
                if (Encryption.SHA512(password).equals(storedPassword)) {
                    return true;
                }
                return false;
            } else if (type.equalsIgnoreCase("adduser")) {
                Custom.adduser(player, email, password, ipAddress);
                eBeanClass.setEmail(email);
                eBeanClass.setPassword(Encryption.SHA512(password));
                eBeanClass.setRegistered("true");
                eBeanClass.setIp(ipAddress);
            } else if (type.equalsIgnoreCase("numusers")) {
                int amount = EBean.getUsers();
                logging.Info(amount + " user registrations in database");
            }
        } else if (Config.database_ison) {
            String usertable = null, usernamefield = null, passwordfield = null, saltfield = "";
            boolean bans = false;
            PreparedStatement ps = null;
            int number = 0;
            if (Config.custom_enabled) {
                if (type.equalsIgnoreCase("checkuser")) {
                    String check = MySQL.getfromtable(Config.custom_table, "*", Config.custom_userfield, player);
                    if (check != "fail") {
                        Config.hasForumBoard = true;
                        return true;
                    }
                    return false;
                } else if (type.equalsIgnoreCase("checkpassword")) {
                    EBean eBeanClass = EBean.find(player);
                    String storedPassword = eBeanClass.getPassword();
                    if (Custom.check_hash(password, storedPassword)) {
                        return true;
                    }
                    String hash = MySQL.getfromtable(Config.custom_table, "`" + Config.custom_passfield + "`", "" + Config.custom_userfield + "", player);
                    EBean.checkPassword(player, hash);
                    if (Custom.check_hash(password, hash)) {
                        return true;
                    }
                    return false;
                } else if (type.equalsIgnoreCase("syncpassword")) {
                    String hash = MySQL.getfromtable(Config.custom_table, "`" + Config.custom_passfield + "`", "" + Config.custom_userfield + "", player);
                    EBean.checkPassword(player, hash);
                    return true;
                } else if (type.equalsIgnoreCase("adduser")) {
                    Custom.adduser(player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                } else if (type.equalsIgnoreCase("numusers")) {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `" + Config.custom_table + "`");
                    ResultSet rs = ps.executeQuery();
                    if (rs.next()) {
                        logging.Info(rs.getInt("countit") + " user registrations in database");
                    }
                }
            } else if (script.equalsIgnoreCase(PhpBB.Name) || script.equalsIgnoreCase(PhpBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(PhpBB.VersionRange)) {
                    usernamefield = "username_clean";
                    passwordfield = "user_password";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PhpBB.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (PhpBB.check_hash(password, hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(PhpBB.VersionRange2)) {
                    usernamefield = "username_clean"; 
                    passwordfield = "user_password";
                    Config.hasForumBoard = true;
                    bans = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PhpBB.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (PhpBB.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     PhpBB.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(SMF.Name) || script.equalsIgnoreCase(SMF.ShortName)) {
                usertable = "members";
                if (checkVersionInRange(SMF.VersionRange)) {
                    usernamefield = "memberName";
                    passwordfield = "passwd";
                    saltfield = "passwordSalt";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && SMF.check_hash(SMF.hash(1, player, password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (SMF.check_hash(SMF.hash(1, player, password), hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(SMF.VersionRange2) || checkVersionInRange("2.0-2.0")
                || checkVersionInRange("2.0.0-2.0.0")) {
                    usernamefield = "member_name";
                    passwordfield = "passwd";
                    saltfield = "password_salt";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && SMF.check_hash(SMF.hash(2, player, password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (SMF.check_hash(SMF.hash(2, player, password), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     SMF.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(MyBB.Name) || script.equalsIgnoreCase(MyBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(MyBB.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    bans = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && MyBB.check_hash(MyBB.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (MyBB.check_hash(MyBB.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     MyBB.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(VBulletin.Name) || script.equalsIgnoreCase(VBulletin.ShortName)) {
                usertable = "user";
                if (checkVersionInRange(VBulletin.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    bans = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && VBulletin.check_hash(VBulletin.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (VBulletin.check_hash(VBulletin.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(VBulletin.VersionRange2)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    bans = true;
                    number = 2;
                    caseSensitive = true;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && VBulletin.check_hash(VBulletin.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (VBulletin.check_hash(VBulletin.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     VBulletin.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Drupal.Name) || script.equalsIgnoreCase(Drupal.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(Drupal.VersionRange)) {
                    usernamefield = "name";
                    passwordfield = "pass";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Encryption.md5(password).equals(storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Encryption.md5(password).equals(hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(Drupal.VersionRange2)) {
                    usernamefield = "name";
                    passwordfield = "pass";
                    Config.hasForumBoard = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && storedPassword.equals(Drupal.user_check_password(password, storedPassword))) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (hash.equals(Drupal.user_check_password(password, hash))) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     Drupal.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Joomla.Name) || script.equalsIgnoreCase(Joomla.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(Joomla.VersionRange)) {
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Joomla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Joomla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                } else if (checkVersionInRange(Joomla.VersionRange2)) {
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 2;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Joomla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Joomla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                     Joomla.adduser(number, player, email, password, ipAddress);
                     EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(Vanilla.Name) || script.equalsIgnoreCase(Vanilla.ShortName)) {
                if (checkVersionInRange(Vanilla.VersionRange)) {
                    usertable = "User";
                    usernamefield = "Name";
                    passwordfield = "Password";
                    caseSensitive = true;
                    if (Vanilla.check() == 2) {
                        usertable = usertable.toLowerCase();
                    }
                    Config.hasForumBoard = true;
                    number = Vanilla.check();
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && Vanilla.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (Vanilla.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    String emailcheck =  MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + usernamefield + "`", "Email", email);
                    if (emailcheck.equalsIgnoreCase("fail")) {
                        Vanilla.adduser(number, player, email, password, ipAddress);
                        EBean.sync(player);
                        return true;
                    }
                    return false;
                }
            } else if (script.equalsIgnoreCase(PunBB.Name) || script.equalsIgnoreCase(PunBB.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(PunBB.VersionRange)) {
                    saltfield = "salt";
                    usernamefield = "username";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && PunBB.check_hash(PunBB.hash("find", player, password, ""), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (PunBB.check_hash(PunBB.hash("find", player, password, ""), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    PunBB.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(XenForo.Name) || script.equalsIgnoreCase(XenForo.ShortName)) {
                usertable = "user";
                if (checkVersionInRange(XenForo.VersionRange)) {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    usernamefield = "username";
                    passwordfield = "password";
                    caseSensitive = true;
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                        if (hash != null) {
                            int offset = -1;
                            int chunkSize = 1024;
                            long blobLength = hash.length();
                            if (chunkSize > blobLength) {
                                chunkSize = (int) blobLength;
                            }
                            char buffer[] = new char[chunkSize];
                            StringBuilder stringBuffer = new StringBuilder();
                            Reader reader = new InputStreamReader(hash.getBinaryStream());
                            try {
                                while ((offset = reader.read(buffer)) != -1) {
                                    stringBuffer.append(buffer, 0, offset);
                                }
                            } catch (IOException e) {
                                logging.StackTrace(e.getStackTrace(), Thread.currentThread().getStackTrace()[1].getMethodName(), Thread.currentThread().getStackTrace()[1].getLineNumber(), Thread.currentThread().getStackTrace()[1].getClassName(), Thread.currentThread().getStackTrace()[1].getFileName());
                            }
                            String cache = stringBuffer.toString();
                            String thehash = forumCacheValue(cache, "hash");
                            String thesalt = forumCacheValue(cache, "salt");
                            EBean eBeanClass = EBean.find(player);
                            String storedPassword = eBeanClass.getPassword();
                            String storedSalt = eBeanClass.getSalt();
                            if (storedPassword != null && storedSalt != null && XenForo.check_hash(XenForo.hash(1, storedSalt, password), storedPassword)) {
                                return true;
                            }
                            EBean.checkSalt(player, thesalt);
                            EBean.checkPassword(player, thehash);
                            if (XenForo.check_hash(XenForo.hash(1, thesalt, password), thehash)) {
                                return true;
                            }
                        } else {
                            return false;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    XenForo.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncpassword") && !Config.custom_enabled) {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                    int offset = -1;
                    int chunkSize = 1024;
                    long blobLength = hash.length();
                    if (chunkSize > blobLength) {
                        chunkSize = (int) blobLength;
                    }
                    char buffer[] = new char[chunkSize];
                    StringBuilder stringBuffer = new StringBuilder();
                    Reader reader = new InputStreamReader(hash.getBinaryStream());
                    try {
                        while ((offset = reader.read(buffer)) != -1) {
                            stringBuffer.append(buffer, 0, offset);
                        }
                    } catch (IOException e) {
                        logging.StackTrace(e.getStackTrace(), Thread.currentThread().getStackTrace()[1].getMethodName(), Thread.currentThread().getStackTrace()[1].getLineNumber(), Thread.currentThread().getStackTrace()[1].getClassName(), Thread.currentThread().getStackTrace()[1].getFileName());
                    }
                    String cache = stringBuffer.toString();
                    String thehash = forumCacheValue(cache, "hash");
                    EBean.checkPassword(player, thehash);
                    return true;
                } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncsalt") && !Config.custom_enabled && saltfield != null && saltfield != "") {
                    String userid = MySQL.getfromtable(Config.script_tableprefix + usertable, "`user_id`", "username", player);
                    Blob hash = MySQL.getfromtableBlob(Config.script_tableprefix + "user_authenticate", "`data`", "user_id", userid);
                    int offset = -1;
                    int chunkSize = 1024;
                    long blobLength = hash.length();
                    if (chunkSize > blobLength) {
                    chunkSize = (int) blobLength;
                    }
                    char buffer[] = new char[chunkSize];
                    StringBuilder stringBuffer = new StringBuilder();
                    Reader reader = new InputStreamReader(hash.getBinaryStream());
                    try {
                        while ((offset = reader.read(buffer)) != -1) {
                            stringBuffer.append(buffer, 0, offset);
                        }
                    } catch (IOException e) {
                        logging.StackTrace(e.getStackTrace(),
                        Thread.currentThread().getStackTrace()[1].getMethodName(),
                        Thread.currentThread().getStackTrace()[1].getLineNumber(),
                        Thread.currentThread().getStackTrace()[1].getClassName(),
                        Thread.currentThread().getStackTrace()[1].getFileName());
                    }
                    String cache = stringBuffer.toString();
                    String thesalt = forumCacheValue(cache, "salt");
                    EBean.checkSalt(player, thesalt);
                    return true;
                }
            } else if (script.equalsIgnoreCase(BBPress.Name) || script.equalsIgnoreCase(BBPress.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(BBPress.VersionRange)) {
                    usernamefield = "user_login";
                    passwordfield = "user_pass";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && BBPress.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (BBPress.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    BBPress.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(DLE.Name) || script.equalsIgnoreCase(DLE.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(DLE.VersionRange)) {
                    usernamefield = "name";
                    passwordfield = "password";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && DLE.check_hash(DLE.hash(password), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "",
                        "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (DLE.check_hash(DLE.hash(password), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    DLE.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } else if (script.equalsIgnoreCase(IPB.Name) || script.equalsIgnoreCase(IPB.ShortName)) {
                usertable = "members";
                if (checkVersionInRange(IPB.VersionRange)) {
                    usernamefield = "members_l_username";
                    passwordfield = "members_pass_hash";
                    saltfield = "members_pass_salt";
                    Config.hasForumBoard = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && IPB.check_hash(IPB.hash("find", player, password.toLowerCase(), null), storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player.toLowerCase());
                        EBean.checkPassword(player, hash);
                        if (IPB.check_hash(IPB.hash("find", player.toLowerCase(), password, null), hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    IPB.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                     return true;
                }
            } else if (script.equalsIgnoreCase(WordPress.Name) || script.equalsIgnoreCase(WordPress.ShortName)) {
                usertable = "users";
                if (checkVersionInRange(WordPress.VersionRange)) {
                    usernamefield = "user_login";
                    passwordfield = "user_pass";
                    Config.hasForumBoard = true;
                    caseSensitive = true;
                    number = 1;
                    if (type.equalsIgnoreCase("checkpassword")) {
                        EBean eBeanClass = EBean.find(player);
                        String storedPassword = eBeanClass.getPassword();
                        if (storedPassword != null && WordPress.check_hash(password, storedPassword)) {
                            return true;
                        }
                        String hash = MySQL.getfromtable(Config.script_tableprefix + "" + usertable + "", "`" + passwordfield + "`", "" + usernamefield + "", player);
                        EBean.checkPassword(player, hash);
                        if (WordPress.check_hash(password, hash)) {
                            return true;
                        }
                    }
                }
                if (type.equalsIgnoreCase("adduser")) {
                    WordPress.adduser(number, player, email, password, ipAddress);
                    EBean.sync(player);
                    return true;
                }
            } 
            if (!Config.hasForumBoard) {
                if (!Config.custom_enabled) {
                    String tempVers = Config.script_version;
                    Config.script_version = scriptVersion();
                    logging.Info(System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|" + System.getProperty("line.separator")
                        + "|--------------------------------AUTHDB WARNING-------------------------------|" + System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|" + System.getProperty("line.separator")
                        + "| COULD NOT FIND A COMPATIBLE SCRIPT VERSION!                                 |" + System.getProperty("line.separator")
                        + "| PLEASE CHECK YOUR SCRIPT VERSION AND TRY AGAIN. PLUGIN MAY OR MAY NOT WORK. |" + System.getProperty("line.separator")
                        + "| YOUR SCRIPT VERSION FOR " + Config.script_name + " HAS BEEN SET FROM " + tempVers + " TO " + Config.script_version + "             |" + System.getProperty("line.separator")
                        + "| FOR A LIST OF SCRIPT VERSIONS,                                              |" + System.getProperty("line.separator")
                        + "| CHECK: http://wiki.bukkit.org/AuthDB#Scripts_Supported                      |" + System.getProperty("line.separator")
                        + "|-----------------------------------------------------------------------------|");
                }
            }
            if (!caseSensitive && player != null) {
                player = player.toLowerCase();
            }
            if (Config.hasForumBoard && type.equalsIgnoreCase("checkuser") && !Config.custom_enabled) {
                String check = MySQL.getfromtable(Config.script_tableprefix + usertable, "*", usernamefield, player);
                if (check != "fail") { return true; }
                return false;
            }  else if (Config.hasForumBoard && type.equalsIgnoreCase("numusers") && !Config.custom_enabled) {
                if (script.equalsIgnoreCase(PhpBB.Name) || script.equalsIgnoreCase(PhpBB.ShortName)) {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `"
                     + Config.script_tableprefix + usertable + "` WHERE  `group_id` !=6");
                } else {
                    ps = (PreparedStatement) MySQL.mysql.prepareStatement("SELECT COUNT(*) as `countit` FROM `"
                     + Config.script_tableprefix + usertable + "`");
                }
                ResultSet rs = ps.executeQuery();
                if (rs.next()) { logging.Info(rs.getInt("countit") + " user registrations in database"); }
            } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncpassword") && !Config.custom_enabled) {
                String hash = MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + passwordfield + "`", usernamefield, player);
                EBean.checkPassword(player, hash);
                return true;
            } else if (Config.hasForumBoard && type.equalsIgnoreCase("syncsalt") && !Config.custom_enabled && saltfield != null && saltfield != "") {
                String salt = MySQL.getfromtable(Config.script_tableprefix + usertable, "`" + saltfield + "`", usernamefield, player);
                EBean.checkSalt(player, salt);
                return true;
            }
        }
