mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 21:44:40 +01:00
a284e40c70
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9b45fa2f #667: Allow setting BrewEvent results 8c776ddc SPIGOT-6762: ChatPaginator.wordWrap only transfers one modifier da372966 SPIGOT-4590, SPIGOT-6769: Clarify DamageCause documentation CraftBukkit Changes: cef1fda3 #947: Add missing spawn eggs for SpawnEggMeta eb9a0f34 #945: Allow setting BrewEvent results
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
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 22801e33fa15322c37cd11d73a40a43fa721a8e4..0cd63772871311fc0cb7111657cc9a9dac106167 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftCriteria.java
|
|
@@ -37,7 +37,7 @@ 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) {
|
|
@@ -45,6 +45,12 @@ 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);
|
|
}
|
|
|