Init legacy material data

This fixes an issue with plugins using legacy materials, spigot does
not populate the bukkit registry properly, leading to NPEs when using
outdated plugins. This patch should likely be dropped when spigot fixes
their legacy data usage....

Also rebuild patches because 10/10
This commit is contained in:
Shane Freeder 2020-01-23 21:38:17 +00:00
parent c471490985
commit 969ef51ad2
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
4 changed files with 43 additions and 3 deletions

View File

@ -1,4 +1,4 @@
From bae03b911cd1d7c302d1da64f3bea920cc3d17d8 Mon Sep 17 00:00:00 2001 From 8c6b864839c730a3d0205080d8bdf5e0c21bcc93 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com> From: kickash32 <kickash32@gmail.com>
Date: Sat, 21 Dec 2019 15:22:09 -0500 Date: Sat, 21 Dec 2019 15:22:09 -0500
Subject: [PATCH] Tracking Range Improvements Subject: [PATCH] Tracking Range Improvements

View File

@ -1,4 +1,4 @@
From b099812316e7ef71aaa7f30bc94aaab0a74605b2 Mon Sep 17 00:00:00 2001 From 05d3e07fcbf1e0c8638e5875d5ae2716edf9a487 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 22 Jan 2020 21:00:21 +0000 Date: Wed, 22 Jan 2020 21:00:21 +0000
Subject: [PATCH] Fix comparator behavior for EntityPhanton goal Subject: [PATCH] Fix comparator behavior for EntityPhanton goal

View File

@ -1,4 +1,4 @@
From 5d99db6a8e5a48cb45e6853344a4ff7261173d08 Mon Sep 17 00:00:00 2001 From 046994b57b14f711db5c7546c56b184d677d69ae Mon Sep 17 00:00:00 2001
From: AJMFactsheets <AJMFactsheets@gmail.com> From: AJMFactsheets <AJMFactsheets@gmail.com>
Date: Wed, 22 Jan 2020 19:52:28 -0600 Date: Wed, 22 Jan 2020 19:52:28 -0600
Subject: [PATCH] Fix items vanishing through end portal Subject: [PATCH] Fix items vanishing through end portal

View File

@ -0,0 +1,40 @@
From 18d1e63fe8d950682ad5dbc1a17f9e546b04e80a Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 23 Jan 2020 21:30:07 +0000
Subject: [PATCH] Init legacy material data
This fixes an issue with plugins using legacy materials, spigot does
not populate the bukkit registry properly, leading to NPEs when using
outdated plugins. This patch should likely be dropped when spigot fixes
their legacy data usage....
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 6a6e4fe486..8d93ad6b45 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -91,10 +91,6 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
for (Material material : Material.values()) {
- if (material.isLegacy()) {
- continue;
- }
-
MinecraftKey key = key(material);
IRegistry.ITEM.getOptional(key).ifPresent((item) -> {
MATERIAL_ITEM.put(material, item);
@@ -122,6 +118,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
public static MinecraftKey key(Material mat) {
+ // Paper start
+ if (mat.isLegacy()) {
+ mat = CraftLegacy.fromLegacy(mat);
+ }
+ // Paper end
return CraftNamespacedKey.toMinecraft(mat.getKey());
}
// ========================================================================
--
2.25.0