9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0001-Rebrand.patch
NONPLAYT 7fc5a85908 Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@49f28912 Updated Upstream (Paper)
2025-10-14 01:27:58 +03:00

178 lines
12 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 11 Jan 2025 22:22:01 +0300
Subject: [PATCH] Rebrand
diff --git a/net/minecraft/CrashReport.java b/net/minecraft/CrashReport.java
index 394443d00e661715439be1e56dddc129947699a4..480ad57a6b7b74e6b83e9c6ceb69ea1feacca106 100644
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -30,7 +30,7 @@ public class CrashReport {
private boolean trackingStackTrace = true;
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
private final SystemReport systemReport = new SystemReport();
- private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
+ private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO DIVINEMC INSTEAD!", ""); // DivineMC - Rebrand
public CrashReport(String title, Throwable exception) {
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper
diff --git a/net/minecraft/network/protocol/common/custom/BrandPayload.java b/net/minecraft/network/protocol/common/custom/BrandPayload.java
index 97844ec1ccc986eb3d3a185d78a03ceeca49fc1a..5e40ec3fbe6e6d5f98ad98df7d4c27d6de615778 100644
--- a/net/minecraft/network/protocol/common/custom/BrandPayload.java
+++ b/net/minecraft/network/protocol/common/custom/BrandPayload.java
@@ -12,7 +12,7 @@ public record BrandPayload(String brand) implements CustomPacketPayload {
}
private void write(FriendlyByteBuf buffer) {
- buffer.writeUtf(this.brand);
+ buffer.writeUtf(org.purpurmc.purpur.PurpurConfig.f3Name + "§r"); // DivineMC - Update Purpur rebrand settings
}
@Override
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
index 2c85607bcc62b227485972707c3541247a626524..9e25b6412fadbbecda0430f8554eaa48dbe8c151 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -67,36 +67,29 @@ public class Main {
)
@DontObfuscate
public static void main(final OptionSet optionSet) { // CraftBukkit - replaces main(String[] args)
+ // DivineMC start - Rebrand
+ io.papermc.paper.ServerBuildInfo info = io.papermc.paper.ServerBuildInfo.buildInfo();
+ if (io.papermc.paper.ServerBuildInfoImpl.IS_EXPERIMENTAL) {
+ LOGGER.warn("Running an experimental version of {}, please proceed with caution.", info.brandName());
+ }
+
+ Path path2 = Paths.get("eula.txt");
+ Eula eula = new Eula(path2);
+ boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree");
+ if (eulaAgreed) {
+ LOGGER.error("You have used the Spigot command line EULA agreement flag.");
+ LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA).");
+ LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
+ }
+ if (!eula.hasAgreedToEULA() && !eulaAgreed) {
+ LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
+ return;
+ }
+ // DivineMC end - Rebrand
io.papermc.paper.util.LogManagerShutdownThread.hook(); // Paper - Improved watchdog support
SharedConstants.tryDetectVersion();
- /* CraftBukkit start - Replace everything
- OptionParser optionParser = new OptionParser();
- OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
- OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
- OptionSpec<Void> optionSpec2 = optionParser.accepts("demo");
- OptionSpec<Void> optionSpec3 = optionParser.accepts("bonusChest");
- OptionSpec<Void> optionSpec4 = optionParser.accepts("forceUpgrade");
- OptionSpec<Void> optionSpec5 = optionParser.accepts("eraseCache");
- OptionSpec<Void> optionSpec6 = optionParser.accepts("recreateRegionFiles");
- OptionSpec<Void> optionSpec7 = optionParser.accepts("safeMode", "Loads level with vanilla datapack only");
- OptionSpec<Void> optionSpec8 = optionParser.accepts("help").forHelp();
- OptionSpec<String> optionSpec9 = optionParser.accepts("universe").withRequiredArg().defaultsTo(".");
- OptionSpec<String> optionSpec10 = optionParser.accepts("world").withRequiredArg();
- OptionSpec<Integer> optionSpec11 = optionParser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1);
- OptionSpec<String> optionSpec12 = optionParser.accepts("serverId").withRequiredArg();
- OptionSpec<Void> optionSpec13 = optionParser.accepts("jfrProfile");
- OptionSpec<Path> optionSpec14 = optionParser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter());
- OptionSpec<String> optionSpec15 = optionParser.nonOptions();
try {
- OptionSet optionSet = optionParser.parse(args);
- if (optionSet.has(optionSpec8)) {
- optionParser.printHelpOn(System.err);
- return;
- }
- */ // CraftBukkit end
- try {
-
Path path = (Path) optionSet.valueOf("pidFile"); // CraftBukkit
if (path != null) {
writePidFile(path);
@@ -122,8 +115,6 @@ public class Main {
DedicatedServerSettings dedicatedServerSettings = new DedicatedServerSettings(optionSet); // CraftBukkit - CLI argument support
dedicatedServerSettings.forceSave();
RegionFileVersion.configure(dedicatedServerSettings.getProperties().regionFileComression);
- Path path2 = Paths.get("eula.txt");
- Eula eula = new Eula(path2);
// Paper start - load config files early for access below if needed
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("bukkit-settings"));
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("spigot-settings"));
@@ -146,19 +137,6 @@ public class Main {
return;
}
- // Spigot start
- boolean eulaAgreed = Boolean.getBoolean("com.mojang.eula.agree");
- if (eulaAgreed) {
- LOGGER.error("You have used the Spigot command line EULA agreement flag.");
- LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA).");
- LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
- }
- if (!eula.hasAgreedToEULA() && !eulaAgreed) {
- // Spigot end
- LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
- return;
- }
-
// Paper start - Detect headless JRE
String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck();
if (awtException != null) {
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 10769fe7a3d99f0464b9d265b9d0b8c9fc25ae5d..31edaf3b34d77656ceb010beb2e33307d84fb117 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1263,6 +1263,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
+ org.bxteam.divinemc.spark.ThreadDumperRegistry.REGISTRY.add(Thread.currentThread().getName()); // DivineMC
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
diff --git a/net/minecraft/server/gui/MinecraftServerGui.java b/net/minecraft/server/gui/MinecraftServerGui.java
index 614c7d9f673c926562acc8fa3b3788623900db41..937469a134e721c47e235a34acc565f12adf85ff 100644
--- a/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
@@ -51,7 +51,7 @@ public class MinecraftServerGui extends JComponent {
} catch (Exception var3) {
}
- final JFrame jFrame = new JFrame("Purpur Minecraft server"); // Purpur - Improve GUI
+ final JFrame jFrame = new JFrame(org.purpurmc.purpur.PurpurConfig.serverGUIName); // Purpur - Improve GUI // DivineMC - Update Purpur rebrand settings
final MinecraftServerGui minecraftServerGui = new MinecraftServerGui(server);
jFrame.setDefaultCloseOperation(2);
jFrame.add(minecraftServerGui);
@@ -59,7 +59,7 @@ public class MinecraftServerGui extends JComponent {
jFrame.setLocationRelativeTo(null);
jFrame.setVisible(true);
// Paper start - Improve ServerGUI
- jFrame.setName("Purpur Minecraft server"); // Purpur - Improve GUI
+ jFrame.setName(org.purpurmc.purpur.PurpurConfig.serverGUIName); // Purpur - Improve GUI // DivineMC - Update Purpur rebrand settings
try {
jFrame.setIconImage(javax.imageio.ImageIO.read(java.util.Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
} catch (java.io.IOException ignore) {
@@ -69,7 +69,7 @@ public class MinecraftServerGui extends JComponent {
@Override
public void windowClosing(WindowEvent event) {
if (!minecraftServerGui.isClosing.getAndSet(true)) {
- jFrame.setTitle("Purpur Minecraft server - shutting down!"); // Purpur - Improve GUI
+ jFrame.setTitle(org.purpurmc.purpur.PurpurConfig.serverGUIName + " - shutting down!"); // Purpur - Improve GUI // DivineMC - Update Purpur rebrand settings
server.halt(true);
minecraftServerGui.runFinalizers();
}
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 0e6222214f4b5407705dcbdf4dcf574111bcf366..8215edb0dbb5a9de66d5107786c338d2fd02d5ea 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -309,7 +309,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {