mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) bc7ea673a Add internal channel initialization listeners (#5557) b28ad17ac Check for world change in MoveEvent API methods 3095c7592 [Auto] Updated Upstream (CraftBukkit) f56989c97 Add RespawnFlags to PlayerRespawnEvent (#5533) 7579c2667 Add more API to PlayerMoveEvent (#5553)
79 lines
5.1 KiB
Diff
79 lines
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 30 Apr 2021 13:39:39 -0500
|
|
Subject: [PATCH] Gamemode extra permissions
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java
|
|
index 4480fe75cfad35a5104b5116c5ec2c80d18f15f5..d73daa29f784283e03ad2ea3126cca7e572602d4 100644
|
|
--- a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java
|
|
+++ b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java
|
|
@@ -190,6 +190,21 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys
|
|
}
|
|
// CraftBukkit end
|
|
|
|
+ // Purpur start
|
|
+ public boolean testPermission(int i, String bukkitPermission) {
|
|
+ if (hasPermission(i, bukkitPermission)) {
|
|
+ return true;
|
|
+ }
|
|
+ String permissionMessage = getWorld().getServer().getPermissionMessage();
|
|
+ if (permissionMessage.length() != 0) {
|
|
+ for (String line : permissionMessage.replace("<permission>", bukkitPermission).split("\n")) {
|
|
+ sendFailureMessage(new ChatComponentText(line));
|
|
+ }
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public Vec3D getPosition() {
|
|
return this.d;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/commands/CommandGamemode.java b/src/main/java/net/minecraft/server/commands/CommandGamemode.java
|
|
index 376d5eac9c17365266d8a4986bf4c19030454c9a..f004d027d673ec09c768c3ab0734b6b099921ef9 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/CommandGamemode.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/CommandGamemode.java
|
|
@@ -55,6 +55,7 @@ public class CommandGamemode {
|
|
}
|
|
|
|
private static int a(CommandContext<CommandListenerWrapper> commandcontext, Collection<EntityPlayer> collection, EnumGamemode enumgamemode) {
|
|
+ if (net.pl3x.purpur.PurpurConfig.commandGamemodeRequiresPermission && !commandcontext.getSource().testPermission(2, "minecraft.command.gamemode." + enumgamemode.b())) return 0; // Purpur
|
|
int i = 0;
|
|
Iterator iterator = collection.iterator();
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index e0228fb58149ac8a9430d54157d5e92c93618f22..56424e45c04e7165c0671f74cdcd0147d1069af7 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -211,6 +211,11 @@ public class PurpurConfig {
|
|
disableGiveCommandDrops = getBoolean("settings.disable-give-dropping", disableGiveCommandDrops);
|
|
}
|
|
|
|
+ public static boolean commandGamemodeRequiresPermission = false;
|
|
+ private static void commandSettings() {
|
|
+ commandGamemodeRequiresPermission = getBoolean("settings.command.gamemode.requires-specific-permission", commandGamemodeRequiresPermission);
|
|
+ }
|
|
+
|
|
public static boolean barrelSixRows = false;
|
|
public static boolean enderChestSixRows = false;
|
|
public static boolean enderChestPermissionRows = false;
|
|
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 f0a57d225b81a505ff12425155ba838d8fad990c..81ead4723872528c53efa9e0f23799571447ac86 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
|
|
@@ -23,7 +23,12 @@ public final class CommandPermissions {
|
|
DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
|
|
DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
|
|
DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
|
|
- DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
|
|
+ // Purpur start
|
|
+ Permission gamemode = DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
|
|
+ for (net.minecraft.world.level.EnumGamemode enumgamemode : net.minecraft.world.level.EnumGamemode.values()) {
|
|
+ gamemode.addParent(DefaultPermissions.registerPermission(PREFIX + "gamemode." + enumgamemode.b(), "Allows the user to set " + enumgamemode.b() + " gamemode", PermissionDefault.OP), true);
|
|
+ }
|
|
+ // Purpur end
|
|
DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
|
|
DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
|
|
DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
|