public void ban(String reason, boolean autoban, boolean mac) {
        try {
            if (mac) {
                client.banMacs();
            }
            Connection con = DatabaseConnection.getConnection();
            PreparedStatement ps = con.prepareStatement("UPDATE accounts SET banned = 1, banreason = ? WHERE id = ?");
            ps.setString(1, reason);
            ps.setInt(2, accountid);
            ps.executeUpdate();
            ps.close();
            final String ip = client.getSession().getRemoteAddress().toString().split(":")[0];
            ps = con.prepareStatement("SELECT ip FROM ipbans WHERE ip = ?");
            ps.setString(1, ip);
            ResultSet rs = ps.executeQuery();
            if (!rs.next()) {
                ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?)");
                ps.setString(1, ip);
                ps.executeUpdate();
                ps.close();
            }
            rs.close();
            ps.close();
        } catch (SQLException e) {
        }
        client.getSession().close();
    }