/// <summary> Registers a <see cref="Keybind.KeyAction"/> for a <see cref="PlayerAction"/> that doesn't have it's own <see cref="Keybind"/>. </summary>
        /// <param name="playerAction"> The <see cref="PlayerAction"/> to register this for. </param>
        /// <param name="keyAction"> The <see cref="Keybind.KeyAction"/> to run when the key is pressed. </param>
        /// <param name="keyReleased"> If set to true, runs when the key is released instead of when it's pressed. </param>
        /// <exception cref="KeyActionRegisteredTooEarlyException"> Thrown when this method is called before PreLoad. </exception>
        /// <remarks> You cannot register a <see cref="Keybind.KeyAction"/> until after the PreLoad step. </remarks>
        public static void RegisterKeyAction(PlayerAction playerAction, Keybind.KeyAction keyAction, bool keyReleased = false)
        {
            if (!Main.hasPreloaded)
            {
                throw new KeyActionRegisteredTooEarlyException(keyAction);
            }

            Reg.Update += (p) =>
            {
                if (keyReleased ? playerAction.WasReleased : playerAction.WasPressed)
                {
                    keyAction(p);
                }
            };
        }
 internal KeyActionRegisteredTooEarlyException(Keybind.KeyAction keyAction) : base(
         $"Attempted to register {nameof(Keybind.KeyAction)} before {nameof(Main.PreLoad)}."
         )
 {
     this.KeyAction = keyAction;
 }