Class UnableToAffordJumpNagDialog

java.lang.Object
mekhq.gui.baseComponents.immersiveDialogs.ImmersiveDialogNag
mekhq.gui.dialog.nagDialogs.UnableToAffordJumpNagDialog

public class UnableToAffordJumpNagDialog extends ImmersiveDialogNag
A dialog class used to notify players when they are unable to afford a jump within the campaign.

The UnableToAffordJumpNagDialog extends ImmersiveDialogNag and is specifically designed to alert players about financial constraints preventing them from performing a jump. It utilizes predefined constants, including the TRANSPORT speaker and the NAG_UNABLE_TO_AFFORD_JUMP identifier, to configure the dialog's behavior and content.

  • Constructor Details

    • UnableToAffordJumpNagDialog

      public UnableToAffordJumpNagDialog(Campaign campaign)
      Constructs a new UnableToAffordJumpNagDialog to display a warning about unaffordable jump expenses.

      This constructor initializes the dialog with preconfigured values, such as the NAG_UNABLE_TO_AFFORD_JUMP constant for managing dialog suppression, the "UnableToAffordJumpNagDialog" localization key for retrieving dialog content, and the TRANSPORT speaker for delivering the message.

      Parameters:
      campaign - The Campaign instance associated with this dialog. Provides access to campaign data required for constructing the nag dialog.
  • Method Details

    • getInCharacterMessage

      protected String getInCharacterMessage(Campaign campaign, String key, String commanderAddress)
      Description copied from class: ImmersiveDialogNag
      Retrieves an in-character message formatted with the provided commander address.

      This method fetches the text associated with an in-character message key from the resource bundle and formats it using the provided address of the commander.

      Overrides:
      getInCharacterMessage in class ImmersiveDialogNag
      Parameters:
      campaign - The campaign context.
      key - The reference bundle key.
      commanderAddress - The address of the commander to be inserted into the formatted message.
      Returns:
      A formatted in-character message as a String.
    • checkNag

      public static boolean checkNag(Campaign campaign)
      Checks if a nag dialog should be displayed for the inability to afford the next jump in the given campaign.

      The method evaluates the following conditions to determine if the nag dialog should appear:

      • If the nag dialog for the inability to afford the next jump has not been ignored in the user options.
      • If the campaign is unable to afford the next jump.
      Parameters:
      campaign - the Campaign to check for nagging conditions
      Returns:
      true if the nag dialog should be displayed, false otherwise