fix last test issue

This commit is contained in:
Jake Potrebic 2024-04-27 17:45:30 -07:00
parent 7e3d5b569d
commit d964c15e15
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
2 changed files with 30 additions and 2 deletions

View File

@ -225,3 +225,31 @@ index 0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a..47355158e5e762540a10dc67b23092a0
}
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index 61115db85b81e627d11a0de21691a2ca69aafe2c..ba2a2ca0c36e61cb3cc00fafc7a5dd9f7050388f 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -98,6 +98,9 @@ public final class VanillaCommandWrapper extends BukkitCommand {
} else {
commandName = vanillaCommand.getRedirect().getName();
}
+ if ("pgive".equals(stripDefaultNamespace(commandName))) {
+ return "bukkit.command.paper.pgive";
+ }
return "minecraft.command." + stripDefaultNamespace(commandName);
}
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
index ca71c688b37ce2c8b712a4f9216cf872c8edf78e..2f3ff50bf3f70b6b404d02d5ffcc079162a63bc1 100644
--- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
+++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
@@ -45,6 +45,9 @@ public class MinecraftCommandPermissionsTest extends AbstractTestingBase {
Set<String> foundPerms = new HashSet<>();
for (CommandNode<CommandSourceStack> child : root.getChildren()) {
final String vanillaPerm = VanillaCommandWrapper.getPermission(child);
+ if ("bukkit.command.paper.pgive".equals(vanillaPerm)) { // skip our custom give command
+ continue;
+ }
if (!perms.contains(vanillaPerm)) {
missing.add("Missing permission for " + child.getName() + " (" + vanillaPerm + ") command");
} else {

View File

@ -729,7 +729,7 @@ index 100e9b72b1dac2deb956753b9a8097ba917236fa..0b11d5ea89539decd2f6c60c5b581bbd
@Test
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
index 0000000000000000000000000000000000000000..63218eeaded04157ed740a7b45ff6f2e7b533b98
index 0000000000000000000000000000000000000000..7dc898d1d383aef8a913059e4f5695b5cdc719de
--- /dev/null
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/MetaHandledTagsTest.java
@@ -0,0 +1,30 @@
@ -756,7 +756,7 @@ index 0000000000000000000000000000000000000000..63218eeaded04157ed740a7b45ff6f2e
+ for (final ClassInfo subclass : subclasses) {
+ final Class<CraftMetaItem> clazz = subclass.loadClass(CraftMetaItem.class);
+ CraftMetaItem.getTopLevelHandledDcts(clazz); // load into map
+ assertTrue(CraftMetaItem.HANDLED_TAGS_PER_TYPE.containsKey(clazz), subclass.getName() + " not found in handled tags map");
+ assertTrue(CraftMetaItem.HANDLED_DCTS_PER_TYPE.containsKey(clazz), subclass.getName() + " not found in handled tags map");
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);