75 lines
4.9 KiB
Diff
75 lines
4.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: AlphaKR93 <alphakr93@gmail.com>
|
|
Date: Fri, 10 Mar 2023 21:45:37 +0900
|
|
Subject: [PATCH] Console log tweaks
|
|
|
|
[Offine Warning Configuration Patch]
|
|
Original by Irochi <me@irochi.moe>
|
|
Licensed under the GPL 3.0
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index b91910eaac0e9c18722e52d223a4420199d77a7f..84bb45aef3c2087cb9c03a99184956c484b3d8e9 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();
|
|
|
|
@@ -321,7 +311,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 (!this.usesAuthentication()) {
|
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.enableOfflineWarnings && !this.usesAuthentication()) { // Plazma
|
|
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
|
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
|
// Spigot start
|
|
@@ -334,9 +324,20 @@ 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 - Moved down
|
|
+ // Paper start - detect running as root
|
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.enableRootUserWarnings && 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 3c70653b720d3d55be199e000e89c627b90e65da..122482e1fae7d6ac8e6b32ebdcf3e611d47901c4 100644
|
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
@@ -24,6 +24,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
public ConsoleLogs consoleLogs;
|
|
public class ConsoleLogs extends ConfigurationPart {
|
|
|
|
+ public boolean enableOfflineWarnings = true;
|
|
+ public boolean enableRootUserWarnings = true;
|
|
|
|
}
|
|
}
|