mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
add configurable shovel flattenables
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 3 Jul 2021 21:52:15 -0500
|
||||
Subject: [PATCH] Customizable sleeping actionbar messages
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index fea5481c98e4cbcaecb9f4adef35b7340ad0c9b8..df8efd93ad6ab30974e3025187cd234b37111129 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1185,11 +1185,27 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (this.canSleepThroughNights()) {
|
||||
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
|
||||
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
- MutableComponent ichatmutablecomponent;
|
||||
+ Component ichatmutablecomponent;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i)) {
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) {
|
||||
+ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight));
|
||||
+ } else
|
||||
ichatmutablecomponent = Component.translatable("sleep.skipping_night");
|
||||
} else {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ } else
|
||||
+ // Purpur end
|
||||
ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 685a30ecdd3af8db8f0caf99db6e576ed293fd1b..0e0024e235ce0ffbb54893ff250f61061d4ebe1f 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -186,6 +186,8 @@ public class PurpurConfig {
|
||||
public static String dontRunWithScissors = "<red><italic>Don't run with scissors!";
|
||||
public static String uptimeCommandOutput = "<green>Server uptime is <uptime>";
|
||||
public static String unverifiedUsername = "default";
|
||||
+ public static String sleepSkippingNight = "default";
|
||||
+ public static String sleepingPlayersPercent = "default";
|
||||
private static void messages() {
|
||||
cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
|
||||
afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
|
||||
@@ -200,6 +202,8 @@ public class PurpurConfig {
|
||||
dontRunWithScissors = getString("settings.messages.dont-run-with-scissors", dontRunWithScissors);
|
||||
uptimeCommandOutput = getString("settings.messages.uptime-command-output", uptimeCommandOutput);
|
||||
unverifiedUsername = getString("settings.messages.unverified-username", unverifiedUsername);
|
||||
+ sleepSkippingNight = getString("settings.messages.sleep-skipping-night", sleepSkippingNight);
|
||||
+ sleepingPlayersPercent = getString("settings.messages.sleeping-players-percent", sleepingPlayersPercent);
|
||||
}
|
||||
|
||||
public static String deathMsgRunWithScissors = "<player> slipped and fell on their shears";
|
||||
Reference in New Issue
Block a user