Remove snooper && TickTask
This commit is contained in:
174
patches/server/0014-Patina-Completely-remove-snooper.patch
Normal file
174
patches/server/0014-Patina-Completely-remove-snooper.patch
Normal file
@@ -0,0 +1,174 @@
|
||||
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);
|
||||
100
patches/server/0015-Patina-Remove-TickTask.patch
Normal file
100
patches/server/0015-Patina-Remove-TickTask.patch
Normal file
@@ -0,0 +1,100 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 19 Sep 2021 00:07:03 +0200
|
||||
Subject: [PATCH] (Patina) Remove TickTask
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 38dd502cd8b0e366933e5d886d367cb7458255ef..0cbbf7ee0ae6a5d4533287c56ed1e711f4ff9c56 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -189,7 +189,7 @@ 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 CommandSource, AutoCloseable { // SnooperPopulator, // Patina - completely remove snooper
|
||||
+public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnable> implements CommandSource, AutoCloseable { // SnooperPopulator, // Patina - completely remove snooper
|
||||
|
||||
private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -1374,19 +1374,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
@Override
|
||||
- public TickTask wrapRunnable(Runnable runnable) {
|
||||
+ public Runnable wrapRunnable(Runnable runnable) { // Patina
|
||||
// Paper start - anything that does try to post to main during watchdog crash, run on watchdog
|
||||
if (this.hasStopped && Thread.currentThread().equals(shutdownThread)) {
|
||||
runnable.run();
|
||||
runnable = () -> {};
|
||||
}
|
||||
// Paper end
|
||||
- return new TickTask(this.tickCount, runnable);
|
||||
+ return runnable; // Patina
|
||||
}
|
||||
|
||||
- protected boolean shouldRun(TickTask ticktask) {
|
||||
+ /* // Patina
|
||||
+ protected boolean shouldRun(TickTask ticktask) {
|
||||
return ticktask.getTick() + 3 < this.tickCount || this.haveTime();
|
||||
}
|
||||
+ */
|
||||
|
||||
@Override
|
||||
public boolean pollTask() {
|
||||
@@ -1417,10 +1419,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
- public void doRunTask(TickTask ticktask) {
|
||||
+ /* // Patina
|
||||
+ public void doRunTask(TickTask ticktask) {
|
||||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
+ */
|
||||
|
||||
private void updateStatusIcon(ServerStatus metadata) {
|
||||
Optional<File> optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 35f27e9a7c82eaec5b4a1a71696dac8485b2cd6d..14cf1956ef31f49684195292bed2d8916231a514 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -1213,10 +1213,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
return runnable;
|
||||
}
|
||||
|
||||
- @Override
|
||||
+ /* // Patina
|
||||
+ @Override
|
||||
protected boolean shouldRun(Runnable task) {
|
||||
return true;
|
||||
}
|
||||
+ */
|
||||
|
||||
@Override
|
||||
protected boolean scheduleExecutables() {
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index dcce05d2f4ab16424db4ab103a12188e207a457b..b289488636dbaf1d97d03cec67f5dcf4f227f4d4 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@@ -29,7 +29,9 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
|
||||
protected abstract R wrapRunnable(Runnable runnable);
|
||||
|
||||
- protected abstract boolean shouldRun(R task);
|
||||
+ /* // Patina
|
||||
+ protected abstract boolean shouldRun(R task);
|
||||
+ */
|
||||
|
||||
public boolean isSameThread() {
|
||||
return Thread.currentThread() == this.getRunningThread();
|
||||
@@ -116,7 +118,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
R runnable = this.pendingRunnables.peek();
|
||||
if (runnable == null) {
|
||||
return false;
|
||||
- } else if (this.blockingCount == 0 && !this.shouldRun(runnable)) {
|
||||
+ } else if (this.blockingCount == 0 && !true/*this.shouldRun(runnable)*/) { // Patina
|
||||
return false;
|
||||
} else {
|
||||
this.doRunTask(this.pendingRunnables.remove());
|
||||
Reference in New Issue
Block a user