13
0
geforkt von Mirrors/Paper

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
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-03-06 09:08:26 +01:00
Ursprung ffe0d7b99c
Commit db921d6111
3 geänderte Dateien mit 17 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -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
<T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> 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

Datei anzeigen

@ -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<T>) new CraftEntityTag(Registry.ENTITY_TYPE, TagKey.create(Registry.ENTITY_TYPE_REGISTRY, key));
return (org.bukkit.Tag<T>) 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<T>) new io.papermc.paper.CraftGameEventTag(Registry.GAME_EVENT, TagKey.create(Registry.GAME_EVENT_REGISTRY, key));
+ TagKey<GameEvent> gameEventTagKey = TagKey.create(Registry.GAME_EVENT_REGISTRY, key);
+ if (Registry.GAME_EVENT.isKnownTagName(gameEventTagKey)) {
+ return (org.bukkit.Tag<T>) 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<EntityType<?>> entityTags = Registry.ENTITY_TYPE;
return entityTags.getTags().map(pair -> (org.bukkit.Tag<T>) 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<GameEvent> gameEvents = Registry.GAME_EVENT;
+ return gameEvents.getTags().map(pair -> (org.bukkit.Tag<T>) new io.papermc.paper.CraftGameEventTag(gameEvents, pair.getFirst())).collect(ImmutableList.toImmutableList());
+ // Paper end
default:
throw new IllegalArgumentException();
+ }
default -> throw new IllegalArgumentException();
}
}

@ -1 +1 @@
Subproject commit 4ed5af5e63dea4884c9466901b4bfb0996455f7e
Subproject commit 808cb7ca5c135e65e2d23e8ab59ee891b5bc53dc