mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@6d63005 Fix setEggCount method from TurtleLayEggEvent (#8385) PaperMC/Paper@abe53a7 Fix typos in isTickingWorlds API javadocs (#8382) PaperMC/Paper@01a1387 Rewrite chunk system (#8177)
41 lines
2.0 KiB
Diff
41 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 22 Jul 2022 20:33:58 -0500
|
|
Subject: [PATCH] Cache server motd
|
|
|
|
Paper ported my patch in an odd way. Keeping my patch around to reduce logic on the motd getter
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 832218df741197b6f15746b1d683ce1d3a16a03f..bc80783d36d46fb138bfa6f2e5e84679db0a68c1 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -234,7 +234,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
private boolean allowFlight;
|
|
@Nullable
|
|
private String motd;
|
|
- @Nullable private net.kyori.adventure.text.Component cachedMotd; // Paper
|
|
+ private net.kyori.adventure.text.Component cachedMotd = net.kyori.adventure.text.Component.empty(); // Paper // Purpur
|
|
private int playerIdleTimeout;
|
|
public final long[] tickTimes;
|
|
// Paper start
|
|
@@ -1884,17 +1884,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
public net.kyori.adventure.text.Component getComponentMotd() {
|
|
- net.kyori.adventure.text.Component component = cachedMotd;
|
|
- if (this.motd != null && this.cachedMotd == null) {
|
|
- component = cachedMotd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.motd);
|
|
- }
|
|
-
|
|
- return component != null ? component : net.kyori.adventure.text.Component.empty();
|
|
+ return this.cachedMotd; // Purpur
|
|
}
|
|
|
|
public void setMotd(String motd) {
|
|
this.motd = motd;
|
|
- this.cachedMotd = null; // Paper
|
|
+ this.cachedMotd = motd == null ? net.kyori.adventure.text.Component.empty() : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper // Purpur
|
|
}
|
|
|
|
public boolean previewsChat() {
|