forked from PaperMC/paperweight-examples
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add permission check for spawn protection
- Loading branch information
1 parent
4ef78b5
commit 1e32357
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
patches/server/0002-Add-permission-check-for-spawn-protection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: TheMeinerLP <[email protected]> | ||
Date: Sun, 17 Mar 2024 19:59:28 +0100 | ||
Subject: [PATCH] Add permission check for spawn protection | ||
|
||
|
||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
index f2e30d8743a97c0541808dc5c03300c0d881b843..9c1b6e15c7f6b366a07c6cd774d045ea7a353955 100644 | ||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java | ||
@@ -183,6 +183,8 @@ public class GlobalConfiguration extends ConfigurationPart { | ||
public boolean allowHeadlessPistons = false; | ||
@Comment("This setting controls if grindstones should be able to output overstacked items (such as cursed books).") | ||
public boolean allowGrindstoneOverstacking = false; | ||
+ @Comment("This setting controls if players should be able to build with permission inside of the spawn protection") | ||
+ public boolean allowOverrideOpBehaviorForSpawnProtection = false; | ||
@Comment("This setting controls what compression format is used for region files.") | ||
public CompressionFormat compressionFormat = CompressionFormat.ZLIB; | ||
|
||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java | ||
index 68d268b6fff126e8645b6deec3fb549ea2286b77..738356816d1422119a7e9942b9d930888dcbbf92 100644 | ||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java | ||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java | ||
@@ -19,6 +19,8 @@ import java.util.Locale; | ||
import java.util.Optional; | ||
import java.util.function.BooleanSupplier; | ||
import javax.annotation.Nullable; | ||
+ | ||
+import io.papermc.paper.configuration.GlobalConfiguration; | ||
import net.minecraft.DefaultUncaughtExceptionHandler; | ||
import net.minecraft.DefaultUncaughtExceptionHandlerWithName; | ||
import net.minecraft.SharedConstants; | ||
@@ -575,6 +577,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface | ||
return false; | ||
} else if (this.getPlayerList().isOp(player.getGameProfile())) { | ||
return false; | ||
+ } else if (GlobalConfiguration.get().unsupportedSettings.allowOverrideOpBehaviorForSpawnProtection && player.getBukkitEntity().hasPermission("bukkit.environment.spawnprotection.ignore")) { // OneLitePaper start - Add permission check for spawn protection | ||
+ return false; // OneLitePaper end - Add permission check for spawn protection | ||
} else if (this.getSpawnProtectionRadius() <= 0) { | ||
return false; | ||
} else { |