Files
Purpur/patches/server/0097-Add-option-to-disable-saving-projectiles-to-disk.patch
William Blake Galbreath 3f74442c8b Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
e1281a14 Configurable chance of villager zombie infection (Closes #2501)
2020-03-11 20:28:32 -05:00

60 lines
3.6 KiB
Diff

From b38ffc0b8dc85e24a1eff3eb11b3165cbd6d2ddf Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 18 Feb 2020 20:07:08 -0600
Subject: [PATCH] Add option to disable saving projectiles to disk
---
.../net/minecraft/server/ChunkRegionLoader.java | 1 +
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index d529b795c5..c6ea18ad75 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -445,6 +445,7 @@ public class ChunkRegionLoader {
while (iterator1.hasNext()) {
Entity entity = (Entity) iterator1.next();
+ if (!worldserver.purpurConfig.saveProjectilesToDisk && entity instanceof EntityProjectile) continue; // Purpur
NBTTagCompound nbttagcompound4 = new NBTTagCompound();
// Paper start
if ((int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 6ae1c0fe02..3a530de7f9 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -173,6 +173,7 @@ public class PurpurWorldConfig {
public boolean playerSleepOnlyWithCondition = false;
public String playerSleepCondition = "time >= 12541 && time <= 23458";
public boolean useBetterMending = false;
+ public boolean saveProjectilesToDisk = true;
private void gameplayMechanicsSettings() {
armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
@@ -201,6 +202,21 @@ public class PurpurWorldConfig {
playerSleepOnlyWithCondition = getBoolean("gameplay-mechanics.player.sleep.only-with-condition", playerSleepOnlyWithCondition);
playerSleepCondition = getString("gameplay-mechanics.player.sleep.condition", playerSleepCondition);
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
+ if (PurpurConfig.version < 4) {
+ Object oldVal = PurpurConfig.config.get("world-settings.default.gameplay-mechanics.saveProjectilesToDisk");
+ if (oldVal instanceof Boolean) {
+ PurpurConfig.config.addDefault("world-settings.default.gameplay-mechanics.save-projectiles-to-disk", oldVal);
+ PurpurConfig.config.set("world-settings.default.gameplay-mechanics.save-projectiles-to-disk", oldVal);
+ saveProjectilesToDisk = (boolean) oldVal;
+ }
+ oldVal = PurpurConfig.config.get("world-settings." + worldName + ".gameplay-mechanics.saveProjectilesToDisk");
+ if (oldVal instanceof Boolean) {
+ PurpurConfig.config.set("world-settings." + worldName + ".gameplay-mechanics.save-projectiles-to-disk", oldVal);
+ saveProjectilesToDisk = (boolean) oldVal;
+ }
+ set("gameplay-mechanics.saveProjectilesToDisk", null);
+ }
+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
}
public int elytraDamagePerSecond = 1;
--
2.24.0