9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-21 15:59:28 +00:00

Do not log run as root or offline mode warnings

This commit is contained in:
MartijnMuijsers
2022-12-01 17:06:28 +01:00
parent f347008ac5
commit fd5551f54c
66 changed files with 100 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
<div align="center">
<h1>Gale</h1>
<h3>A Minecraft server fork of <a href="https://github.com/PaperMC/Paper">Paper</a></h3>
<h4><b>Master</b> branch: no known issues! ✅</h4>
<h5><b>Master</b> branch: no known issues! ✅</h5>
[![Discord](https://img.shields.io/discord/1045402468416233592?color=5865F2&label=discord&style=for-the-badge)](https://discord.com/invite/pbsPkpUjG4)
</div>
@@ -27,7 +27,7 @@ In order to distribute and use this server software, you need a Paperclip file:
This fork would not exist without the years-long work of all the contributors to the [Paper](https://github.com/PaperMC/Paper) and [Spigot](https://www.spigotmc.org/) projects,
including the dedication of their community to stability and trust among all users.
Over the years, many forks of Paper have appeared, including some that contain changes that are too minor to be worth inclusion and maintaining by the Paper project.
We gratefully include various tested and carefully individually reviewed changes from Paper forks, including [Airplane](https://github.com/TECHNOVE/Airplane), [Mirai](https://github.com/etil2jz/Mirai), [Purpur](https://github.com/PurpurMC/Purpur), [JettPack](https://gitlab.com/Titaniumtown/JettPack), [Patina](https://github.com/PatinaMC/Patina), [EmpireCraft](https://github.com/starlis/empirecraft) and [Slice](https://github.com/Cryptite/Slice), and from various Fabric mods, including [Lithium](https://github.com/CaffeineMC/lithium-fabric), [VMP](https://github.com/RelativityMC/VMP-fabric) and [C2ME](https://github.com/RelativityMC/C2ME-fabric).
We gratefully include various tested and carefully individually reviewed changes from Paper forks, including [Airplane](https://github.com/TECHNOVE/Airplane), [Mirai](https://github.com/etil2jz/Mirai), [Purpur](https://github.com/PurpurMC/Purpur), [JettPack](https://gitlab.com/Titaniumtown/JettPack), [Patina](https://github.com/PatinaMC/Patina), [KeYi](https://github.com/KeYiMC/KeYi), [EmpireCraft](https://github.com/starlis/empirecraft) and [Slice](https://github.com/Cryptite/Slice), and from various Fabric mods, including [Lithium](https://github.com/CaffeineMC/lithium-fabric), [VMP](https://github.com/RelativityMC/VMP-fabric) and [C2ME](https://github.com/RelativityMC/C2ME-fabric).
We would also like to thank our friends at [MultiPaper](https://github.com/MultiPaper/MultiPaper) and MCMT ([Fabric](https://github.com/himekifee/MCMTFabric), [Forge](https://github.com/jediminer543/JMT-MCMT)) for their shared knowledge and hard work towards a common goal.
## License

View File

@@ -0,0 +1,42 @@
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..95a33f2e9c91831f1fdf903558a088594dcf41c4 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 (GaleGlobalConfiguration.get().logToConsole.runningAsRootOrAdminWarning && 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.");
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index ce8c7032dff4e119d018d42fa579f9231cf41961..f4e20ea5f59e0709cf2dd485a0e5798822e5301d 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -61,6 +61,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public boolean setBlockInFarChunk = true; // Gale - Purpur - do not log setBlock in far chunks
public boolean unrecognizedRecipes = false; // Gale - Purpur - do not log unrecognized recipes
public boolean legacyMaterialInitialization = false; // Gale - Purpur - do not log legacy Material initialization
+ public boolean runningAsRootOrAdminWarning = true; // Gale - KeYi - do not log run as root warning
public Chat chat;
public class Chat extends ConfigurationPart {

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Thu, 1 Dec 2022 16:52:27 +0100
Subject: [PATCH] Do not log offline mode 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 offline mode
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 95a33f2e9c91831f1fdf903558a088594dcf41c4..61ab44d572b3ef4b6837aafa7e184de7bc0a7327 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -298,7 +298,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
// CraftBukkit end
- if (!this.usesAuthentication()) {
+ if (GaleGlobalConfiguration.get().logToConsole.offlineModeWarning && !this.usesAuthentication()) { // Gale - KeYi - do not log offline mode warning
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
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index f4e20ea5f59e0709cf2dd485a0e5798822e5301d..cf4a354fd3a68f8a0639ed98c7c2e842c6459389 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -62,6 +62,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public boolean unrecognizedRecipes = false; // Gale - Purpur - do not log unrecognized recipes
public boolean legacyMaterialInitialization = false; // Gale - Purpur - do not log legacy Material initialization
public boolean runningAsRootOrAdminWarning = true; // Gale - KeYi - do not log run as root warning
+ public boolean offlineModeWarning = true; // Gale - KeYi - do not log offline mode warning
public Chat chat;
public class Chat extends ConfigurationPart {

View File

@@ -38,7 +38,7 @@ index d2b4654a9095a678bbc9e004af969cf54da0fcab..d797bac97ec1adec7a25a26c8e052e70
});
this.rotation = Rotation.valueOf(nbt.getString("rotation"));
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index ce8c7032dff4e119d018d42fa579f9231cf41961..24ed4fb7ddacba24873755edfa88912ffdf81cc8 100644
index cf4a354fd3a68f8a0639ed98c7c2e842c6459389..bc44c8537ea69a7682584db57ec566ecb4e76b3b 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -4,8 +4,12 @@ package org.galemc.gale.configuration;
@@ -63,7 +63,7 @@ index ce8c7032dff4e119d018d42fa579f9231cf41961..24ed4fb7ddacba24873755edfa88912f
public boolean invalidStatistics = true; // Gale - EMC - do not log invalid statistics
public boolean ignoredAdvancements = true; // Gale - Purpur - do not log ignored advancements
@@ -69,6 +73,21 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
@@ -71,6 +75,21 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public boolean notSecureMarker = true; // Gale - do not log Not Secure marker
}

View File

@@ -106,7 +106,7 @@ index b4d0b7ecd56ab952319946854168c1299cb0b1be..beea5c17f07f85825ed1ba5a016f6edc
+
}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 24ed4fb7ddacba24873755edfa88912ffdf81cc8..0965f43068d12a85090906568e2c1b731730f015 100644
index bc44c8537ea69a7682584db57ec566ecb4e76b3b..0217977e15ae30918ce6e1dbddb5bdb5d4365c1c 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -60,6 +60,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {

View File

@@ -84,10 +84,10 @@ index 9de597c11c3bd0f23e87c3a6187b2036987356e0..c171c272d5fcf0900514e18eafaa1b5e
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 0965f43068d12a85090906568e2c1b731730f015..024cf924592999726458976b4d73df4b71843a2e 100644
index 0217977e15ae30918ce6e1dbddb5bdb5d4365c1c..5c0eaad8dd65917802dcd714f1af77bbd91d1651 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -91,4 +91,16 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
@@ -93,4 +93,16 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
}

View File

@@ -12,10 +12,10 @@ As part of: YAPFA (https://github.com/tr7zw/YAPFA)
Licensed under: MIT (https://opensource.org/licenses/MIT)
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 024cf924592999726458976b4d73df4b71843a2e..eb1a5b20810cbad9f47505a8534a42b20b8653d5 100644
index 5c0eaad8dd65917802dcd714f1af77bbd91d1651..e92a4fc4a503a420b09e5373a6c1f5d2d71d32d6 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -101,6 +101,14 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
@@ -103,6 +103,14 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
}

View File

@@ -64,7 +64,7 @@ index 8818ca46af000926ed9eacb47953f440bdac1342..2bf1663dc1e969ea9e192c9941155eb9
int i = 29999999;
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index eb1a5b20810cbad9f47505a8534a42b20b8653d5..44c69a6104f19d799510e349448b8a15805c38c0 100644
index e92a4fc4a503a420b09e5373a6c1f5d2d71d32d6..1a8e57b9891a8f54da6024284ba0ed0cb4562a23 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -43,6 +43,25 @@ public class GaleGlobalConfiguration extends ConfigurationPart {

View File

@@ -864,7 +864,7 @@ index 0000000000000000000000000000000000000000..4b82aea23b99180f13c71a1797c4d829
+
+}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 44c69a6104f19d799510e349448b8a15805c38c0..02e9a61635078af3d31a112984f4c20dddc8ac7b 100644
index 1a8e57b9891a8f54da6024284ba0ed0cb4562a23..9bf34c19b41058108af5bc7be4f8d9fa89f3d8bd 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -2,11 +2,14 @@

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] CPU cores estimation
License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html)
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 007fe6820e208c04e81acbd7bb7eaf0a22f6f64f..b48eddfa0cdd2c03f6dce974c71d72dd9935448c 100644
index 61ab44d572b3ef4b6837aafa7e184de7bc0a7327..62fba9eb2d4a8a0e6e77f463ee67add446099a5a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -54,6 +54,7 @@ import net.minecraft.world.level.block.entity.SkullBlockEntity;
@@ -44,13 +44,13 @@ index 947ad1463a973546bdaf68654086291a3414aa9b..69bde99acff7bdae9af7cfe60e222167
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.MarkedYAMLException;
diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
index 02e9a61635078af3d31a112984f4c20dddc8ac7b..ea85ba6b26a71479571f994b09808b210275fc02 100644
index 9bf34c19b41058108af5bc7be4f8d9fa89f3d8bd..871f8866982b4b1dd1990e522dc9c9447df7652f 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java
@@ -305,6 +305,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public boolean setBlockInFarChunk = true; // Gale - Purpur - do not log setBlock in far chunks
public boolean unrecognizedRecipes = false; // Gale - Purpur - do not log unrecognized recipes
@@ -307,6 +307,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
public boolean legacyMaterialInitialization = false; // Gale - Purpur - do not log legacy Material initialization
public boolean runningAsRootOrAdminWarning = true; // Gale - KeYi - do not log run as root warning
public boolean offlineModeWarning = true; // Gale - KeYi - do not log offline mode warning
+ public boolean cpuCoresEstimation = true; // Gale - CPU core estimation
public Chat chat;