Files
MiraiMC/patches/server/0014-Patina-Completely-remove-snooper.patch
2021-09-19 00:07:35 +02:00

175 lines
8.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Sat, 18 Sep 2021 23:57:30 +0200
Subject: [PATCH] (Patina) Completely remove snooper
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cc4b83b8d8f532fd1015a9259b67de6e34f242d7..38dd502cd8b0e366933e5d886d367cb7458255ef 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -189,14 +189,14 @@ import org.bukkit.event.server.ServerLoadEvent;
import co.aikar.timings.MinecraftTimings; // Paper
import org.spigotmc.SlackActivityAccountant; // Spigot
-public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable {
+public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable { // SnooperPopulator, // Patina - completely remove snooper
private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogManager.getLogger();
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
private static final int TICK_STATS_SPAN = 100;
public static final int MS_PER_TICK = 50;
- private static final int SNOOPER_UPDATE_INTERVAL = 6000;
+ //private static final int SNOOPER_UPDATE_INTERVAL = 6000; // Patina - completely remove snooper
private static final int OVERLOADED_THRESHOLD = 2000;
private static final int OVERLOADED_WARNING_INTERVAL = 15000;
public static final String LEVEL_STORAGE_PROTOCOL = "level";
@@ -214,7 +214,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final long DELAYED_TASKS_TICK_EXTENSION = 50L;
public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage;
- private final Snooper snooper = new Snooper("server", this, Util.getMillis());
+ //private final Snooper snooper = new Snooper("server", this, Util.getMillis()); // Patina - completely remove snooper
private final List<Runnable> tickables = Lists.newArrayList();
private MetricsRecorder metricsRecorder;
private ProfilerFiller profiler;
@@ -1082,9 +1082,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
- if (this.snooper.isStarted()) {
+ /* // Patina - completely remove snooper
+ if (this.snooper.isStarted()) {
this.snooper.interrupt();
}
+ */
this.resources.close();
@@ -1513,7 +1515,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// MinecraftServer.LOGGER.debug("Autosave finished"); // Paper
//} // Paper
- this.profiler.push("snooper");
+ /* // Patina - completely remove snooper
+ this.profiler.push("snooper");
if (((DedicatedServer) this).getProperties().snooperEnabled && !this.snooper.isStarted() && this.tickCount > 100) { // Spigot
this.snooper.start();
}
@@ -1521,6 +1524,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (((DedicatedServer) this).getProperties().snooperEnabled && this.tickCount % 6000 == 0) { // Spigot
this.snooper.prepare();
}
+ */
io.papermc.paper.util.CachedLists.reset(); // Paper
this.profiler.pop();
@@ -1870,7 +1874,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.resourcePackHash = hash;
}
- @Override
+ /* // Patina - completely remove snooper
+ @Override
public void populateSnooper(Snooper snooper) {
snooper.setDynamicData("whitelist_enabled", (Object) false);
snooper.setDynamicData("whitelist_count", (int) 0);
@@ -1903,19 +1908,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
snooper.setDynamicData("worlds", (Object) i);
}
+ */
- @Override
+ /* // Patina - completely remove snooper
+ @Override
public void populateSnooperInitial(Snooper snooper) {
snooper.setFixedData("singleplayer", this.isSingleplayer());
snooper.setFixedData("server_brand", this.getServerModName());
snooper.setFixedData("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
snooper.setFixedData("dedicated", this.isDedicatedServer());
}
+ */
- @Override
+ /* // Patina - completely remove snooper
+ @Override
public boolean isSnooperEnabled() {
return true;
}
+ */
public abstract boolean isDedicatedServer();
@@ -2012,9 +2022,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.tickCount;
}
- public Snooper getSnooper() {
+ /* // Patina - completely remove snooper
+ public Snooper getSnooper() {
return this.snooper;
}
+ */
public int getSpawnProtectionRadius() {
return 16;
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 6081d9063bb1f10a601020d58a1ccb2f16b3c212..d88878bc094fa0fb2f7e9bfe288c250d14e228c7 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -494,17 +494,21 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return this.getProperties().allowNether;
}
- @Override
+ /* // Patina - completely remove snooper
+ @Override
public void populateSnooper(Snooper snooper) {
snooper.setDynamicData("whitelist_enabled", (Object) this.getPlayerList().isUsingWhitelist());
snooper.setDynamicData("whitelist_count", (Object) this.getPlayerList().getWhiteListNames().length);
super.populateSnooper(snooper);
}
+ */
- @Override
+ /* // Patina - completely remove snooper
+ @Override
public boolean isSnooperEnabled() {
return this.getProperties().snooperEnabled;
}
+ */
public void handleConsoleInput(String command, CommandSourceStack commandSource) {
this.serverCommandQueue.add(new ConsoleInput(command, commandSource));
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 0544ac93513d3a274bfb53bb6120bd598f4d603b..ee8046676a6dbcd9cf0a1ed66f65187c6616cef8 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -43,7 +43,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
public final boolean hardcore;
public final boolean allowNether;
public final boolean spawnMonsters;
- public final boolean snooperEnabled;
+ //public final boolean snooperEnabled; // Patina - completely remove snooper
public final boolean useNativeTransport;
public final boolean enableCommandBlock;
public final int spawnProtection;
@@ -88,11 +88,13 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.hardcore = this.get("hardcore", false);
this.allowNether = this.get("allow-nether", true);
this.spawnMonsters = this.get("spawn-monsters", true);
- if (this.get("snooper-enabled", true)) {
+ /* // Patina - completely remove snooper
+ if (this.get("snooper-enabled", true)) {
;
}
+ */
- this.snooperEnabled = false;
+ //this.snooperEnabled = false; // Patina - completely remove snooper
this.useNativeTransport = this.get("use-native-transport", true);
this.enableCommandBlock = this.get("enable-command-block", false);
this.spawnProtection = this.get("spawn-protection", 16);