Class NotificationHelper

java.lang.Object
com.datdeveloper.datmoddingapi.util.NotificationHelper

public class NotificationHelper extends Object
A class to simplify sending notifications to the player
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    chatNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component message)
    Display a notification for the given player in their chat
    This is just a wrapper around ServerPlayer.sendSystemMessage(Component)
    static void
    hotbarNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component message)
    Display a notification for the given player just above their hotbar
    static void
    titleNotification(@NotNull net.minecraft.server.level.ServerPlayer player, @NotNull net.minecraft.network.chat.Component title, @Nullable net.minecraft.network.chat.Component subTitle, int fadeIn, int stay, int fadeOut)
    Display a notification for the given player in the middle of their screen
    static void
    titleNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component title, @Nullable net.minecraft.network.chat.Component subTitle)
    Display a notification for the given player in the middle of their screen
    Uses 10, 40, 10 for fadeIn, stay, and fadeOut respectively

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • titleNotification

      public static void titleNotification(@NotNull @NotNull net.minecraft.server.level.ServerPlayer player, @NotNull @NotNull net.minecraft.network.chat.Component title, @Nullable @Nullable net.minecraft.network.chat.Component subTitle, int fadeIn, int stay, int fadeOut)
      Display a notification for the given player in the middle of their screen
      Parameters:
      player - The player to send the notification to
      title - The main title of the notification
      subTitle - The subtitle of the notification
      fadeIn - The number of ticks to spend fading the message in
      stay - The number of ticks for the message to spend on the screen
      fadeOut - The number of ticks to spend fading out
    • titleNotification

      public static void titleNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component title, @Nullable @Nullable net.minecraft.network.chat.Component subTitle)
      Display a notification for the given player in the middle of their screen
      Uses 10, 40, 10 for fadeIn, stay, and fadeOut respectively
      Parameters:
      player - The player to send the notification to
      title - The main title of the notification
      subTitle - The subtitle of the notification
    • hotbarNotification

      public static void hotbarNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component message)
      Display a notification for the given player just above their hotbar
      Parameters:
      player - The player to send the notification to
      message - The content of the notification
    • chatNotification

      public static void chatNotification(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component message)
      Display a notification for the given player in their chat
      This is just a wrapper around ServerPlayer.sendSystemMessage(Component)
      Parameters:
      player - The player to send the notification to
      message - The content of the notification
      See Also:
      • ServerPlayer.sendSystemMessage(Component)