mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@e4f5e1c Bump netty Pufferfish Changes: pufferfish-gg/Pufferfish@a8543a4 #33 Fix anti-xray related crash bug pufferfish-gg/Pufferfish@aefcb1a Updated Upstream (Paper)
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);
|
|
- }
|
|
- }
|
|
-}
|