9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-06 15:41:52 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0001-Rebrand.patch
2025-07-17 18:36:16 +03:00

144 lines
9.2 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/server/Main.java b/net/minecraft/server/Main.java
index b06c2c4aa77edafb374f7cf0406cf4d29c6e7f9f..a058ef4d74da29372a894c8a4d619b2d5ba0c74f 100644
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -64,11 +64,34 @@ import org.slf4j.Logger;
public class Main {
private static final Logger LOGGER = LogUtils.getLogger();
+ public static void main(String[] arguments) {
+ OptionSet optionSet = org.bxteam.divinemc.DivineBootstrap.bootstrap(arguments);
+
+ 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());
+ }
+
+ main(optionSet);
+ }
+
@SuppressForbidden(
reason = "System.out needed before bootstrap"
)
@DontObfuscate
public static void main(final OptionSet optionSet) { // CraftBukkit - replaces main(String[] args)
+ 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;
+ }
io.papermc.paper.util.LogManagerShutdownThread.hook(); // Paper - Improved watchdog support
SharedConstants.tryDetectVersion();
/* CraftBukkit start - Replace everything
@@ -124,8 +147,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"));
@@ -148,19 +169,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 d651ddade8a460c25f4f8d70822d9ef69f1acb4b..8fce263f8cab4e0ff2ee6fe4fd9e46bbd0bbde19 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1177,6 +1177,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 77db68349aa73d33b86a867099c9395c96d5a02d..8d1174f25e0e90d0533970f4ddd8448442024936 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -308,7 +308,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 {