mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: f29c7ebd Improve async login (#3189) 9fd36824 Fix Citizens Player NPC tracking issue - Fixes #3186 0e72de1c Fix Player Tracking issue during join process. f26362af Load Spawn Chunks Asynchronously and Spiral Out 54f762e2 Load Chunks for Login Asynchronously f2d1b6e5 Clean up duplicate PlayerInitialSpawnEvent c2d022d7 Fix Longstanding Broken behavior of PlayerJoinEvent d0a348b9 Broadcast join messages to console 1ef687a4 Don't crash if player is attempted to be removed from untracked chunk. c11668ac Make sure the chunk conversion task is executed immediately 26fb7cc3 Fix Chunk Post Processing deadlock risk
176 lines
7.3 KiB
Diff
176 lines
7.3 KiB
Diff
From 106272c3f804e9edb2956ca90b3858b95ef2824b Mon Sep 17 00:00:00 2001
|
|
From: tr7zw <tr7zw@live.de>
|
|
Date: Thu, 5 Mar 2020 23:08:01 +0100
|
|
Subject: [PATCH] YAPFA - Disable mojang profiler
|
|
|
|
---
|
|
.../net/minecraft/server/CommandDebug.java | 5 ++
|
|
.../net/minecraft/server/MinecraftServer.java | 5 +-
|
|
.../net/pl3x/purpur/GameProfilerNoop.java | 68 +++++++++++++++++++
|
|
.../java/org/bukkit/craftbukkit/Main.java | 2 +
|
|
src/main/resources/purpur.lang | 1 +
|
|
5 files changed, 80 insertions(+), 1 deletion(-)
|
|
create mode 100644 src/main/java/net/pl3x/purpur/GameProfilerNoop.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/CommandDebug.java b/src/main/java/net/minecraft/server/CommandDebug.java
|
|
index f0d72ea39d..e38a684060 100644
|
|
--- a/src/main/java/net/minecraft/server/CommandDebug.java
|
|
+++ b/src/main/java/net/minecraft/server/CommandDebug.java
|
|
@@ -22,6 +22,7 @@ public class CommandDebug {
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
private static final SimpleCommandExceptionType b = new SimpleCommandExceptionType(new ChatMessage("commands.debug.notRunning", new Object[0]));
|
|
private static final SimpleCommandExceptionType c = new SimpleCommandExceptionType(new ChatMessage("commands.debug.alreadyRunning", new Object[0]));
|
|
+ private static final SimpleCommandExceptionType disabled = new SimpleCommandExceptionType(new ChatMessage("commands.purpur.debug.disabled")); // Purpur
|
|
@Nullable
|
|
private static final FileSystemProvider d = (FileSystemProvider) FileSystemProvider.installedProviders().stream().filter((filesystemprovider) -> {
|
|
return filesystemprovider.getScheme().equalsIgnoreCase("jar");
|
|
@@ -43,6 +44,8 @@ public class CommandDebug {
|
|
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
|
|
GameProfiler gameprofiler = minecraftserver.getMethodProfiler();
|
|
|
|
+ if (gameprofiler instanceof net.pl3x.purpur.GameProfilerNoop) throw CommandDebug.disabled.create(); // Purpur
|
|
+
|
|
if (gameprofiler.d().a()) {
|
|
throw CommandDebug.c.create();
|
|
} else {
|
|
@@ -56,6 +59,8 @@ public class CommandDebug {
|
|
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
|
|
GameProfiler gameprofiler = minecraftserver.getMethodProfiler();
|
|
|
|
+ if (gameprofiler instanceof net.pl3x.purpur.GameProfilerNoop) throw CommandDebug.disabled.create(); // Purpur
|
|
+
|
|
if (!gameprofiler.d().a()) {
|
|
throw CommandDebug.b.create();
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 1ef742fd6b..92859c4322 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -80,7 +80,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
private final MojangStatisticsGenerator snooper = new MojangStatisticsGenerator("server", this, SystemUtils.getMonotonicMillis());
|
|
public File universe;
|
|
private final List<Runnable> tickables = Lists.newArrayList();
|
|
- private final GameProfiler methodProfiler = new GameProfiler(this::ak);
|
|
+ protected GameProfiler methodProfiler = new net.pl3x.purpur.GameProfilerNoop(this::getTickCount); // Purpur
|
|
private ServerConnection serverConnection;
|
|
public final WorldLoadListenerFactory worldLoadListenerFactory;
|
|
private final ServerPing serverPing = new ServerPing();
|
|
@@ -1434,6 +1434,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
String s1 = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
|
final DedicatedServer dedicatedserver = new DedicatedServer(optionset, dedicatedserversettings, DataConverterRegistry.a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new, s1);
|
|
|
|
+ if (optionset.has("enableProfiler") || optionset.nonOptionArguments().contains("enableProfiler")) dedicatedserver.methodProfiler = new GameProfiler(dedicatedserver::getTickCount); // Purpur
|
|
+
|
|
/*
|
|
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
|
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
|
@@ -1859,6 +1861,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
public abstract boolean a(EnumGamemode enumgamemode, boolean flag, int i);
|
|
|
|
+ public int getTickCount() { return ak(); } // Purpur - OBFHELPER
|
|
public int ak() {
|
|
return this.ticks;
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/GameProfilerNoop.java b/src/main/java/net/pl3x/purpur/GameProfilerNoop.java
|
|
new file mode 100644
|
|
index 0000000000..b32a5418f2
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/GameProfilerNoop.java
|
|
@@ -0,0 +1,68 @@
|
|
+package net.pl3x.purpur;
|
|
+
|
|
+import net.minecraft.server.GameProfiler;
|
|
+import net.minecraft.server.MethodProfilerResults;
|
|
+import net.minecraft.server.MethodProfilerResultsEmpty;
|
|
+
|
|
+import java.util.function.IntSupplier;
|
|
+import java.util.function.Supplier;
|
|
+
|
|
+public class GameProfilerNoop extends GameProfiler {
|
|
+ private final EmptyProfiler profiler = new EmptyProfiler();
|
|
+
|
|
+ public GameProfilerNoop(IntSupplier tickCount) {
|
|
+ super(tickCount);
|
|
+ }
|
|
+
|
|
+ public GameProfiler.a d() {
|
|
+ return this.profiler;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a() {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void b() {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void enter(String s) {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void a(Supplier<String> supplier) {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void exit() {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void exitEnter(String s) {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void c(String s) {
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void c(Supplier<String> supplier) {
|
|
+ }
|
|
+
|
|
+ static class EmptyProfiler implements GameProfiler.a {
|
|
+ @Override
|
|
+ public boolean a() { // isEnabled
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public MethodProfilerResults b() { // disable
|
|
+ return MethodProfilerResultsEmpty.a; // empty
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void d() { // enable
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
index 7b7e1475b3..1136a0a26d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
@@ -144,6 +144,8 @@ public class Main {
|
|
.ofType(File.class)
|
|
.defaultsTo(new File("purpur.yml"))
|
|
.describedAs("Yml file");
|
|
+
|
|
+ acceptsAll(asList("enableProfiler"), "Enables the vanilla profiler");
|
|
// Purpur end
|
|
|
|
// Paper start
|
|
diff --git a/src/main/resources/purpur.lang b/src/main/resources/purpur.lang
|
|
index e81beea7fa..5c3536b26b 100644
|
|
--- a/src/main/resources/purpur.lang
|
|
+++ b/src/main/resources/purpur.lang
|
|
@@ -1,5 +1,6 @@
|
|
{
|
|
"cannot.ride.mob": "You cannot mount that mob",
|
|
+ "commands.purpur.debug.disabled": "The debug profiler is disabled",
|
|
"commands.purpur.ping": "§a%s's ping is %sms",
|
|
"idle.timeout.broadcast.away": "§e§o%s is now AFK",
|
|
"idle.timeout.broadcast.back": "§e§o%s is no longer AFK"
|
|
--
|
|
2.24.0
|
|
|