From db921d61115e5b315b250d40db76f879865c504b Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 6 Mar 2022 09:08:26 +0100 Subject: [PATCH] Updated Upstream (CraftBukkit) 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 CraftBukkit Changes: 808cb7ca PR-1023: Improve consistency of tag API --- .../api/Fix-Spigot-annotation-mistakes.patch | 9 ------ patches/server/Add-GameEvent-tags.patch | 29 ++++++++++--------- work/CraftBukkit | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 31c4580b4..ce5eb13f7 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -73,15 +73,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @NotNull // Paper ScoreboardManager getScoreboardManager(); - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @param clazz the class of the tag entries - * @return the tag or null - */ -- @Nullable -+ @UndefinedNullability // Paper - Tag getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class clazz); - /** diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Add-GameEvent-tags.patch b/patches/server/Add-GameEvent-tags.patch index ad47f9106..25fa3c80e 100644 --- a/patches/server/Add-GameEvent-tags.patch +++ b/patches/server/Add-GameEvent-tags.patch @@ -53,29 +53,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.level.levelgen.PatrolSpawner; import net.minecraft.world.level.levelgen.PhantomSpawner; @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type"); - - return (org.bukkit.Tag) new CraftEntityTag(Registry.ENTITY_TYPE, TagKey.create(Registry.ENTITY_TYPE_REGISTRY, key)); + return (org.bukkit.Tag) new CraftEntityTag(Registry.ENTITY_TYPE, entityTagKey); + } + } + // Paper start -+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: ++ case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> { + Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class, "Game Event namespace must have GameEvent type"); -+ -+ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(Registry.GAME_EVENT, TagKey.create(Registry.GAME_EVENT_REGISTRY, key)); ++ TagKey gameEventTagKey = TagKey.create(Registry.GAME_EVENT_REGISTRY, key); ++ if (Registry.GAME_EVENT.isKnownTagName(gameEventTagKey)) { ++ return (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(Registry.GAME_EVENT, gameEventTagKey); ++ } ++ } + // Paper end - default: - throw new IllegalArgumentException(); + default -> throw new IllegalArgumentException(); } -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { Registry> entityTags = Registry.ENTITY_TYPE; return entityTags.getTags().map(pair -> (org.bukkit.Tag) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList()); + } + // Paper start -+ case org.bukkit.Tag.REGISTRY_GAME_EVENTS: ++ case org.bukkit.Tag.REGISTRY_GAME_EVENTS -> { + Preconditions.checkArgument(clazz == org.bukkit.GameEvent.class); -+ + Registry gameEvents = Registry.GAME_EVENT; + return gameEvents.getTags().map(pair -> (org.bukkit.Tag) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList()); + // Paper end - default: - throw new IllegalArgumentException(); ++ } + default -> throw new IllegalArgumentException(); } + } diff --git a/work/CraftBukkit b/work/CraftBukkit index 4ed5af5e6..808cb7ca5 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 4ed5af5e63dea4884c9466901b4bfb0996455f7e +Subproject commit 808cb7ca5c135e65e2d23e8ab59ee891b5bc53dc