Files
KeYiMC/patches/removed/1.19.3/server/0015-Use-Timings-v2-instead-of-spark.patch
2022-12-09 23:36:52 +08:00

1515 lines
83 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Tue, 25 Oct 2022 01:29:25 +0800
Subject: [PATCH] Use Timings v2 instead of spark
Let users choose it.
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index 830d863cd9665d58875bfa5ca2bcd22f89ab2d49..e5d9c6f2cbe11c2ded6d8ad111fa6a8b2086dfba 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -915,9 +915,9 @@ public final class ChunkHolderManager {
}
public boolean processTicketUpdates() {
- //co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager // Purpur
+ co.aikar.timings.MinecraftTimings.distanceManagerTick.startTiming(); try { // Paper - add timings for distance manager
return this.processTicketUpdates(true, true, null);
- //} finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager // Purpur
+ } finally { co.aikar.timings.MinecraftTimings.distanceManagerTick.stopTiming(); } // Paper - add timings for distance manager
}
private static final ThreadLocal<List<ChunkProgressionTask>> CURRENT_TICKET_UPDATE_SCHEDULING = new ThreadLocal<>();
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
index e42eb93fd9f6f51ff5bb4b14a2304d4ffcdd8441..8013dd333e27aa5fd0beb431fa32491eec9f5246 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
@@ -1750,7 +1750,7 @@ public final class NewChunkHolder {
boolean canSavePOI = !(chunk instanceof LevelChunk levelChunk && levelChunk.mustNotSave) && (poi != null && poi.isDirty());
boolean canSaveEntities = entities != null;
- //try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper // Purpur
+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper
if (canSaveChunk) {
canSaveChunk = this.saveChunk(chunk, unloading);
}
@@ -1764,7 +1764,7 @@ public final class NewChunkHolder {
this.lastEntityUnload = null;
}
}
- //} // Purpur
+ }
return executedUnloadTask | canSaveChunk | canSaveEntities | canSavePOI ? new SaveStat(executedUnloadTask || canSaveChunk, canSaveEntities, canSavePOI): null;
}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 04ca6d27a13706fbddc708df0fcca42b4098bcba..d03551e81e3ef37935cb1d963aba3df316f48ef5 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -67,14 +67,14 @@ public class GlobalConfiguration extends ConfigurationPart {
@Override
public void postProcess() {
- /*// Pufferfish start // Purpur
+ // Pufferfish start
if (enabled && !reallyEnabled) {
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] To improve performance, timings have been disabled by default");
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] You can still use timings by using /timings on, but they will not start on server startup unless you set timings.really-enabled to true in paper.yml");
Bukkit.getLogger().log(Level.WARNING, "[Pufferfish] If you would like to disable this message, either set timings.really-enabled to true or timings.enabled to false.");
}
enabled = reallyEnabled;
- */// Pufferfish end // Purpur
+ // Pufferfish end
MinecraftTimings.processConfig(this);
}
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 6c2ba21da99548a107fc9cda433f65b9b7c1e977..edefab4e22ee7217e17eb036165ce58788d4c782 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -47,9 +47,8 @@ public class PacketUtils {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.getConnection().isConnected()) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
- //try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings // Purpur
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
- /* // Purpur
} catch (Exception exception) {
net.minecraft.network.Connection networkmanager = listener.getConnection();
String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
@@ -61,7 +60,7 @@ public class PacketUtils {
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
networkmanager.setReadOnly();
- } */ // Purpur
+ }
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 02ea949342380567448909ad82b4d701831a92bb..0a1662fc8bffca26de909c980b828f7ab05aa5a3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -328,13 +328,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, DynamicOps<Tag> registryreadops, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
super("Server");
SERVER = this; // Paper - better singleton
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
+ this.profiler = this.metricsRecorder.getProfiler();
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
this.stopRecordingMetrics();
- };*/ // Purpur
- //this.onMetricsRecordingFinished = (path) -> { // Purpur
- //}; // Purpur
+ };
+ this.onMetricsRecordingFinished = (path) -> {
+ };
this.status = new ServerStatus();
this.random = RandomSource.create();
this.port = -1;
@@ -936,9 +936,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Paper end
// CraftBukkit end
- /*if (this.metricsRecorder.isRecording()) { // Purpur
+ if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
- }*/ // Purpur
+ }
MinecraftServer.LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
@@ -1181,18 +1181,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
- /*if (this.debugCommandProfilerDelayStart) { // Purpur
+ if (this.debugCommandProfilerDelayStart) {
this.debugCommandProfilerDelayStart = false;
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
- }*/ // Purpur
+ }
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
lastTick = curTime;
this.nextTickTime += 50L;
- //this.startMetricsRecordingTick(); // Purpur
- //this.profiler.push("tick"); // Purpur
+ this.startMetricsRecordingTick();
+ this.profiler.push("tick");
this.tickServer(this::haveTime);
- //this.profiler.popPush("nextTickWait"); // Purpur
+ this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
// Purpur start - tps catchup
if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
@@ -1202,8 +1202,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Purpur end - tps catchup
this.waitUntilNextTick();
- //this.profiler.pop(); // Purpur
- //this.endMetricsRecordingTick(); // Purpur
+ this.profiler.pop();
+ this.endMetricsRecordingTick();
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
@@ -1364,7 +1364,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
- //this.getProfiler().incrementCounter("runTask"); // Purpur
+ this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1408,15 +1408,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper // Purpur
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
long i = Util.getNanos();
// Paper start - move oversleep into full server tick
- //isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); // Purpur
+ isOversleep = true;MinecraftTimings.serverOversleep.startTiming();
this.managedBlock(() -> {
return !this.canOversleep();
});
- //isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); // Purpur
+ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
@@ -1449,7 +1449,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
- //this.profiler.push("save"); // Purpur
+ this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1464,20 +1464,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
// Paper end
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
- //try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { // Purpur
+ try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
this.runAllTasks();
- //} // Purpur
+ }
// Paper end
// Paper start
long endTime = System.nanoTime();
long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end
- //this.profiler.push("tallying"); // Purpur
+ this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
this.averageTickTime = this.averageTickTime * 0.8F + (float) l / 1000000.0F * 0.19999999F;
@@ -1490,31 +1490,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end
this.frameTimer.logFrameDuration(i1 - i);
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- //co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
public void tickChildren(BooleanSupplier shouldKeepTicking) {
- //MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
- //MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
- //this.profiler.push("commandFunctions"); // Purpur
- //MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper
+ this.profiler.push("commandFunctions");
+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper
this.getFunctions().tick();
- //MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper // Purpur
- //this.profiler.popPush("levels"); // Purpur
+ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
+ this.profiler.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - moved down
// CraftBukkit start
// Run tasks that are waiting on processing
- //MinecraftTimings.processQueueTimer.startTiming(); // Spigot // Purpur
+ MinecraftTimings.processQueueTimer.startTiming(); // Spigot
while (!this.processQueue.isEmpty()) {
this.processQueue.remove().run();
}
- //MinecraftTimings.processQueueTimer.stopTiming(); // Spigot // Purpur
+ MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
- //MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - optimize time updates
for (final ServerLevel world : this.getAllLevels()) {
@@ -1534,10 +1534,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end
- //MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
this.isIteratingOverLevels = true; // Paper
- net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1546,28 +1545,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
- /*this.profiler.push(() -> { // Purpur
+ this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
- });*/ // Purpur
+ });
/* Drop global time updates
if (this.tickCount % 20 == 0) {
- //this.profiler.push("timeSync"); // Purpur
+ this.profiler.push("timeSync");
this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension());
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
}
// CraftBukkit end */
- //this.profiler.push("tick"); // Purpur
+ this.profiler.push("tick");
try {
- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
+ worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking);
// Paper start
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
}
// Paper end
- //worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
+ worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) {
// Spigot Start
CrashReport crashreport;
@@ -1583,33 +1582,33 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashreport);
}
- //this.profiler.pop(); // Purpur
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
+ this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
}
this.isIteratingOverLevels = false; // Paper
- //this.profiler.popPush("connection"); // Purpur
- //MinecraftTimings.connectionTimer.startTiming(); // Spigot // Purpur
+ this.profiler.popPush("connection");
+ MinecraftTimings.connectionTimer.startTiming(); // Spigot
this.getConnection().tick();
- //MinecraftTimings.connectionTimer.stopTiming(); // Spigot // Purpur
- //this.profiler.popPush("players"); // Purpur
- //MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.connectionTimer.stopTiming(); // Spigot
+ this.profiler.popPush("players");
+ MinecraftTimings.playerListTimer.startTiming(); // Spigot // Paper
this.playerList.tick();
- //MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
if (SharedConstants.IS_RUNNING_IN_IDE) {
GameTestTicker.SINGLETON.tick();
}
- //this.profiler.popPush("server gui refresh"); // Purpur
+ this.profiler.popPush("server gui refresh");
- //MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
for (int i = 0; i < this.tickables.size(); ++i) {
((Runnable) this.tickables.get(i)).run();
}
- //MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper // Purpur
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
- //this.profiler.pop(); // Purpur
+ this.profiler.pop();
}
public boolean isNetherEnabled() {
@@ -2257,7 +2256,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
- if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Purpur
+ if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
return this.profiler;
}
@@ -2497,7 +2496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end
private void startMetricsRecordingTick() {
- if (false && this.willStartRecordingMetrics) { // Purpur
+ if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(Util.timeSource, this.isDedicatedServer()), Util.timeSource, Util.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
this.executeBlocking(() -> {
this.saveDebugReport(path.resolve("server"));
@@ -2507,40 +2506,40 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.willStartRecordingMetrics = false;
}
- //this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server")); // Purpur
- //this.metricsRecorder.startTick(); // Purpur
- //this.profiler.startTick(); // Purpur
+ this.profiler = SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server"));
+ this.metricsRecorder.startTick();
+ this.profiler.startTick();
}
private void endMetricsRecordingTick() {
- //this.profiler.endTick(); // Purpur
- //this.metricsRecorder.endTick(); // Purpur
+ this.profiler.endTick();
+ this.metricsRecorder.endTick();
}
public boolean isRecordingMetrics() {
- return false; //this.metricsRecorder.isRecording(); // Purpur
+ return this.metricsRecorder.isRecording();
}
public void startRecordingMetrics(Consumer<ProfileResults> resultConsumer, Consumer<Path> dumpConsumer) {
- /*this.onMetricsRecordingStopped = (methodprofilerresults) -> { // Purpur
+ this.onMetricsRecordingStopped = (methodprofilerresults) -> {
this.stopRecordingMetrics();
resultConsumer.accept(methodprofilerresults);
};
this.onMetricsRecordingFinished = dumpConsumer;
- this.willStartRecordingMetrics = true;*/ // Purpur
+ this.willStartRecordingMetrics = true;
}
public void stopRecordingMetrics() {
- //this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; // Purpur
+ this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
}
public void finishRecordingMetrics() {
- //this.metricsRecorder.end(); // Purpur
+ this.metricsRecorder.end();
}
public void cancelRecordingMetrics() {
- //this.metricsRecorder.cancel(); // Purpur
- //this.profiler = this.metricsRecorder.getProfiler(); // Purpur
+ this.metricsRecorder.cancel();
+ this.profiler = this.metricsRecorder.getProfiler();
}
public Path getWorldPath(LevelResource worldSavePath) {
@@ -2585,15 +2584,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public boolean isTimeProfilerRunning() {
- return false; //this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null; // Purpur
+ return this.debugCommandProfilerDelayStart || this.debugCommandProfiler != null;
}
public void startTimeProfiler() {
- //this.debugCommandProfilerDelayStart = true; // Purpur
+ this.debugCommandProfilerDelayStart = true;
}
public ProfileResults stopTimeProfiler() {
- if (true || this.debugCommandProfiler == null) { // Purpur
+ if (this.debugCommandProfiler == null) {
return EmptyProfileResults.EMPTY;
} else {
ProfileResults methodprofilerresults = this.debugCommandProfiler.stop(Util.getNanos(), this.tickCount);
@@ -2766,7 +2765,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return;
}
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming(); // Purpur
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
try {
for (;;) {
boolean moreTasks = this.tickMidTickTasks();
@@ -2793,7 +2792,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
} finally {
- //co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming(); // Purpur
+ co.aikar.timings.MinecraftTimings.midTickChunkTasks.stopTiming();
}
}
// Paper end - execute chunk tasks mid tick
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 2986f110348b376bcdc64fa39b68885551663d4d..d1fa6b1edf733e15dfe9ecbf7ed639238ed43442 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -88,7 +88,7 @@ public class ServerFunctionManager {
} else {
int i;
- try /*(co.aikar.timings.Timing timing = function.getTiming().startTiming())*/ { // Paper // Purpur
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(function, source);
} finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 5420915b21bbd17eeaba2ba45e08399a3abe6952..9a4c782b8be6a837a5c1a07e930b6bb8069b1c54 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -538,7 +538,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInputs() {
- //MinecraftTimings.serverCommandTimer.startTiming(); // Spigot // Purpur
+ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot
// Paper start - use proper queue
ConsoleInput servercommand;
while ((servercommand = this.serverCommandQueue.poll()) != null) {
@@ -555,7 +555,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// CraftBukkit end
}
- //MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot // Purpur
+ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot
}
@Override
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ceaa44e8fbf02aef36f5ae663269dfc1026e4086..5b714df6faca6424e7c7d89e56a4e0425bd1b1c6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -606,20 +606,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper // Purpur
- //gameprofilerfiller.push("poi"); // Purpur
+ try (Timing ignored = this.level.timings.poiUnload.startTiming()) { // Paper
+ gameprofilerfiller.push("poi");
this.poiManager.tick(shouldKeepTicking);
- //} // Paper // Purpur
- //gameprofilerfiller.popPush("chunk_unload"); // Purpur
+ } // Paper
+ gameprofilerfiller.popPush("chunk_unload");
if (!this.level.noSave()) {
- //try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper // Purpur
+ try (Timing ignored = this.level.timings.chunkUnload.startTiming()) { // Paper
this.processUnloads(shouldKeepTicking);
- //} // Paper // Purpur
+ } // Paper
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
public boolean hasWork() {
@@ -1238,24 +1238,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper start - optimised tracker
private final void processTrackQueue() {
- //this.level.timings.tracker1.startTiming(); // Purpur
+ this.level.timings.tracker1.startTiming();
try {
for (TrackedEntity tracker : this.entityMap.values()) {
// update tracker entry
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
}
} finally {
- //this.level.timings.tracker1.stopTiming(); // Purpur
+ this.level.timings.tracker1.stopTiming();
}
- //this.level.timings.tracker2.startTiming(); // Purpur
+ this.level.timings.tracker2.startTiming();
try {
for (TrackedEntity tracker : this.entityMap.values()) {
tracker.serverEntity.sendChanges();
}
} finally {
- //this.level.timings.tracker2.stopTiming(); // Purpur
+ this.level.timings.tracker2.stopTiming();
}
}
// Paper end - optimised tracker
@@ -1270,7 +1270,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
- //level.timings.tracker1.startTiming(); // Paper // Purpur
+ level.timings.tracker1.startTiming(); // Paper
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1295,17 +1295,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
- //level.timings.tracker1.stopTiming(); // Paper // Purpur
+ level.timings.tracker1.stopTiming(); // Paper
if (!list.isEmpty()) {
objectiterator = this.entityMap.values().iterator();
- //level.timings.tracker2.startTiming(); // Paper // Purpur
+ level.timings.tracker2.startTiming(); // Paper
while (objectiterator.hasNext()) {
playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
playerchunkmap_entitytracker.updatePlayers(list);
}
- //level.timings.tracker2.stopTiming(); // Paper // Purpur
+ level.timings.tracker2.stopTiming(); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 3bee0bfc481ffe3ea1860c5b23ad2efbe81cb0ba..014255019ce3f22e0c8cf8f0a775669f909d18f4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -430,16 +430,16 @@ public class ServerChunkCache extends ChunkSource {
return ifLoaded;
}
// Paper end
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //gameprofilerfiller.incrementCounter("getChunk"); // Purpur
+ gameprofilerfiller.incrementCounter("getChunk");
long k = ChunkPos.asLong(x, z);
ChunkAccess ichunkaccess;
// Paper - rewrite chunk system - there are no correct callbacks to remove items from cache in the new chunk system
- //gameprofilerfiller.incrementCounter("getChunkCacheMiss"); // Purpur
+ gameprofilerfiller.incrementCounter("getChunkCacheMiss");
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create, true); // Paper
ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
@@ -449,10 +449,10 @@ public class ServerChunkCache extends ChunkSource {
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.pushChunkWait(this.level, x1, z1); // Paper - rewrite chunk system
// Paper end
com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.level, x1, z1); // Paper - sync load info
- //this.level.timings.syncChunkLoad.startTiming(); // Paper // Purpur
+ this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_b.managedBlock(completablefuture::isDone);
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.popChunkWait(); // Paper - async chunk debug // Paper - rewrite chunk system
- //this.level.timings.syncChunkLoad.stopTiming(); // Paper // Purpur
+ this.level.timings.syncChunkLoad.stopTiming(); // Paper
} // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -600,17 +600,17 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) {
this.runDistanceManagerUpdates();
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
this.chunkMap.saveAllChunks(flush);
- //} // Paper - Timings // Purpur
+ } // Paper - Timings
}
// Paper start - duplicate save, but call incremental
public void saveIncrementally() {
this.runDistanceManagerUpdates();
- //try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings // Purpur
+ try (co.aikar.timings.Timing timed = level.timings.chunkSaveData.startTiming()) { // Paper - Timings
this.chunkMap.saveIncrementally();
- //} // Paper - Timings // Purpur
+ } // Paper - Timings
}
// Paper end
@@ -627,36 +627,36 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {
if (true) return; // Paper - tickets will be removed later, this behavior isn't really well accounted for by the chunk system
- //this.level.getProfiler().push("purge"); // Purpur
+ this.level.getProfiler().push("purge");
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- //this.level.getProfiler().popPush("unload"); // Purpur
+ this.level.getProfiler().popPush("unload");
this.chunkMap.tick(() -> true);
- //this.level.getProfiler().pop(); // Purpur
+ this.level.getProfiler().pop();
this.clearCache();
}
// CraftBukkit end
@Override
public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) {
- //this.level.getProfiler().push("purge"); // Purpur
- //this.level.timings.doChunkMap.startTiming(); // Spigot // Purpur
+ this.level.getProfiler().push("purge");
+ this.level.timings.doChunkMap.startTiming(); // Spigot
this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates();
- //this.level.timings.doChunkMap.stopTiming(); // Spigot // Purpur
- //this.level.getProfiler().popPush("chunks"); // Purpur
+ this.level.timings.doChunkMap.stopTiming(); // Spigot
+ this.level.getProfiler().popPush("chunks");
if (tickChunks) {
- //this.level.timings.chunks.startTiming(); // Paper - timings // Purpur
+ this.level.timings.chunks.startTiming(); // Paper - timings
this.chunkMap.playerChunkManager.tick(); // Paper - this is mostly is to account for view distance changes
this.tickChunks();
- //this.level.timings.chunks.stopTiming(); // Paper - timings // Purpur
+ this.level.timings.chunks.stopTiming(); // Paper - timings
}
- //this.level.timings.doChunkUnload.startTiming(); // Spigot // Purpur
- //this.level.getProfiler().popPush("unload"); // Purpur
+ this.level.timings.doChunkUnload.startTiming(); // Spigot
+ this.level.getProfiler().popPush("unload");
this.chunkMap.tick(shouldKeepTicking);
- //this.level.timings.doChunkUnload.stopTiming(); // Spigot // Purpur
- //this.level.getProfiler().pop(); // Purpur
+ this.level.timings.doChunkUnload.stopTiming(); // Spigot
+ this.level.getProfiler().pop();
this.clearCache();
}
@@ -702,15 +702,15 @@ public class ServerChunkCache extends ChunkSource {
}
// Paper end - optimize isOutisdeRange
LevelData worlddata = this.level.getLevelData();
- //ProfilerFiller gameprofilerfiller = this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.level.getProfiler();
- //gameprofilerfiller.push("pollingChunks"); // Purpur
+ gameprofilerfiller.push("pollingChunks");
this.level.resetIceAndSnowTick(); // Pufferfish - reset ice & snow tick random
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
- //gameprofilerfiller.push("naturalSpawnCount"); // Purpur
- //this.level.timings.countNaturalMobs.startTiming(); // Paper - timings // Purpur
+ gameprofilerfiller.push("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down
@@ -731,16 +731,16 @@ public class ServerChunkCache extends ChunkSource {
// Pufferfish end
}
// Paper end
- //this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings // Purpur
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
- //gameprofilerfiller.popPush("filteringLoadedChunks"); // Purpur
+ gameprofilerfiller.popPush("filteringLoadedChunks");
// Paper - moved down
- //this.level.timings.chunkTicks.startTiming(); // Paper // Purpur
+ this.level.timings.chunkTicks.startTiming(); // Paper
// Paper - moved down
- //gameprofilerfiller.popPush("spawnAndTick"); // Purpur
+ gameprofilerfiller.popPush("spawnAndTick");
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
// Paper - only shuffle if per-player mob spawning is disabled
@@ -790,17 +790,17 @@ public class ServerChunkCache extends ChunkSource {
}
}
// Paper end - optimise chunk tick iteration
- //this.level.timings.chunkTicks.stopTiming(); // Paper // Purpur
- //gameprofilerfiller.popPush("customSpawners"); // Purpur
+ this.level.timings.chunkTicks.stopTiming(); // Paper
+ gameprofilerfiller.popPush("customSpawners");
if (flag2) {
- //try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings // Purpur
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
- //} // Paper - timings // Purpur
+ } // Paper - timings
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
// Paper start - use set of chunks requiring updates, rather than iterating every single one loaded
- //gameprofilerfiller.popPush("broadcast"); // Purpur
- //this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing // Purpur
+ gameprofilerfiller.popPush("broadcast");
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
if (!this.chunkMap.needsChangeBroadcasting.isEmpty()) {
ReferenceOpenHashSet<ChunkHolder> copy = this.chunkMap.needsChangeBroadcasting.clone();
this.chunkMap.needsChangeBroadcasting.clear();
@@ -812,8 +812,8 @@ public class ServerChunkCache extends ChunkSource {
}
}
}
- //this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
+ gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded
// Paper start - controlled flush for entity tracker packets
List<net.minecraft.network.Connection> disabledFlushes = new java.util.ArrayList<>(this.level.players.size());
@@ -1024,7 +1024,7 @@ public class ServerChunkCache extends ChunkSource {
@Override
protected void doRunTask(Runnable task) {
- //ServerChunkCache.this.level.getProfiler().incrementCounter("runTask"); // Purpur
+ ServerChunkCache.this.level.getProfiler().incrementCounter("runTask");
super.doRunTask(task);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4921c791c7900210e6dd96e03256ea529fd1d03d..029d8782ad1371dc95ba244d56b20a4801b004b7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -654,12 +654,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise checkDespawn
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
this.handlingTick = true;
- //gameprofilerfiller.push("world border"); // Purpur
+ gameprofilerfiller.push("world border");
this.getWorldBorder().tick();
- //gameprofilerfiller.popPush("weather"); // Purpur
+ gameprofilerfiller.popPush("weather");
this.advanceWeatherCycle();
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;
@@ -686,32 +686,32 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
- //gameprofilerfiller.popPush("tickPending"); // Purpur
- //timings.scheduledBlocks.startTiming(); // Paper // Purpur
+ gameprofilerfiller.popPush("tickPending");
+ timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug()) {
j = this.getGameTime();
- //gameprofilerfiller.push("blockTicks"); // Purpur
+ gameprofilerfiller.push("blockTicks");
this.blockTicks.tick(j, 65536, this::tickBlock);
- //gameprofilerfiller.popPush("fluidTicks"); // Purpur
+ gameprofilerfiller.popPush("fluidTicks");
this.fluidTicks.tick(j, 65536, this::tickFluid);
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
- //timings.scheduledBlocks.stopTiming(); // Paper // Purpur
+ timings.scheduledBlocks.stopTiming(); // Paper
- //gameprofilerfiller.popPush("raid"); // Purpur
- //this.timings.raids.startTiming(); // Paper - timings // Purpur
+ gameprofilerfiller.popPush("raid");
+ this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
- //this.timings.raids.stopTiming(); // Paper - timings // Purpur
- //gameprofilerfiller.popPush("chunkSource"); // Purpur
- //this.timings.chunkProviderTick.startTiming(); // Paper - timings // Purpur
+ this.timings.raids.stopTiming(); // Paper - timings
+ gameprofilerfiller.popPush("chunkSource");
+ this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking, true);
- //this.timings.chunkProviderTick.stopTiming(); // Paper - timings // Purpur
- //gameprofilerfiller.popPush("blockEvents"); // Purpur
- //timings.doSounds.startTiming(); // Spigot // Purpur
+ this.timings.chunkProviderTick.stopTiming(); // Paper - timings
+ gameprofilerfiller.popPush("blockEvents");
+ timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
- //timings.doSounds.stopTiming(); // Spigot // Purpur
+ timings.doSounds.stopTiming(); // Spigot
this.handlingTick = false;
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) {
@@ -719,25 +719,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
if (flag || this.emptyTime++ < 300) {
- //gameprofilerfiller.push("entities"); // Purpur
- //timings.tickEntities.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push("entities");
+ timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null) {
- //gameprofilerfiller.push("dragonFight"); // Purpur
+ gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
- //timings.entityTick.startTiming(); // Spigot // Purpur
+ timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
entity.activatedPriorityReset = false; // Pufferfish - DAB
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
} else {
- //gameprofilerfiller.push("checkDespawn"); // Purpur
+ gameprofilerfiller.push("checkDespawn");
entity.checkDespawn();
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
if (true || this.chunkSource.chunkMap.getDistanceManager().inEntityTickingRange(entity.chunkPosition().toLong())) { // Paper - now always true if in the ticking list
Entity entity1 = entity.getVehicle();
@@ -749,7 +749,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding();
}
- //gameprofilerfiller.push("tick"); // Purpur
+ gameprofilerfiller.push("tick");
// Pufferfish start - copied from this.guardEntityTick
try {
this.tickNonPassenger(entity); // Pufferfish - changed
@@ -764,22 +764,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end
}
// Pufferfish end
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
}
}
});
- //timings.entityTick.stopTiming(); // Spigot // Purpur
- //timings.tickEntities.stopTiming(); // Spigot // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ timings.entityTick.stopTiming(); // Spigot
+ timings.tickEntities.stopTiming(); // Spigot
+ gameprofilerfiller.pop();
this.tickBlockEntities();
}
- //gameprofilerfiller.push("entityManagement"); // Purpur
+ gameprofilerfiller.push("entityManagement");
//this.entityManager.tick(); // Paper - rewrite chunk system
- //gameprofilerfiller.popPush("gameEvents"); // Purpur
+ gameprofilerfiller.popPush("gameEvents");
this.sendGameEvents();
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
}
@Override
@@ -861,9 +861,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag = this.isRaining();
int j = chunkcoordintpair.getMinBlockX();
int k = chunkcoordintpair.getMinBlockZ();
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- //gameprofilerfiller.push("thunder"); // Purpur
+ gameprofilerfiller.push("thunder");
final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*this.random.nextInt(this.spigotConfig.thunderChance) == 0 &&*/ chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning
@@ -895,7 +895,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
- //gameprofilerfiller.popPush("iceandsnow"); // Purpur
+ gameprofilerfiller.popPush("iceandsnow");
if (!this.paperConfig().environment.disableIceAndSnow && (this.currentIceAndSnowTick++ & 15) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking // Pufferfish - optimize further random ticking
// Paper start - optimise chunk ticking
this.getRandomBlockPosition(j, 0, k, 15, blockposition);
@@ -931,8 +931,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
// Paper start - optimise random block ticking
- //gameprofilerfiller.popPush("randomTick"); // Purpur
- //timings.chunkTicksBlocks.startTiming(); // Paper // Purpur
+ gameprofilerfiller.popPush("randomTick");
+ timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
LevelChunkSection[] sections = chunk.getSections();
int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
@@ -966,8 +966,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise random block ticking
- //timings.chunkTicksBlocks.stopTiming(); // Paper // Purpur
- //gameprofilerfiller.pop(); // Purpur
+ timings.chunkTicksBlocks.stopTiming(); // Paper
+ gameprofilerfiller.pop();
}
public Optional<BlockPos> findLightningRod(BlockPos pos) {
@@ -1259,24 +1259,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
- //timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper // Purpur
- //try { // Purpur
+ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
+ try {
// Paper end - timings
entity.setOldPosAndRot();
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
++entity.tickCount;
- /*this.getProfiler().push(() -> { // Purpur
+ this.getProfiler().push(() -> {
return Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
- });*/ // Purpur
- //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur
+ });
+ gameprofilerfiller.incrementCounter("tickNonPassenger");
if (isActive) { // Paper - EAR 2
TimingHistory.activatedEntityTicks++;
entity.tick();
entity.postTick(); // CraftBukkit
} else { entity.inactiveTick(); } // Paper - EAR 2
- //this.getProfiler().pop(); // Purpur
- //} finally { timer.stopTiming(); } // Paper - timings // Purpur
+ this.getProfiler().pop();
+ } finally { timer.stopTiming(); } // Paper - timings
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1299,17 +1299,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
- //co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper // Purpur
- //try { // Purpur
+ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
+ try {
// Paper end
passenger.setOldPosAndRot();
++passenger.tickCount;
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- /*gameprofilerfiller.push(() -> { // Purpur
+ gameprofilerfiller.push(() -> {
return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString();
- });*/ // Purpur
- //gameprofilerfiller.incrementCounter("tickPassenger"); // Purpur
+ });
+ gameprofilerfiller.incrementCounter("tickPassenger");
// Paper start - EAR 2
if (isActive) {
passenger.rideTick();
@@ -1321,7 +1321,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
vehicle.positionRider(passenger);
}
// Paper end - EAR 2
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1330,7 +1330,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
- //} finally { timer.stopTiming(); }// Paper - EAR2 timings // Purpur
+ } finally { timer.stopTiming(); }// Paper - EAR2 timings
}
} else {
passenger.stopRiding();
@@ -1350,14 +1350,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld()));
}
- //try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { // Purpur
+ try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
if (doFull) {
this.saveLevelData();
}
- //this.timings.worldSaveChunks.startTiming(); // Paper // Purpur
+ this.timings.worldSaveChunks.startTiming(); // Paper
if (!this.noSave()) chunkproviderserver.saveIncrementally();
- //this.timings.worldSaveChunks.stopTiming(); // Paper // Purpur
+ this.timings.worldSaveChunks.stopTiming(); // Paper
// Copied from save()
// CraftBukkit start - moved from MinecraftServer.saveChunks
@@ -1369,7 +1369,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
}
// CraftBukkit end
- //} // Purpur
+ }
}
// Paper end
@@ -1383,7 +1383,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
- //try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper // Purpur // Purpur
+ try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1393,11 +1393,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
- //timings.worldSaveChunks.startTiming(); // Paper // Purpur
+ timings.worldSaveChunks.startTiming(); // Paper
if (!close) chunkproviderserver.save(flush); // Paper - rewrite chunk system
if (close) chunkproviderserver.close(true); // Paper - rewrite chunk system
- //timings.worldSaveChunks.stopTiming(); // Paper // Purpur
- //}// Paper // Purpur
+ timings.worldSaveChunks.stopTiming(); // Paper
+ }// Paper
// Paper - rewrite chunk system - entity saving moved into ChunkHolder
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 59b15c55d353f7fdde1dbd54c6a978b7075ebe1c..01ef7210ac1ffd69297a792469bec951604378b3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2612,7 +2612,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
}
// Paper End
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2622,7 +2622,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
return;
}
@@ -2635,7 +2635,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
} finally {
- //co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper // Purpur
+ co.aikar.timings.MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4ffabb125c3502b64be8d8c334d3e18bae302573..3ab8610f54a8042517b7b48cb28dfc34e51f47c3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1287,7 +1287,7 @@ public abstract class PlayerList {
public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
- //MinecraftTimings.savePlayers.startTiming(); // Paper // Purpur
+ MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0;
long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
@@ -1298,7 +1298,7 @@ public abstract class PlayerList {
}
// Paper end
}
- //MinecraftTimings.savePlayers.stopTiming(); // Paper // Purpur
+ MinecraftTimings.savePlayers.stopTiming(); // Paper
return null; }); // Paper - ensure main
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 8e3b06e1512ea4ee7b0de8294cfd624f47e260ee..eb5a332f0705dd2e5568749a22f2f318d68010d1 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -56,9 +56,9 @@ public abstract class Behavior<E extends LivingEntity> {
this.status = Behavior.Status.RUNNING;
int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
this.endTimestamp = time + (long)i;
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
+ this.timing.startTiming(); // Paper - behavior timings
this.start(world, entity, time);
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
+ this.timing.stopTiming(); // Paper - behavior timings
return true;
} else {
return false;
@@ -69,13 +69,13 @@ public abstract class Behavior<E extends LivingEntity> {
}
public final void tickOrStop(ServerLevel world, E entity, long time) {
- //this.timing.startTiming(); // Paper - behavior timings // Purpur
+ this.timing.startTiming(); // Paper - behavior timings
if (!this.timedOut(time) && this.canStillUse(world, entity, time)) {
this.tick(world, entity, time);
} else {
this.doStop(world, entity, time);
}
- //this.timing.stopTiming(); // Paper - behavior timings // Purpur
+ this.timing.stopTiming(); // Paper - behavior timings
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index 7094701d213c73ba47ace806962244c10fdf4dda..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -46,10 +46,10 @@ public abstract class Sensor<E extends LivingEntity> {
if (--this.timeToTick <= 0L) {
// Paper start - configurable sensor tick rate and timings
this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
- //this.timing.startTiming(); // Purpur
+ this.timing.startTiming();
// Paper end
this.doTick(world, entity);
- //this.timing.stopTiming(); // Paper - sensor timings // Purpur
+ this.timing.stopTiming(); // Paper - sensor timings
}
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0bb14272d024af90e7aef40f2f694e184af607d3..09ae98db728bade8121587e9ded6f3ab98f3bb30 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -712,9 +712,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
BlockState iblockdata2 = this.getBlockState(pos);
if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
- //this.getProfiler().push("queueCheckLight"); // Purpur
+ this.getProfiler().push("queueCheckLight");
this.getChunkSource().getLightEngine().checkBlock(pos);
- //this.getProfiler().pop(); // Purpur
+ this.getProfiler().pop();
}
/*
@@ -991,18 +991,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
protected void tickBlockEntities() {
- //ProfilerFiller gameprofilerfiller = this.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = this.getProfiler();
- //gameprofilerfiller.push("blockEntities"); // Purpur
- //timings.tileEntityPending.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push("blockEntities");
+ timings.tileEntityPending.startTiming(); // Spigot
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
this.pendingBlockEntityTickers.clear();
}
- //timings.tileEntityPending.stopTiming(); // Spigot // Purpur
+ timings.tileEntityPending.stopTiming(); // Spigot
- //timings.tileEntityTick.startTiming(); // Spigot // Purpur
+ timings.tileEntityTick.startTiming(); // Spigot
// Spigot start
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0;
@@ -1035,10 +1035,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
this.blockEntityTickers.removeAll(toRemove);
- //timings.tileEntityTick.stopTiming(); // Spigot // Purpur
+ timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1199,7 +1199,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
+ this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList();
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
return list;
@@ -1207,7 +1207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public <T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate) {
- //this.getProfiler().incrementCounter("getEntities"); // Purpur
+ this.getProfiler().incrementCounter("getEntities");
List<T> list = Lists.newArrayList();
// Paper start - optimise this call
@@ -1538,7 +1538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
public ProfilerFiller getProfiler() {
- if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
+ if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish
return (ProfilerFiller) this.profiler.get();
}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 50712b2222703fff01378e2ececb0fc0dba60b65..a182b3c804cf56855e15290f826fdebdc289a552 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -131,8 +131,8 @@ public final class NaturalSpawner {
}
public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) {
- //world.getProfiler().push("spawner"); // Purpur
- //world.timings.mobSpawn.startTiming(); // Spigot // Purpur
+ world.getProfiler().push("spawner");
+ world.timings.mobSpawn.startTiming(); // Spigot
MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -187,8 +187,8 @@ public final class NaturalSpawner {
}
}
- //world.timings.mobSpawn.stopTiming(); // Spigot // Purpur
- //world.getProfiler().pop(); // Purpur
+ world.timings.mobSpawn.stopTiming(); // Spigot
+ world.getProfiler().pop();
}
// Paper start
@@ -259,7 +259,7 @@ public final class NaturalSpawner {
blockposition_mutableblockposition.set(l, i, i1);
double d0 = (double) l + 0.5D;
double d1 = (double) i1 + 0.5D;
- Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers ? net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR : net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, world.purpurConfig.mobSpawningIgnoreCreativePlayers); // Paper - use chunk's player cache to optimize search in range // Purpur
+ Player entityhuman = (chunk instanceof LevelChunk) ? ((LevelChunk)chunk).findNearestPlayer(d0, i, d1, 576.0D, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS) : world.getNearestPlayer(d0, (double) i, d1, -1.0D, false); // Paper - use chunk's player cache to optimize search in range
if (entityhuman != null) {
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 2877441927de3aeba28f5c3dd876e2ae4c15797c..e0e4a924e926b086699998095a1abddd01d8c002 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -930,7 +930,7 @@ public class LevelChunk extends ChunkAccess {
this.chunkHolder.getEntityChunk().callEntitiesLoadEvent(); // Paper - rewrite chunk system
if (this.needsDecoration) {
- //try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper // Purpur
+ try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false;
java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed());
@@ -950,7 +950,7 @@ public class LevelChunk extends ChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
- //} // Paper // Purpur
+ } // Paper
}
}
}
@@ -1309,10 +1309,10 @@ public class LevelChunk extends ChunkAccess {
if (LevelChunk.this.isTicking(blockposition)) {
try {
- //ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler(); // Purpur
+ ProfilerFiller gameprofilerfiller = LevelChunk.this.level.getProfiler();
- //gameprofilerfiller.push(this::getType); // Purpur
- //this.blockEntity.tickTimer.startTiming(); // Spigot // Purpur
+ gameprofilerfiller.push(this::getType);
+ this.blockEntity.tickTimer.startTiming(); // Spigot
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
if (this.blockEntity.getType().isValid(iblockdata)) {
@@ -1323,7 +1323,7 @@ public class LevelChunk extends ChunkAccess {
LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
}
- //gameprofilerfiller.pop(); // Purpur
+ gameprofilerfiller.pop();
} catch (Throwable throwable) {
if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent tile entity and entity crashes
@@ -1334,7 +1334,7 @@ public class LevelChunk extends ChunkAccess {
// Paper end
// Spigot start
} finally {
- //this.blockEntity.tickTimer.stopTiming(); // Purpur
+ this.blockEntity.tickTimer.stopTiming();
// Spigot end
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index de23676372e86406b069a8ca51de388daa64ab1a..fd3a29f829818886391321a0147764ead2154f13 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -435,38 +435,7 @@ public final class CraftServer implements Server {
if (!pluginFolder.exists()) {
pluginFolder.mkdirs();
}
- // Purpur start
- List<File> extraJars = this.extraPluginJars();
- if (!Boolean.getBoolean("Purpur.IReallyDontWantSpark")) {
- try {
- File file = new File("cache", "spark.jar");
- file.getParentFile().mkdirs();
-
- boolean shouldDownload = true;
- if (file.exists()) {
- String fileSha1 = String.format("%040x", new java.math.BigInteger(1, java.security.MessageDigest.getInstance("SHA-1").digest(java.nio.file.Files.readAllBytes(file.toPath()))));
- String sparkSha1;
- try (java.io.BufferedReader reader = new java.io.BufferedReader(new InputStreamReader(new java.net.URL("https://sparkapi.lucko.me/download/bukkit/sha1").openStream()))) {
- sparkSha1 = reader.lines().collect(Collectors.joining(""));
- }
-
- if (fileSha1.equals(sparkSha1)) {
- shouldDownload = false;
- }
- }
-
- if (shouldDownload) {
- java.nio.file.Files.copy(new java.net.URL("https://sparkapi.lucko.me/download/bukkit").openStream(), file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
- }
-
- extraJars.add(file);
- } catch (Exception e) {
- getLogger().severe("Purpur: Failed to download and install spark plugin");
- e.printStackTrace();
- }
- }
- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, extraJars);
- // Purpur end
+ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars());
// Paper end
for (Plugin plugin : plugins) {
try {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 5402098dce0d64d3dceea51f248d7d366850a74f..d1526ed7197b883e1d1f07baf285bf5eef4d20d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -516,10 +516,10 @@ public class CraftScheduler implements BukkitScheduler {
this.runners.remove(task.getTaskId());
}
}
- //MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerFinishTimer.startTiming(); // Paper
this.pending.addAll(temp);
temp.clear();
- //MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper // Purpur
+ MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
}
@@ -563,7 +563,7 @@ public class CraftScheduler implements BukkitScheduler {
}
void parsePending() { // Paper
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper // Purpur
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.startTiming(); // Paper
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -582,7 +582,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;
- //if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper // Purpur
+ if (!this.isAsyncScheduler) MinecraftTimings.bukkitSchedulerPendingTimer.stopTiming(); // Paper
}
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 4f1cf281c4bf68c37982d390da8779dea78dab18..3f45bab0e9f7b3697e6d9d1092a1e6e579f7066f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -96,13 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@Override
public void run() {
- //try (Timing ignored = timings.startTiming()) { // Paper // Purpur
+ try (Timing ignored = timings.startTiming()) { // Paper
if (this.rTask != null) {
this.rTask.run();
} else {
this.cTask.accept(this);
}
- //} // Paper // Purpur
+ } // Paper
}
long getCreatedAt() {
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
index a6e9e503a496c18e2501b03ec84f4600c134a50c..138407c2d4b0bc55ddb9aac5d2aa3edadda090fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
@@ -115,7 +115,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
public void getScoreboardScores(ObjectiveCriteria criteria, String name, Consumer<Score> consumer) {
// Paper start - add timings for scoreboard search
// plugins leaking scoreboards will make this very expensive, let server owners debug it easily
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync(); // Purpur
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.startTimingIfSync();
try {
// Paper end - add timings for scoreboard search
for (CraftScoreboard scoreboard : this.scoreboards) {
@@ -123,7 +123,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
board.forAllObjectives(criteria, name, (score) -> consumer.accept(score));
}
} finally { // Paper start - add timings for scoreboard search
- //co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync(); // Purpur
+ co.aikar.timings.MinecraftTimings.scoreboardScoreSearch.stopTimingIfSync();
}
// Paper end - add timings for scoreboard search
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index fe830a419c81811f0a72add63a3f09a94392e4a7..383a13a26ee9445fa6201770bb9bef274d72283a 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -170,7 +170,7 @@ public class ActivationRange
*/
public static void activateEntities(Level world)
{
- //MinecraftTimings.entityActivationCheckTimer.startTiming(); // Purpur
+ MinecraftTimings.entityActivationCheckTimer.startTiming();
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
@@ -244,7 +244,7 @@ public class ActivationRange
}
// Paper end
}
- //MinecraftTimings.entityActivationCheckTimer.stopTiming(); // Purpur
+ MinecraftTimings.entityActivationCheckTimer.stopTiming();
}
/**