Files
PlazmaBukkitMC/patches/server/0009-Console-logging-tweaks.patch
github-actions[bot] 617172ab6c Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PlazmaMC/Purpur@133a1cb let's begin
PlazmaMC/Purpur@81b8d32 update API
PlazmaMC/Purpur@60f73e4 first 50 patches done
PlazmaMC/Purpur@6230542 at 100 patches now
PlazmaMC/Purpur@87e5f45 200 patches
PlazmaMC/Purpur@e74f718 the rest of the patches
PlazmaMC/Purpur@e148391 it compiles! \o/
PlazmaMC/Purpur@cdea790 Updated Upstream (Paper)
PlazmaMC/Purpur@8a46226 please the scanJarForBadCalls task
PlazmaMC/Purpur@01e013b Updated Upstream (Paper)
PlazmaMC/Purpur@cb4586d Updated Upstream (Paper)
PlazmaMC/Purpur@e068628 Updated Upstream (Paper)
PlazmaMC/Purpur@fdadc8d [ci-skip] update foojay resolver convention plugin
PlazmaMC/Purpur@414fe5f work
PlazmaMC/Purpur@2379df3 250/305 patches done
PlazmaMC/Purpur@c90aa13 All done
PlazmaMC/Purpur@ec8f7d0 Fix build
PlazmaMC/Purpur@db6f54b rebuild patches
2023-09-27 09:47:49 +00:00

76 lines
4.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 27 Sep 2023 16:55:12 +0900
Subject: [PATCH] Console logging tweaks
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a970e00482952318c258fc406cb7c39a229b65bc..879c090d9c4574a2cd45a0eb1bf9cb171834d940 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -180,16 +180,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
- // Paper start - detect running as root
- if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
- DedicatedServer.LOGGER.warn("****************************");
- DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
- DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
- DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
- DedicatedServer.LOGGER.warn("****************************");
- }
- // Paper end
-
DedicatedServer.LOGGER.info("Loading properties");
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
@@ -318,6 +308,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
// Paper end
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.offlineWarnings) // Plazma - Console logging tweaks
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -331,9 +322,21 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
}
// Spigot end
- DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file or set \"console-logs.offline-warning\" to \"false\" in the config/plazma-global.yml file."); // Plazma
}
+ // Plazma start - Console logging tweaks
+ // Moved down
+ // Paper start - detect running as root
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.rootUserWarnings && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
+ DedicatedServer.LOGGER.warn("****************************");
+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
+ DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
+ DedicatedServer.LOGGER.warn("****************************");
+ }
+ // Paper end
+ // Plazma end
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 31c98e2c869722ea7e396c245be2d0e8c6bb8feb..ac7089a174365a0e31cfa9eb7bd79148622e1b0c 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -20,4 +20,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@Setting(Configuration.VERSION_FIELD)
public int version = CURRENT_VERSION;
+
+ public ConsoleLogs consoleLogs;
+ public class ConsoleLogs extends ConfigurationPart {
+
+ public boolean offlineWarnings = true;
+ public boolean rootUserWarnings = true;
+
+ }
}