mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-19 14:59:29 +00:00
40 lines
2.2 KiB
Diff
40 lines
2.2 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/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index d248671b2e1c6256fc4d74320bdb29ca078bad0b..089a903607c0d16dc2744981a6dcb23115df010d 100644
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1161,6 +1161,11 @@ public class ServerGamePacketListenerImpl
|
|
|
|
@Override
|
|
public void handleEditBook(ServerboundEditBookPacket packet) {
|
|
+ // Gale start - Pufferfish - make book writing configurable
|
|
+ if (!(org.galemc.gale.configuration.GaleGlobalConfiguration.get().gameplayMechanics.enableBookWriting || this.player.getBukkitEntity().hasPermission(org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions.writeBooks) || this.player.getBukkitEntity().hasPermission("pufferfish.usebooks"))) {
|
|
+ return;
|
|
+ }
|
|
+ // Gale end - Pufferfish - make book writing configurable
|
|
// Paper start - Book size limits
|
|
final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax;
|
|
if (!this.cserver.isPrimaryThread() && pageMax.enabled()) {
|