9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/paper-patches/features/0014-Make-book-writing-configurable.patch
2025-04-07 11:35:31 -04:00

45 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Mon, 26 Dec 2022 02:11:29 +0100
Subject: [PATCH] Make book writing configurable
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following patch:
"Add option to disable books"
By: Kevin Raneri <kevin.raneri@gmail.com>
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Pufferfish description *
Books are commonly the target of duping-related exploits. If you
anticipate that your server will be an early target of duping attacks in
the event that new exploits are found, you may want to consider removing
the ability for non-privileged players to edit books. This patch allows
you to easily disable books, should you want to preemptively remove this
functionality before additional exploits are found.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
index ed275123642d929b51b93f7f2ea825858411a921..66b80378f8b383e1388cf6b7b0e9ed0f8bc08a63 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
@@ -8,6 +8,8 @@ public final class CraftDefaultPermissions {
public static final String GALE_ROOT = "gale"; // Gale - set Gale permissions root
public static final String LEAF_ROOT = "leaf"; // Leaf - Leaf commands
+ public static final String writeBooks = GALE_ROOT + ".writebooks"; // Gale - Pufferfish - make book writing configurable
+
private CraftDefaultPermissions() {}
public static void registerCorePermissions() {
@@ -18,6 +20,7 @@ public final class CraftDefaultPermissions {
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick", "Gives the user the ability to use the debug stick in creative", org.bukkit.permissions.PermissionDefault.OP, parent);
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".debugstick.always", "Gives the user the ability to use the debug stick in all game modes", org.bukkit.permissions.PermissionDefault.FALSE/* , parent */); // Paper - should not have this parent, as it's not a "vanilla" utility
DefaultPermissions.registerPermission(CraftDefaultPermissions.ROOT + ".commandblock", "Gives the user the ability to use command blocks.", org.bukkit.permissions.PermissionDefault.OP, parent); // Paper
+ DefaultPermissions.registerPermission(writeBooks, "Gives the user the ability to write books even when writing books is disabled in the Gale configuration", org.bukkit.permissions.PermissionDefault.OP); // Gale - Pufferfish - make book writing configurable
parent.recalculatePermissibles();
}
}