Class NotificationHelper
java.lang.Object
com.datdeveloper.datmoddingapi.util.NotificationHelper
A class to simplify sending notifications to the player
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 aroundServerPlayer.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 hotbarstatic 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 screenstatic 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
-
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 totitle
- The main title of the notificationsubTitle
- The subtitle of the notificationfadeIn
- The number of ticks to spend fading the message instay
- The number of ticks for the message to spend on the screenfadeOut
- 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 totitle
- The main title of the notificationsubTitle
- 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 tomessage
- 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 aroundServerPlayer.sendSystemMessage(Component)
- Parameters:
player
- The player to send the notification tomessage
- The content of the notification- See Also:
-