address compile and test issue (#10890)
Dieser Commit ist enthalten in:
Ursprung
f873bcee24
Commit
1f8e7a7b09
@ -3,6 +3,7 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|||||||
Date: Mon, 13 Feb 2023 14:14:56 -0800
|
Date: Mon, 13 Feb 2023 14:14:56 -0800
|
||||||
Subject: [PATCH] Test changes
|
Subject: [PATCH] Test changes
|
||||||
|
|
||||||
|
Co-authored-by: yannnicklamprecht <yannicklamprecht@live.de>
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index f276414e9e81abf8f1f80991ebd5ab43472e07b1..7a0f2391a464eeebc5e57856300bc000b8d35e52 100644
|
index f276414e9e81abf8f1f80991ebd5ab43472e07b1..7a0f2391a464eeebc5e57856300bc000b8d35e52 100644
|
||||||
@ -351,10 +352,40 @@ index ebcb65cb74acdb9d1bcf2b4b3551a2dc6d809bc9..7d9dbed7281099b78d7f898885b37cdc
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
index 1acdf5bc439c073c1777c2c4f5743ae082f4a621..bd13fd46f79ab9000b708526acbadcc7210c8a92 100644
|
index 1acdf5bc439c073c1777c2c4f5743ae082f4a621..183d30e3d3d413b05c762f374a964498d6ffdec4 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
@@ -99,6 +99,15 @@ public final class DummyServer {
|
@@ -62,7 +62,7 @@ public final class DummyServer {
|
||||||
|
when(instance.getTag(any(), any(), any())).then(mock -> {
|
||||||
|
String registry = mock.getArgument(0);
|
||||||
|
Class<?> clazz = mock.getArgument(2);
|
||||||
|
- MinecraftKey key = CraftNamespacedKey.toMinecraft(mock.getArgument(1));
|
||||||
|
+ net.minecraft.resources.ResourceLocation key = CraftNamespacedKey.toMinecraft(mock.getArgument(1)); // Paper - address remapping issues
|
||||||
|
|
||||||
|
switch (registry) {
|
||||||
|
case org.bukkit.Tag.REGISTRY_BLOCKS -> {
|
||||||
|
@@ -81,24 +81,32 @@ public final class DummyServer {
|
||||||
|
}
|
||||||
|
case org.bukkit.Tag.REGISTRY_FLUIDS -> {
|
||||||
|
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
|
||||||
|
- TagKey<FluidType> fluidTagKey = TagKey.create(Registries.FLUID, key);
|
||||||
|
+ TagKey<net.minecraft.world.level.material.Fluid> fluidTagKey = TagKey.create(Registries.FLUID, key); // Paper - address remapping issues
|
||||||
|
if (BuiltInRegistries.FLUID.getTag(fluidTagKey).isPresent()) {
|
||||||
|
return new CraftFluidTag(BuiltInRegistries.FLUID, fluidTagKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case org.bukkit.Tag.REGISTRY_ENTITY_TYPES -> {
|
||||||
|
Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type");
|
||||||
|
- TagKey<EntityTypes<?>> entityTagKey = TagKey.create(Registries.ENTITY_TYPE, key);
|
||||||
|
+ TagKey<net.minecraft.world.entity.EntityType<?>> entityTagKey = TagKey.create(Registries.ENTITY_TYPE, key); // Paper - address remapping issues
|
||||||
|
if (BuiltInRegistries.ENTITY_TYPE.getTag(entityTagKey).isPresent()) {
|
||||||
|
return new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- default -> throw new IllegalArgumentException();
|
||||||
|
+ default -> new io.papermc.paper.util.EmptyTag(); // Paper - testing additions
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -364,7 +395,6 @@ index 1acdf5bc439c073c1777c2c4f5743ae082f4a621..bd13fd46f79ab9000b708526acbadcc7
|
|||||||
+
|
+
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
+ final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
||||||
+ when(instance.getPluginManager()).thenReturn(pluginManager);
|
+ when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
+ when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag());
|
|
||||||
+ // paper end - testing additions
|
+ // paper end - testing additions
|
||||||
+
|
+
|
||||||
Bukkit.setServer(instance);
|
Bukkit.setServer(instance);
|
||||||
|
@ -8151,7 +8151,7 @@ index 0000000000000000000000000000000000000000..ba271c35eb2804f94cfc893bf94affb9
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
index bd13fd46f79ab9000b708526acbadcc7210c8a92..c2aa05f6e03b99b1e5c0a4539420be2ca93f1c3f 100644
|
index 183d30e3d3d413b05c762f374a964498d6ffdec4..bfbd80b60ac5df500d03c80de57e38aa7548dd46 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
@@ -103,7 +103,7 @@ public final class DummyServer {
|
@@ -103,7 +103,7 @@ public final class DummyServer {
|
||||||
@ -8161,5 +8161,5 @@ index bd13fd46f79ab9000b708526acbadcc7210c8a92..c2aa05f6e03b99b1e5c0a4539420be2c
|
|||||||
- final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
- final org.bukkit.plugin.PluginManager pluginManager = new org.bukkit.plugin.SimplePluginManager(instance, new org.bukkit.command.SimpleCommandMap(instance));
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
||||||
when(instance.getPluginManager()).thenReturn(pluginManager);
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag());
|
|
||||||
// paper end - testing additions
|
// paper end - testing additions
|
||||||
|
|
||||||
|
@ -1057,7 +1057,7 @@ index e48536683889cdea197746c55b0e67e7e4b9dc68..3216a3549011659a91cc4a0c656a56cd
|
|||||||
this.checkValidMinecraftToBukkit(clazz);
|
this.checkValidMinecraftToBukkit(clazz);
|
||||||
|
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
index c2aa05f6e03b99b1e5c0a4539420be2ca93f1c3f..41dcf87d945a0acb7806cb1704ee12f7f447daf7 100644
|
index bfbd80b60ac5df500d03c80de57e38aa7548dd46..cce9e2226ef554c10e1df1dbaa1791656d5d0799 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
@@ -54,10 +54,7 @@ public final class DummyServer {
|
@@ -54,10 +54,7 @@ public final class DummyServer {
|
||||||
|
@ -785,7 +785,7 @@ index 51e2acf125bdff2ba6d8fd8af9f22e233d7c74a7..6bed0a5c8d9f1ca72678cdf4699128e4
|
|||||||
@Test
|
@Test
|
||||||
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java
|
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..d9692972e3ad089885d43711b6a7fb3e96da59b1
|
index 0000000000000000000000000000000000000000..43fca566e139d370a37b2d56156df4ed7d0d0b66
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java
|
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java
|
||||||
@@ -0,0 +1,32 @@
|
@@ -0,0 +1,32 @@
|
||||||
@ -808,7 +808,7 @@ index 0000000000000000000000000000000000000000..d9692972e3ad089885d43711b6a7fb3e
|
|||||||
+ public void checkAllMetasHaveHandledTags() {
|
+ public void checkAllMetasHaveHandledTags() {
|
||||||
+ try (final ScanResult result = new ClassGraph()
|
+ try (final ScanResult result = new ClassGraph()
|
||||||
+ .whitelistPackages("org.bukkit.craftbukkit.inventory")
|
+ .whitelistPackages("org.bukkit.craftbukkit.inventory")
|
||||||
+ .enableAllInfo().scan()) {
|
+ .enableClassInfo().scan()) {
|
||||||
+ final ClassInfoList subclasses = result.getSubclasses(CraftMetaItem.class.getName());
|
+ final ClassInfoList subclasses = result.getSubclasses(CraftMetaItem.class.getName());
|
||||||
+ assertFalse(subclasses.isEmpty(), "found 0 sub types");
|
+ assertFalse(subclasses.isEmpty(), "found 0 sub types");
|
||||||
+ for (final ClassInfo subclass : subclasses) {
|
+ for (final ClassInfo subclass : subclasses) {
|
||||||
|
@ -2817,7 +2817,7 @@ index 0000000000000000000000000000000000000000..6475510ea1084a003fb2c8645cb4538b
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
index 41dcf87d945a0acb7806cb1704ee12f7f447daf7..53b49a7ee1ae185e0def7c90cf11223f55a57e65 100644
|
index cce9e2226ef554c10e1df1dbaa1791656d5d0799..6e9ee1b56b4151c31c373e58172055e02fd7875a 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
@@ -100,7 +100,7 @@ public final class DummyServer {
|
@@ -100,7 +100,7 @@ public final class DummyServer {
|
||||||
@ -2827,5 +2827,5 @@ index 41dcf87d945a0acb7806cb1704ee12f7f447daf7..53b49a7ee1ae185e0def7c90cf11223f
|
|||||||
- final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
- final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance), null);
|
||||||
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance, new java.util.HashMap<>()), null); // Paper
|
+ final org.bukkit.plugin.PluginManager pluginManager = new io.papermc.paper.plugin.manager.PaperPluginManagerImpl(instance, new org.bukkit.command.SimpleCommandMap(instance, new java.util.HashMap<>()), null); // Paper
|
||||||
when(instance.getPluginManager()).thenReturn(pluginManager);
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag());
|
|
||||||
// paper end - testing additions
|
// paper end - testing additions
|
||||||
|
|
||||||
|
@ -96,11 +96,11 @@ index 0000000000000000000000000000000000000000..b6816485a2360b936c049b398183658e
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
index 53b49a7ee1ae185e0def7c90cf11223f55a57e65..7862d578f53e48bc467cc4f475d32d9d6ea71e04 100644
|
index 6e9ee1b56b4151c31c373e58172055e02fd7875a..11ba7a3db4c56ec00d9ad1ed8e46b242c033fe74 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
--- a/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
+++ b/src/test/java/org/bukkit/support/DummyServer.java
|
||||||
@@ -105,6 +105,14 @@ public final class DummyServer {
|
@@ -104,6 +104,14 @@ public final class DummyServer {
|
||||||
when(instance.getTag(anyString(), any(org.bukkit.NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.util.EmptyTag());
|
when(instance.getPluginManager()).thenReturn(pluginManager);
|
||||||
// paper end - testing additions
|
// paper end - testing additions
|
||||||
|
|
||||||
+ // Paper start - add test for recipe conversion
|
+ // Paper start - add test for recipe conversion
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren