9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-22 16:29:26 +00:00
Files
Gale/patches/server/0006-Recommend-disabling-timings-on-startup.patch
MartijnMuijsers 7d0e076fe3 Gale commands
2022-11-26 10:48:59 +01:00

78 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Wed, 23 Nov 2022 16:02:19 +0100
Subject: [PATCH] Recommend disabling timings on startup
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
This patch is based on the following patch:
"Disable Paper timings by default"
By: Paul Sauve <paul@technove.co>
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
* Airplane copyright *
Airplane
Copyright (C) 2020 Technove LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7..068ff7593dcf0ca1cd2b01a112dd15a7a43d9613 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -7,6 +7,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket;
+import org.bukkit.Bukkit;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
@@ -16,6 +17,7 @@ import org.spongepowered.configurate.objectmapping.meta.Setting;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.logging.Level;
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
public class GlobalConfiguration extends ConfigurationPart {
@@ -50,7 +52,10 @@ public class GlobalConfiguration extends ConfigurationPart {
public Timings timings;
public class Timings extends ConfigurationPart.Post {
- public boolean enabled = true;
+ // Gale start - recommend disabling timings on startup
+ public boolean enabled = false; // Gale - set default value to false
+ public boolean warnIfEnabled = true;
+ // Gale end - recommend disabling timings on startup
public boolean verbose = true;
public String url = "https://timings.aikar.co/";
public boolean serverNamePrivacy = false;
@@ -64,6 +69,13 @@ public class GlobalConfiguration extends ConfigurationPart {
@Override
public void postProcess() {
+ // Gale start - recommend disabling timings on startup
+ if (enabled && warnIfEnabled) {
+ net.minecraft.server.MinecraftServer.LOGGER.warn("To improve performance, we recommend setting timings.enabled to false in paper-global.yml");
+ net.minecraft.server.MinecraftServer.LOGGER.warn("(If you do this, timings will not start on server startup, but you can still start timings later by using /timings on)");
+ net.minecraft.server.MinecraftServer.LOGGER.warn("If you would like to disable this message, set timings.warn-if-enabled to false in paper-global.yml.");
+ }
+ // Gale end - recommend disabling timings on startup
MinecraftTimings.processConfig(this);
}
}