Prevent server from overwriting pufferfish.yml
This commit is contained in:
1 parent
6886272913
commit
1ee6385a22
3 files changed
+79
-6
No files matched your search
@@ -15,14 +15,19 @@
|
||||
[](https://github.com/PurpurMC/Purpur/network/members)
|
||||
[](https://github.com/PurpurMC/Purpur/watchers)
|
||||
|
||||
true-og/Purpur is a fork of Purpur for 1.19.4 by [TrueOG Network](https://trueog.net) with small QoL patches for our server.
|
||||
|
||||
Purpur is a drop-in replacement for [Paper](https://github.com/PaperMC/Paper) servers designed for configurability, new fun and exciting gameplay features, and performance built on top of [Paper](https://github.com/PaperMC/Paper/).
|
||||
|
||||
</div>
|
||||
|
||||
## Contact
|
||||
Join us on Discord:
|
||||
## Changes over mainline Purpur
|
||||
|
||||
[](https://purpurmc.org/discord)
|
||||
- Prevent pufferfish.yml from being overwritten by the server.
|
||||
|
||||
Soon:
|
||||
|
||||
- Keep chunks loaded while a villager is being cured.
|
||||
|
||||
## Downloads
|
||||
Downloads can be obtained from the [downloads page](https://purpurmc.org/downloads/) or the [downloads API](https://api.purpurmc.org).
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add mending multiplier
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index df8d8f85f8db396b7db9fa6e46aa55c934105394..9a1dbb058a468c267606df336027806884fee645 100644
|
||||
index 186d6b06194eb2120c9cec6218c87e8cf2f11f65..b3b371ee4850c90a3142c3c96761b032e6de6af0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -346,13 +346,15 @@ public class ExperienceOrb extends Entity {
|
||||
@@ -352,13 +352,15 @@ public class ExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ index df8d8f85f8db396b7db9fa6e46aa55c934105394..9a1dbb058a468c267606df3360278068
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 157c5ce26015cabd5a007cf7444c8255db1a0b0f..31622937846c14dab4177a1f08c15985957c98bb 100644
|
||||
index 0db8a1a51c857a3930d0b20028964fb355d8e5b4..397c4afa8da85845f49974832674a6e45ee6edb7 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -121,6 +121,7 @@ public class PurpurWorldConfig {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NotAlexNoyle <alexnoyle@icloud.com>
|
||||
Date: Wed, 19 Nov 2025 12:35:55 -0500
|
||||
Subject: [PATCH] Prevent server from overwriting existing pufferfish.yml
|
||||
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
index b4e5fbace85c67e7bd347e6a90514bbc2c132d5e..99befcb612e48eddaebb4f0814f9f88bcbf9d761 100644
|
||||
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
@@ -52,7 +52,12 @@ public class PufferfishConfig {
|
||||
|
||||
public static void load() throws IOException {
|
||||
File configFile = pufferfishFile; // Purpur
|
||||
-
|
||||
+
|
||||
+ boolean newlyCreated = false;
|
||||
+ if (!configFile.exists()) {
|
||||
+ newlyCreated = true;
|
||||
+ }
|
||||
+
|
||||
if (configFile.exists()) {
|
||||
try {
|
||||
config.load(configFile);
|
||||
@@ -60,14 +65,14 @@ public class PufferfishConfig {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
getString("info.version", "1.0");
|
||||
setComment("info",
|
||||
"Pufferfish Configuration",
|
||||
"Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host",
|
||||
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
|
||||
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
|
||||
-
|
||||
+
|
||||
for (Method method : PufferfishConfig.class.getDeclaredMethods()) {
|
||||
if (Modifier.isStatic(method.getModifiers()) && Modifier.isPrivate(method.getModifiers()) && method.getParameterCount() == 0 &&
|
||||
method.getReturnType() == Void.TYPE && !method.getName().startsWith("lambda")) {
|
||||
@@ -79,19 +84,20 @@ public class PufferfishConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+
|
||||
updates++;
|
||||
-
|
||||
- config.save(configFile);
|
||||
-
|
||||
- // Attempt to detect vectorization
|
||||
+
|
||||
+ if (newlyCreated) {
|
||||
+ config.save(configFile);
|
||||
+ }
|
||||
+
|
||||
try {
|
||||
SIMDDetection.isEnabled = SIMDDetection.canEnable(PufferfishLogger.LOGGER);
|
||||
SIMDDetection.versionLimited = SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19;
|
||||
} catch (NoClassDefFoundError | Exception ignored) {
|
||||
ignored.printStackTrace();
|
||||
}
|
||||
-
|
||||
+
|
||||
if (SIMDDetection.isEnabled) {
|
||||
PufferfishLogger.LOGGER.info("SIMD operations detected as functional. Will replace some operations with faster versions.");
|
||||
} else if (SIMDDetection.versionLimited) {
|
||||
Reference in new issue
Block a user