Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed bee count payload crash exploit.
Added config option for bee count payload.
  • Loading branch information
dexuby committed Feb 18, 2024
commit b61eee9da45027493a058823c687738b3fce55c4
51 changes: 51 additions & 0 deletions patches/server/0306-Fixed-bee-count-payload-crash-exploit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dexuby <PxLz@web.de>
Date: Sun, 18 Feb 2024 01:16:30 +0100
Subject: [PATCH] Fixed bee count payload crash exploit.


diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index 3fea9b69f4cfc94e7f01d4e3ca4ce7506a8e5d5c..856af119c348e8fed503549aa48dfcb555f63f1f 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -215,7 +215,14 @@ public class PufferfishConfig {
enableAsyncMobSpawning = temp;
}
}
-
+
+ public static boolean enableBeeCountPayload;
+ private static void beeCountLoading() {
+ enableBeeCountPayload = getBoolean("enable-bee-count-payload", true,
+ "Whether or not players should be able to fetch the bee count from beehives",
+ "using custom payload packets.");
+ }
+
public static int maxProjectileLoadsPerTick;
public static int maxProjectileLoadsPerProjectile;
private static void projectileLoading() {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 3a57462e7945fd55e00448f6625d287d97cc93ec..18783e440cf41f4d4eb30fe7fcb6f481bc8d9da4 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -378,7 +378,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish
org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur
- org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur
+ if (gg.pufferfish.pufferfish.PufferfishConfig.enableBeeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur
return true;
}
}
diff --git a/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
index 8a5faed6c1ac6850b87405e774e4393877d61c92..bb46c84007cd4435a0ebd978650156869bfbb2a0 100644
--- a/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
+++ b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
@@ -56,6 +56,7 @@ public class BeehiveTask implements PluginMessageListener {

ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();

+ if (serverPlayer.level().getChunkIfLoaded(pos) == null) return;
BlockEntity blockEntity = serverPlayer.level().getBlockEntity(pos);
if (!(blockEntity instanceof BeehiveBlockEntity beehive)) {
return;