diff --git a/paper-server/patches/sources/net/minecraft/world/scores/Objective.java.patch b/paper-server/patches/sources/net/minecraft/world/scores/Objective.java.patch new file mode 100644 index 000000000000..eb198effabae --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/scores/Objective.java.patch @@ -0,0 +1,38 @@ +--- a/net/minecraft/world/scores/Objective.java ++++ b/net/minecraft/world/scores/Objective.java +@@ -18,7 +_,7 @@ + private final String name; + private final ObjectiveCriteria criteria; + private Component displayName; +- private Component formattedDisplayName; ++ private @Nullable Component formattedDisplayName; // Paper - Lazy initialization because only used internally by Commands + private ObjectiveCriteria.RenderType renderType; + private boolean displayAutoUpdate; + private @Nullable NumberFormat numberFormat; +@@ -36,7 +_,6 @@ + this.name = name; + this.criteria = criteria; + this.displayName = displayName; +- this.formattedDisplayName = this.createFormattedDisplayName(); + this.renderType = renderType; + this.displayAutoUpdate = displayAutoUpdate; + this.numberFormat = numberFormat; +@@ -81,12 +_,17 @@ + } + + public Component getFormattedDisplayName() { ++ // Paper start - Lazy initialization because only used internally by Commands ++ if (this.formattedDisplayName == null) { ++ this.formattedDisplayName = this.createFormattedDisplayName(); ++ } ++ // Paper start - Lazy initialization because only used internally by Commands + return this.formattedDisplayName; + } + + public void setDisplayName(final Component name) { + this.displayName = name; +- this.formattedDisplayName = this.createFormattedDisplayName(); ++ this.formattedDisplayName = null; // Paper - Lazy initialization because only used internally by Commands + this.scoreboard.onObjectiveChanged(this); + } +