Customizable sleeping actionbar messages

This commit is contained in:
William Blake Galbreath
2025-01-12 11:36:51 -08:00
committed by granny
parent d2a3e02533
commit 19a65e8dcf
4 changed files with 54 additions and 88 deletions

View File

@@ -65,6 +65,27 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1601,7 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.serverLevel().canSleepThroughNights()) {
- this.displayClientMessage(Component.translatable("sleep.not_possible"), true);
+ // Purpur start - Customizable sleeping actionbar messages
+ Component clientMessage;
+ if (org.purpurmc.purpur.PurpurConfig.sleepNotPossible.isBlank()) {
+ clientMessage = null;
+ } else if (!org.purpurmc.purpur.PurpurConfig.sleepNotPossible.equalsIgnoreCase("default")) {
+ clientMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepNotPossible));
+ } else {
+ clientMessage = Component.translatable("sleep.not_possible");
+ }
+ if (clientMessage != null) {
+ this.displayClientMessage(clientMessage, true);
+ }
+ // Purpur end - Customizable sleeping actionbar messages
}
((ServerLevel)this.level()).updateSleepingPlayerList();
@@ -2014,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}