mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7b3b593 [ci skip] Update checkout action in workflow (#8510) PaperMC/Paper@36869cc Fix new block data in EntityChangeBlockEvent for silverfish when mobGriefing isn't enabled (#8099) PaperMC/Paper@2432233 Add allow server listing & text filtering client options (#7595) PaperMC/Paper@954e6f0 Fix a bunch more forceDrops for dropping items (#8095) PaperMC/Paper@32d95e9 Track projectile source for fireworks from dispensers (#8044) PaperMC/Paper@0249750 Fix EntityArgument suggestion permissions to align with EntitySelector#checkPermissions (#8511) PaperMC/Paper@8acb05d Make CommandSyntaxException implement ComponentMessageThrowable (#8513) PaperMC/Paper@c264018 [ci skip] Undo modification to removed patches in latest commit (#8512) PaperMC/Paper@304ab35 [ci skip] Remove old todo file PaperMC/Paper@8a4b752 Fix wrong descriptor in ASMEventExecutorGenerator (#8506) PaperMC/Paper@b743144 Fix MC-147659 (#8423) PaperMC/Paper@aaf5e39 Deprecate unused VehicleEntityCollisionEvent methods (#8498)
99 lines
3.8 KiB
Diff
99 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ben Kerllenevich <ben@omega24.dev>
|
|
Date: Wed, 8 Jun 2022 13:49:49 -0400
|
|
Subject: [PATCH] Drop incompatible tests
|
|
|
|
|
|
diff --git a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java b/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
|
|
deleted file mode 100644
|
|
index da2eb57ea64403657744ea00eff40243ef51df58..0000000000000000000000000000000000000000
|
|
--- a/src/test/java/io/papermc/paper/permissions/MinecraftCommandPermissionsTest.java
|
|
+++ /dev/null
|
|
@@ -1,86 +0,0 @@
|
|
-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;
|
|
-import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
|
|
-import org.bukkit.permissions.Permission;
|
|
-import org.bukkit.support.AbstractTestingBase;
|
|
-import org.junit.AfterClass;
|
|
-import org.junit.BeforeClass;
|
|
-import org.junit.Test;
|
|
-
|
|
-import java.io.PrintStream;
|
|
-import java.util.HashSet;
|
|
-import java.util.LinkedHashSet;
|
|
-import java.util.List;
|
|
-import java.util.Set;
|
|
-import java.util.TreeSet;
|
|
-
|
|
-import static org.junit.Assert.assertTrue;
|
|
-
|
|
-public class MinecraftCommandPermissionsTest extends AbstractTestingBase {
|
|
-
|
|
- private static PrintStream old;
|
|
- @BeforeClass
|
|
- public static void before() {
|
|
- old = System.out;
|
|
- System.setOut(Bootstrap.STDOUT);
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void test() {
|
|
- CraftDefaultPermissions.registerCorePermissions();
|
|
- Set<String> perms = collectMinecraftCommandPerms();
|
|
-
|
|
- Commands commands = new Commands(Commands.CommandSelection.DEDICATED, new CommandBuildContext(RegistryAccess.BUILTIN.get()));
|
|
- RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
|
|
- Set<String> missing = new LinkedHashSet<>();
|
|
- Set<String> foundPerms = new HashSet<>();
|
|
- for (CommandNode<CommandSourceStack> child : root.getChildren()) {
|
|
- final String vanillaPerm = VanillaCommandWrapper.getPermission(child);
|
|
- if (!perms.contains(vanillaPerm)) {
|
|
- missing.add("Missing permission for " + child.getName() + " (" + vanillaPerm + ") command");
|
|
- } else {
|
|
- foundPerms.add(vanillaPerm);
|
|
- }
|
|
- }
|
|
- assertTrue("Commands missing permissions: \n" + String.join("\n", missing), missing.isEmpty());
|
|
- perms.removeAll(foundPerms);
|
|
- assertTrue("Extra permissions not associated with a command: \n" + String.join("\n", perms), perms.isEmpty());
|
|
- }
|
|
-
|
|
- private static final List<String> TO_SKIP = List.of(
|
|
- "minecraft.command.selector"
|
|
- );
|
|
-
|
|
- private static Set<String> collectMinecraftCommandPerms() {
|
|
- Set<String> perms = new TreeSet<>();
|
|
- for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
|
|
- if (perm.getName().startsWith("minecraft.command.")) {
|
|
- if (TO_SKIP.contains(perm.getName())) {
|
|
- continue;
|
|
- }
|
|
- if (perm.getName().endsWith(".xp")) {
|
|
- perms.add("minecraft.command.experience"); // for the "experience" command, craftbukkit perm is "minecraft.command.xp"
|
|
- continue;
|
|
- }
|
|
- perms.add(perm.getName());
|
|
- }
|
|
- }
|
|
- return perms;
|
|
- }
|
|
-
|
|
- @AfterClass
|
|
- public static void after() {
|
|
- if (old != null) {
|
|
- System.setOut(old);
|
|
- }
|
|
- }
|
|
-}
|