geforkt von Mirrors/Paper
Cache Component MOTDs
Dieser Commit ist enthalten in:
Ursprung
7b09f21566
Commit
226468f7b0
@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
private String motd;
|
@Nullable private net.kyori.adventure.text.Component cachedMotd; // Paper
|
||||||
private int playerIdleTimeout;
|
private int playerIdleTimeout;
|
||||||
public final long[] tickTimes;
|
public final long[] tickTimes;
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -1367,6 +1367,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
buf.writeComponent(this.header);
|
buf.writeComponent(this.header);
|
||||||
buf.writeComponent(this.footer);
|
buf.writeComponent(this.footer);
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
private boolean allowFlight;
|
||||||
|
@Nullable
|
||||||
|
private String motd;
|
||||||
|
+ @Nullable private net.kyori.adventure.text.Component cachedMotd; // Paper
|
||||||
|
private int playerIdleTimeout;
|
||||||
|
public final long[] tickTimes;
|
||||||
|
@Nullable
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
return this.motd;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ 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();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public void setMotd(String motd) {
|
||||||
|
this.motd = motd;
|
||||||
|
+ this.cachedMotd = null; // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean previewsChat() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@ -1958,7 +1989,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public net.kyori.adventure.text.Component motd() {
|
+ public net.kyori.adventure.text.Component motd() {
|
||||||
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(console.getMotd());
|
+ return console.getComponentMotd();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren