mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
all the patches \o/
This commit is contained in:
40
patches/server/0271-Cache-server-motd.patch
Normal file
40
patches/server/0271-Cache-server-motd.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
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 b0e0ff457c695aba58c208a678492a650a3834c8..6e63763205627a923563bf625b39e04ab436fea6 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -250,7 +250,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
|
||||
@@ -1900,17 +1900,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 isStopped() {
|
||||
Reference in New Issue
Block a user