public boolean transaction(String name, String admin, int value, int cooldown, String reason) {
        Date date = new Date();
        Timestamp ts = new Timestamp(date.getTime());

        try{
            PreparedStatement selectPlayer = connection.prepareStatement("SELECT * FROM Player WHERE name=?");
            selectPlayer.setString(1, name);
            ResultSet result = selectPlayer.executeQuery();
            result.next();
            int newKarma = result.getInt("karma") + value;
            int id = result.getInt("id");

            PreparedStatement transaction = connection.prepareStatement("SELECT * FROM Transaction WHERE player=?");
            transaction.setInt(1, id);
            ResultSet transresult = transaction.executeQuery();

            Timestamp lastTime = null ;
            while(transresult.next()) {
                if(lastTime == null){
                    lastTime = transresult.getTimestamp("timestamp");
                } else {
                    if(lastTime.before(transresult.getTimestamp("timestamp")))
                        lastTime = transresult.getTimestamp("timestamp");
                }
            }


            if(lastTime == null || (ts.getTime() - lastTime.getTime() > cooldown * 1000)){
                PreparedStatement update = connection.prepareStatement("UPDATE Player SET karma=? WHERE id=?");
                update.setInt(1, newKarma);
                update.setInt(2, id);
                update.executeUpdate();

                PreparedStatement transactionInsert = connection.prepareStatement("INSERT INTO  Transaction (player,admin,timestamp,reason,value) VALUES (?, ?, ?, ?, ?)");
                transactionInsert.setInt(1, id);
                transactionInsert.setString(2, admin);
                transactionInsert.setTimestamp(3, ts);
                transactionInsert.setString(4, reason);
                transactionInsert.setInt(5, value);
                transactionInsert.executeUpdate();
            } else {
                return false;
            }
        } catch(Exception e){
            reconnect();
            e.printStackTrace();
            return false;
        } finally {
            close();
        }

        return true;
    }