mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
22 lines
1.0 KiB
Diff
22 lines
1.0 KiB
Diff
--- a/net/minecraft/server/commands/GameModeCommand.java
|
|
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
|
@@ -53,6 +_,18 @@
|
|
}
|
|
|
|
private static int setMode(CommandContext<CommandSourceStack> source, Collection<ServerPlayer> players, GameType gameType) {
|
|
+ // Purpur start - Gamemode extra permissions
|
|
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
|
+ String gamemode = gameType.getName();
|
|
+ CommandSourceStack sender = source.getSource();
|
|
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
|
+ return 0;
|
|
+ }
|
|
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(2, "minecraft.command.gamemode." + gamemode + ".other")) {
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+ // Purpur end - Gamemode extra permissions
|
|
int i = 0;
|
|
|
|
for (ServerPlayer serverPlayer : players) {
|