Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);
}

Loading