I figured it out myself, here's the code:

    public class Input{
        private static boolean escDownOnLast;
        private static boolean escToggled;
        
        public static boolean isToggledOn(){
            if(Keyboard.isKeyDown(Keyboard.KEY_R)){
                escDownOnLast = true;
            }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && !escToggled){
                escDownOnLast = false;
                escToggled = true;
                return escToggled;
            }else if(!Keyboard.isKeyDown(Keyboard.KEY_R) && escDownOnLast && escToggled){
                escDownOnLast = false;
                escToggled = false;
                return escToggled;
            }
            return escToggled;
        }
    }