9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-23 16:59:23 +00:00
Files
Gale/patches/server/0054-Do-not-log-run-as-root-warning.patch

31 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Thu, 1 Dec 2022 16:43:50 +0100
Subject: [PATCH] Do not log run as root warning
License: MIT (https://opensource.org/licenses/MIT)
This patch is based on the following patch:
"Options of warnings"
By: nostalgic853 <yuu8583@proton.me>
As part of: KeYi (https://github.com/KeYiMC/KeYi)
Licensed under: MIT (https://opensource.org/licenses/MIT)
* KeYi description *
Let users decide if we should warn while running in a root user
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 007fe6820e208c04e81acbd7bb7eaf0a22f6f64f..8c7adc9edf941d5cc9aa2e427267eb035d4627d6 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -184,7 +184,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
// Paper start - detect running as root
- if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
+ if (!"false".equalsIgnoreCase(System.getProperty("gale.log.warning.root")) && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) { // Gale - KeYi - do not log run as root warning
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.");