mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix CraftCriteria defaults map (#6723)
This commit is contained in:
parent
0d074fcfc9
commit
a0cb2fd31d
1 changed files with 32 additions and 0 deletions
32
patches/server/Fix-CraftCriteria-defaults-map.patch
Normal file
32
patches/server/Fix-CraftCriteria-defaults-map.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 4 Oct 2021 22:31:51 -0700
|
||||
Subject: [PATCH] Fix CraftCriteria defaults map
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java
|
||||
@@ -0,0 +0,0 @@ final class CraftCriteria {
|
||||
}
|
||||
|
||||
static CraftCriteria getFromNMS(Objective objective) {
|
||||
- return CraftCriteria.DEFAULTS.get(objective.getCriteria().getName());
|
||||
+ return java.util.Objects.requireNonNullElseGet(CraftCriteria.DEFAULTS.get(objective.getCriteria().getName()), () -> new CraftCriteria(objective.getCriteria())); // Paper
|
||||
}
|
||||
|
||||
static CraftCriteria getFromBukkit(String name) {
|
||||
@@ -0,0 +0,0 @@ final class CraftCriteria {
|
||||
if (criteria != null) {
|
||||
return criteria;
|
||||
}
|
||||
+ // Paper start - fix criteria defaults
|
||||
+ var nmsCriteria = ObjectiveCriteria.byName(name);
|
||||
+ if (nmsCriteria.isPresent()) {
|
||||
+ return new CraftCriteria(nmsCriteria.get());
|
||||
+ }
|
||||
+ // Paper end
|
||||
return new CraftCriteria(name);
|
||||
}
|
||||
|
Loading…
Reference in a new issue