Class NotificationManager

java.lang.Object
com.petarmc.petarlib.notification.NotificationManager

public class NotificationManager extends Object
Utility class for showing in-game notifications to the player through the action bar. Only works on the client side. This class no longer relies on a global log prefix. Callers must supply a prefix when showing notifications (e.g. "[MyMod]").
  • Constructor Details

    • NotificationManager

      public NotificationManager()
  • Method Details

    • showError

      public static void showError(String message, String prefix)
      Shows an error notification in the action bar.
      Parameters:
      message - the error message to show
      prefix - the prefix to show (e.g. "[MyMod]") - may be empty
    • showInfo

      public static void showInfo(String message, String prefix)
      Shows an info notification in the action bar.
      Parameters:
      message - the message to show
      prefix - the prefix to show (e.g. "[MyMod]") - can be empty
    • showCustomNotification

      public static void showCustomNotification(String message)
      Shows a custom notification in the action bar.
      Parameters:
      message - the message to show (supports color codes like "§a")
    • showInfoInChat

      public static void showInfoInChat(String message, String prefix)
      Shows an info notification in chat.
      Parameters:
      message - the message to show in chat
      prefix - the prefix to add before the message (can be empty)
    • showErrorInChat

      public static void showErrorInChat(String message, String prefix)
      Shows an error notification in chat.
      Parameters:
      message - the error message to show in chat
      prefix - the prefix to add before the message (can be empty)
    • showCustomChatNotif

      public static void showCustomChatNotif(String message)
      Shows a custom notification in chat
      Parameters:
      message - the message to show in chat (supports color codes)