mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Disable mojang profiler
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 4eec81267bdf6837911ae4baa03e43d2985f230d Mon Sep 17 00:00:00 2001
|
||||
From 1d85f4fa73d52df3f718927ced620dbad1505d9b Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 27 Feb 2020 13:39:06 -0600
|
||||
Subject: [PATCH] decompile-fixes
|
||||
@@ -78,6 +78,7 @@ Subject: [PATCH] decompile-fixes
|
||||
.../java/net/minecraft/server/BiomeVoid.java | 2 +-
|
||||
.../minecraft/server/BiomeWarmDeepOcean.java | 8 +++---
|
||||
.../net/minecraft/server/BiomeWarmOcean.java | 10 +++----
|
||||
.../net/minecraft/server/CommandDebug.java | 2 +-
|
||||
.../net/minecraft/server/EntityBlaze.java | 2 +-
|
||||
.../java/net/minecraft/server/EntityCat.java | 2 +-
|
||||
.../minecraft/server/EntityEnderSignal.java | 2 +-
|
||||
@@ -89,7 +90,7 @@ Subject: [PATCH] decompile-fixes
|
||||
.../net/minecraft/server/EntityWitch.java | 4 +--
|
||||
.../java/net/minecraft/server/MathHelper.java | 2 +-
|
||||
.../server/WorldGenFeatureConfigured.java | 2 +-
|
||||
85 files changed, 224 insertions(+), 230 deletions(-)
|
||||
86 files changed, 225 insertions(+), 231 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeBambooJungle.java b/src/main/java/net/minecraft/server/BiomeBambooJungle.java
|
||||
index de831ed87e..9c38f8907a 100644
|
||||
@@ -1405,6 +1406,19 @@ index dd7916c090..e4dc7d198c 100644
|
||||
BiomeDecoratorGroups.ap(this);
|
||||
this.a(EnumCreatureType.WATER_CREATURE, new BiomeBase.BiomeMeta(EntityTypes.SQUID, 10, 4, 4));
|
||||
this.a(EnumCreatureType.WATER_CREATURE, new BiomeBase.BiomeMeta(EntityTypes.PUFFERFISH, 15, 1, 3));
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandDebug.java b/src/main/java/net/minecraft/server/CommandDebug.java
|
||||
index d384e9578a..f0d72ea39d 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandDebug.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandDebug.java
|
||||
@@ -25,7 +25,7 @@ public class CommandDebug {
|
||||
@Nullable
|
||||
private static final FileSystemProvider d = (FileSystemProvider) FileSystemProvider.installedProviders().stream().filter((filesystemprovider) -> {
|
||||
return filesystemprovider.getScheme().equalsIgnoreCase("jar");
|
||||
- }).findFirst().orElse((Object) null);
|
||||
+ }).findFirst().orElse(null); // Purpur - decompile error
|
||||
|
||||
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
|
||||
com_mojang_brigadier_commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) CommandDispatcher.a("debug").requires((commandlistenerwrapper) -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
|
||||
index 5b1d2c7f50..da6a3fa2c8 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
|
||||
|
||||
4408
patches/server/0112-Add-default-asset-lang-en_us.json.patch
Normal file
4408
patches/server/0112-Add-default-asset-lang-en_us.json.patch
Normal file
File diff suppressed because it is too large
Load Diff
176
patches/server/0113-Disable-mojang-profiler.patch
Normal file
176
patches/server/0113-Disable-mojang-profiler.patch
Normal file
@@ -0,0 +1,176 @@
|
||||
From 0284d0fe32a0599358e6401836955b780eacad7c Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 26 Mar 2020 12:48:02 -0500
|
||||
Subject: [PATCH] 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 +
|
||||
.../assets/minecraft/lang/en_us.json | 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..415f6cb323 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.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 c5319ff0f5..2ede67d883 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();
|
||||
@@ -1388,6 +1388,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));
|
||||
@@ -1813,6 +1815,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 d1af8e9a92..9da9f54d18 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -151,6 +151,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/assets/minecraft/lang/en_us.json b/src/main/resources/assets/minecraft/lang/en_us.json
|
||||
index ae0b45fe41..c4dcaaf2d4 100644
|
||||
--- a/src/main/resources/assets/minecraft/lang/en_us.json
|
||||
+++ b/src/main/resources/assets/minecraft/lang/en_us.json
|
||||
@@ -4127,6 +4127,7 @@
|
||||
"commands.clone.failed": "No blocks were cloned",
|
||||
"commands.debug.notRunning": "The debug profiler hasn't started",
|
||||
"commands.debug.alreadyRunning": "The debug profiler is already started",
|
||||
+ "commands.debug.disabled": "The debug profiler is disabled",
|
||||
"commands.deop.failed": "Nothing changed. The player is not an operator",
|
||||
"commands.effect.give.failed": "Unable to apply this effect (target is either immune to effects, or has something stronger)",
|
||||
"commands.effect.clear.everything.failed": "Target has no effects to remove",
|
||||
--
|
||||
2.24.0
|
||||
|
||||
Reference in New Issue
Block a user