From b3b63d3a02cc0f7e4cc680cec5abf82bacaed42b Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 8 Jun 2022 18:18:49 +0200 Subject: [PATCH] Fix tests (again?) --- patches/server/0411-Implement-Mob-Goal-API.patch | 10 +++++++--- ...Added-missing-default-perms-for-commands.patch | 15 ++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/patches/server/0411-Implement-Mob-Goal-API.patch b/patches/server/0411-Implement-Mob-Goal-API.patch index 3e80ae5361..d7bd4b0886 100644 --- a/patches/server/0411-Implement-Mob-Goal-API.patch +++ b/patches/server/0411-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index 9bd09c4465f5fe1cd68b63da293f506da4b17a72..31659bb0a78dc00f29a057915fcbb0283b6081e0 100644 +index 21767024545269ca83f0fd4b64f02001408cd6ca..8c597c2671746ecf89d53704fba4d85d61dc316c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { @@ -18,10 +18,10 @@ index 9bd09c4465f5fe1cd68b63da293f506da4b17a72..31659bb0a78dc00f29a057915fcbb028 } diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..181abe014baba9ac51064c003381281a8fa43fe4 +index 0000000000000000000000000000000000000000..c9901f8c7f3af57cb2e0bec315caa97adcb6f5ea --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java -@@ -0,0 +1,367 @@ +@@ -0,0 +1,371 @@ +package com.destroystokyo.paper.entity.ai; + +import com.destroystokyo.paper.entity.RangedEntity; @@ -261,6 +261,10 @@ index 0000000000000000000000000000000000000000..181abe014baba9ac51064c003381281a + bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, org.bukkit.entity.GlowSquid.class); + bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, org.bukkit.entity.Axolotl.class); + bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, org.bukkit.entity.Goat.class); ++ bukkitMap.put(net.minecraft.world.entity.animal.frog.Frog.class, org.bukkit.entity.Frog.class); ++ bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, org.bukkit.entity.Tadpole.class); ++ bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class); ++ bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class); + } + + public static String getUsableName(Class clazz) { diff --git a/patches/server/0531-Added-missing-default-perms-for-commands.patch b/patches/server/0531-Added-missing-default-perms-for-commands.patch index 50b46662b0..412163ee5a 100644 --- a/patches/server/0531-Added-missing-default-perms-for-commands.patch +++ b/patches/server/0531-Added-missing-default-perms-for-commands.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added missing default perms for commands diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java -index ca30f9c590f792caa8f1b76d7219e9121d932673..045ebc5533de7486d1975efe9d51ab368969178a 100644 +index ca30f9c590f792caa8f1b76d7219e9121d932673..0467419fc8a06c241a46216c8f8c32abeb9fbc26 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java +++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java -@@ -25,12 +25,68 @@ public final class CommandPermissions { +@@ -25,12 +25,67 @@ public final class CommandPermissions { DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands); DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands); DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands); @@ -40,14 +40,12 @@ index ca30f9c590f792caa8f1b76d7219e9121d932673..045ebc5533de7486d1975efe9d51ab36 + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamerule", "Allows a user to set or query a game rule value", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "jfr", "Allows a user to use the vanilla Java FlightRecorder profiling system", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locate", "Allows the user to locate the closest structure", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "locatebiome", "Allows the user to locate the closest biome", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "loot", "Allows the user to drop items from an inventory slot onto the ground", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "op", "Allows the user to grant operator status to a player", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "pardon", "Allows the user to remove entries from the player ban list", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "pardon-ip", "Allows the user to remove entries from the ip address ban list", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "perf", "Allows the user to start/stop the vanilla performance metrics capture", PermissionDefault.OP, commands); -+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "placefeature", "Allows the user to place features with the command", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands); @@ -74,22 +72,25 @@ index ca30f9c590f792caa8f1b76d7219e9121d932673..045ebc5533de7486d1975efe9d51ab36 + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands); + DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands); ++ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "place", "Allows the user to place features and structures", PermissionDefault.OP, commands); + // Paper end DefaultPermissions.registerPermission("minecraft.admin.command_feedback", "Receive command broadcasts when sendCommandFeedback is true", PermissionDefault.OP, commands); diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..e80f8a32c82f89a2f898db1d869daadee735176f +index 0000000000000000000000000000000000000000..da2eb57ea64403657744ea00eff40243ef51df58 --- /dev/null +++ b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java -@@ -0,0 +1,84 @@ +@@ -0,0 +1,86 @@ +package io.papermc.paper.permissions; + +import com.mojang.brigadier.tree.CommandNode; +import com.mojang.brigadier.tree.RootCommandNode; ++import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; ++import net.minecraft.core.RegistryAccess; +import net.minecraft.server.Bootstrap; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.command.VanillaCommandWrapper; @@ -123,7 +124,7 @@ index 0000000000000000000000000000000000000000..e80f8a32c82f89a2f898db1d869daade + CraftDefaultPermissions.registerCorePermissions(); + Set perms = collectMinecraftCommandPerms(); + -+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED); ++ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, new CommandBuildContext(RegistryAccess.BUILTIN.get())); + RootCommandNode root = commands.getDispatcher().getRoot(); + Set missing = new LinkedHashSet<>(); + Set foundPerms = new HashSet<>();