diff --git a/build.gradle.kts b/build.gradle.kts index 91d1b4c..824ca92 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,7 +28,7 @@ paperweight { patchDir("purpurApi") { upstreamPath = "purpur-api" excludes = listOf("build.gradle.kts", "build.gradle.kts.patch", "paper-patches") - patchesDir = file("plazma-api/fork-patches") + patchesDir = file("plazma-api/purpur-patches") outputDir = file("purpur-api") } } diff --git a/patches/server/0048-Remove-Mojang-Profiler-codes.patch b/patches/server/0048-Remove-Mojang-Profiler-codes.patch deleted file mode 100644 index 6e4feca..0000000 --- a/patches/server/0048-Remove-Mojang-Profiler-codes.patch +++ /dev/null @@ -1,2225 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Wed, 27 Sep 2023 17:52:52 +0900 -Subject: [PATCH] Remove Mojang Profiler codes - - -diff --git a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -index bce2dac613d29083dd5fbb68739304cc5a6d4d27..aacfd9b8d71a47a75eefa3a0f87636e58a5b6370 100644 ---- a/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -+++ b/src/main/java/net/minecraft/util/profiling/ActiveProfiler.java -@@ -1,206 +1,3 @@ - package net.minecraft.util.profiling; - --import com.google.common.collect.Lists; --import com.google.common.collect.Maps; --import com.mojang.logging.LogUtils; --import it.unimi.dsi.fastutil.longs.LongArrayList; --import it.unimi.dsi.fastutil.longs.LongList; --import it.unimi.dsi.fastutil.objects.Object2LongMap; --import it.unimi.dsi.fastutil.objects.Object2LongMaps; --import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; --import it.unimi.dsi.fastutil.objects.ObjectArraySet; --import java.time.Duration; --import java.util.List; --import java.util.Map; --import java.util.Set; --import java.util.function.IntSupplier; --import java.util.function.LongSupplier; --import java.util.function.Supplier; --import javax.annotation.Nullable; --import net.minecraft.Util; --import net.minecraft.util.profiling.metrics.MetricCategory; --import org.apache.commons.lang3.tuple.Pair; --import org.slf4j.Logger; -- --public class ActiveProfiler implements ProfileCollector { -- private static final long WARNING_TIME_NANOS = Duration.ofMillis(100L).toNanos(); -- private static final Logger LOGGER = LogUtils.getLogger(); -- private final List paths = Lists.newArrayList(); -- private final LongList startTimes = new LongArrayList(); -- private final Map entries = Maps.newHashMap(); -- private final IntSupplier getTickTime; -- private final LongSupplier getRealTime; -- private final long startTimeNano; -- private final int startTimeTicks; -- private String path = ""; -- private boolean started; -- @Nullable -- private ActiveProfiler.PathEntry currentEntry; -- private final boolean warn; -- private final Set> chartedPaths = new ObjectArraySet<>(); -- -- public ActiveProfiler(LongSupplier timeGetter, IntSupplier tickGetter, boolean checkTimeout) { -- this.startTimeNano = timeGetter.getAsLong(); -- this.getRealTime = timeGetter; -- this.startTimeTicks = tickGetter.getAsInt(); -- this.getTickTime = tickGetter; -- this.warn = checkTimeout; -- } -- -- @Override -- public void startTick() { -- if (this.started) { -- LOGGER.error("Profiler tick already started - missing endTick()?"); -- } else { -- this.started = true; -- this.path = ""; -- this.paths.clear(); -- this.push("root"); -- } -- } -- -- @Override -- public void endTick() { -- if (!this.started) { -- LOGGER.error("Profiler tick already ended - missing startTick()?"); -- } else { -- this.pop(); -- this.started = false; -- if (!this.path.isEmpty()) { -- LOGGER.error( -- "Profiler tick ended before path was fully popped (remainder: '{}'). Mismatched push/pop?", -- LogUtils.defer(() -> ProfileResults.demanglePath(this.path)) -- ); -- } -- } -- } -- -- @Override -- public void push(String location) { -- if (!this.started) { -- LOGGER.error("Cannot push '{}' to profiler if profiler tick hasn't started - missing startTick()?", location); -- } else { -- if (!this.path.isEmpty()) { -- this.path = this.path + "\u001e"; -- } -- -- this.path = this.path + location; -- this.paths.add(this.path); -- this.startTimes.add(Util.getNanos()); -- this.currentEntry = null; -- } -- } -- -- @Override -- public void push(Supplier locationGetter) { -- this.push(locationGetter.get()); -- } -- -- @Override -- public void markForCharting(MetricCategory type) { -- this.chartedPaths.add(Pair.of(this.path, type)); -- } -- -- @Override -- public void pop() { -- if (!this.started) { -- LOGGER.error("Cannot pop from profiler if profiler tick hasn't started - missing startTick()?"); -- } else if (this.startTimes.isEmpty()) { -- LOGGER.error("Tried to pop one too many times! Mismatched push() and pop()?"); -- } else { -- long l = Util.getNanos(); -- long m = this.startTimes.removeLong(this.startTimes.size() - 1); -- this.paths.remove(this.paths.size() - 1); -- long n = l - m; -- ActiveProfiler.PathEntry pathEntry = this.getCurrentEntry(); -- pathEntry.accumulatedDuration += n; -- pathEntry.count++; -- pathEntry.maxDuration = Math.max(pathEntry.maxDuration, n); -- pathEntry.minDuration = Math.min(pathEntry.minDuration, n); -- if (this.warn && n > WARNING_TIME_NANOS) { -- LOGGER.warn( -- "Something's taking too long! '{}' took aprox {} ms", -- LogUtils.defer(() -> ProfileResults.demanglePath(this.path)), -- LogUtils.defer(() -> (double)n / 1000000.0) -- ); -- } -- -- this.path = this.paths.isEmpty() ? "" : this.paths.get(this.paths.size() - 1); -- this.currentEntry = null; -- } -- } -- -- @Override -- public void popPush(String location) { -- this.pop(); -- this.push(location); -- } -- -- @Override -- public void popPush(Supplier locationGetter) { -- this.pop(); -- this.push(locationGetter); -- } -- -- private ActiveProfiler.PathEntry getCurrentEntry() { -- if (this.currentEntry == null) { -- this.currentEntry = this.entries.computeIfAbsent(this.path, k -> new ActiveProfiler.PathEntry()); -- } -- -- return this.currentEntry; -- } -- -- @Override -- public void incrementCounter(String marker, int num) { -- this.getCurrentEntry().counters.addTo(marker, (long)num); -- } -- -- @Override -- public void incrementCounter(Supplier markerGetter, int num) { -- this.getCurrentEntry().counters.addTo(markerGetter.get(), (long)num); -- } -- -- @Override -- public ProfileResults getResults() { -- return new FilledProfileResults(this.entries, this.startTimeNano, this.startTimeTicks, this.getRealTime.getAsLong(), this.getTickTime.getAsInt()); -- } -- -- @Nullable -- @Override -- public ActiveProfiler.PathEntry getEntry(String name) { -- return this.entries.get(name); -- } -- -- @Override -- public Set> getChartedPaths() { -- return this.chartedPaths; -- } -- -- public static class PathEntry implements ProfilerPathEntry { -- long maxDuration = Long.MIN_VALUE; -- long minDuration = Long.MAX_VALUE; -- long accumulatedDuration; -- long count; -- final Object2LongOpenHashMap counters = new Object2LongOpenHashMap<>(); -- -- @Override -- public long getDuration() { -- return this.accumulatedDuration; -- } -- -- @Override -- public long getMaxDuration() { -- return this.maxDuration; -- } -- -- @Override -- public long getCount() { -- return this.count; -- } -- -- @Override -- public Object2LongMap getCounters() { -- return Object2LongMaps.unmodifiable(this.counters); -- } -- } --} -+@Deprecated(forRemoval = true) interface ActiveProfiler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java b/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java -index 4424bca7effa4fef26453afcd06d86e6a30d7b8f..ed0329b8ab3272048a2c1d459a3c091ca32f7d42 100644 ---- a/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java -+++ b/src/main/java/net/minecraft/util/profiling/ContinuousProfiler.java -@@ -1,35 +1,3 @@ - package net.minecraft.util.profiling; - --import java.util.function.IntSupplier; --import java.util.function.LongSupplier; -- --public class ContinuousProfiler { -- private final LongSupplier realTime; -- private final IntSupplier tickCount; -- private ProfileCollector profiler = InactiveProfiler.INSTANCE; -- -- public ContinuousProfiler(LongSupplier timeGetter, IntSupplier tickGetter) { -- this.realTime = timeGetter; -- this.tickCount = tickGetter; -- } -- -- public boolean isEnabled() { -- return this.profiler != InactiveProfiler.INSTANCE; -- } -- -- public void disable() { -- this.profiler = InactiveProfiler.INSTANCE; -- } -- -- public void enable() { -- this.profiler = new ActiveProfiler(this.realTime, this.tickCount, true); -- } -- -- public ProfilerFiller getFiller() { -- return this.profiler; -- } -- -- public ProfileResults getResults() { -- return this.profiler.getResults(); -- } --} -+@Deprecated(forRemoval = true) interface ContinuousProfiler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java b/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java -index 843e28baf089349851d7794c496e518ca396e92d..5900697867a589d272b1c00be75cfd9a838098b1 100644 ---- a/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java -+++ b/src/main/java/net/minecraft/util/profiling/EmptyProfileResults.java -@@ -1,47 +1,3 @@ - package net.minecraft.util.profiling; - --import java.nio.file.Path; --import java.util.Collections; --import java.util.List; -- --public class EmptyProfileResults implements ProfileResults { -- public static final EmptyProfileResults EMPTY = new EmptyProfileResults(); -- -- private EmptyProfileResults() { -- } -- -- @Override -- public List getTimes(String parentPath) { -- return Collections.emptyList(); -- } -- -- @Override -- public boolean saveResults(Path path) { -- return false; -- } -- -- @Override -- public long getStartTimeNano() { -- return 0L; -- } -- -- @Override -- public int getStartTimeTicks() { -- return 0; -- } -- -- @Override -- public long getEndTimeNano() { -- return 0L; -- } -- -- @Override -- public int getEndTimeTicks() { -- return 0; -- } -- -- @Override -- public String getProfilerResults() { -- return ""; -- } --} -+@Deprecated(forRemoval = true) interface EmptyProfileResults {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java b/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java -index 81683f9f24263f663b9e51e429cd2c9e5acf2b1c..eb5dad1cb2e52557dbdee961b26aa97bc0bfbc20 100644 ---- a/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java -+++ b/src/main/java/net/minecraft/util/profiling/FilledProfileResults.java -@@ -1,312 +1,3 @@ - package net.minecraft.util.profiling; - --import com.google.common.base.Splitter; --import com.google.common.collect.Lists; --import com.google.common.collect.Maps; --import com.mojang.logging.LogUtils; --import it.unimi.dsi.fastutil.objects.Object2LongMap; --import it.unimi.dsi.fastutil.objects.Object2LongMaps; --import java.io.Writer; --import java.nio.charset.StandardCharsets; --import java.nio.file.Files; --import java.nio.file.Path; --import java.util.Collections; --import java.util.Comparator; --import java.util.Iterator; --import java.util.List; --import java.util.Locale; --import java.util.Map; --import java.util.Map.Entry; --import net.minecraft.ReportType; --import net.minecraft.SharedConstants; --import org.apache.commons.io.IOUtils; --import org.apache.commons.lang3.ObjectUtils; --import org.slf4j.Logger; -- --public class FilledProfileResults implements ProfileResults { -- private static final Logger LOGGER = LogUtils.getLogger(); -- private static final ProfilerPathEntry EMPTY = new ProfilerPathEntry() { -- @Override -- public long getDuration() { -- return 0L; -- } -- -- @Override -- public long getMaxDuration() { -- return 0L; -- } -- -- @Override -- public long getCount() { -- return 0L; -- } -- -- @Override -- public Object2LongMap getCounters() { -- return Object2LongMaps.emptyMap(); -- } -- }; -- private static final Splitter SPLITTER = Splitter.on('\u001e'); -- private static final Comparator> COUNTER_ENTRY_COMPARATOR = Entry.comparingByValue( -- Comparator.comparingLong(counterCollector -> counterCollector.totalValue) -- ) -- .reversed(); -- private final Map entries; -- private final long startTimeNano; -- private final int startTimeTicks; -- private final long endTimeNano; -- private final int endTimeTicks; -- private final int tickDuration; -- -- public FilledProfileResults(Map locationInfos, long startTime, int startTick, long endTime, int endTick) { -- this.entries = locationInfos; -- this.startTimeNano = startTime; -- this.startTimeTicks = startTick; -- this.endTimeNano = endTime; -- this.endTimeTicks = endTick; -- this.tickDuration = endTick - startTick; -- } -- -- private ProfilerPathEntry getEntry(String path) { -- ProfilerPathEntry profilerPathEntry = this.entries.get(path); -- return profilerPathEntry != null ? profilerPathEntry : EMPTY; -- } -- -- @Override -- public List getTimes(String parentPath) { -- String string = parentPath; -- ProfilerPathEntry profilerPathEntry = this.getEntry("root"); -- long l = profilerPathEntry.getDuration(); -- ProfilerPathEntry profilerPathEntry2 = this.getEntry(parentPath); -- long m = profilerPathEntry2.getDuration(); -- long n = profilerPathEntry2.getCount(); -- List list = Lists.newArrayList(); -- if (!parentPath.isEmpty()) { -- parentPath = parentPath + "\u001e"; -- } -- -- long o = 0L; -- -- for (String string2 : this.entries.keySet()) { -- if (isDirectChild(parentPath, string2)) { -- o += this.getEntry(string2).getDuration(); -- } -- } -- -- float f = (float)o; -- if (o < m) { -- o = m; -- } -- -- if (l < o) { -- l = o; -- } -- -- for (String string3 : this.entries.keySet()) { -- if (isDirectChild(parentPath, string3)) { -- ProfilerPathEntry profilerPathEntry3 = this.getEntry(string3); -- long p = profilerPathEntry3.getDuration(); -- double d = (double)p * 100.0 / (double)o; -- double e = (double)p * 100.0 / (double)l; -- String string4 = string3.substring(parentPath.length()); -- list.add(new ResultField(string4, d, e, profilerPathEntry3.getCount())); -- } -- } -- -- if ((float)o > f) { -- list.add(new ResultField("unspecified", (double)((float)o - f) * 100.0 / (double)o, (double)((float)o - f) * 100.0 / (double)l, n)); -- } -- -- Collections.sort(list); -- list.add(0, new ResultField(string, 100.0, (double)o * 100.0 / (double)l, n)); -- return list; -- } -- -- private static boolean isDirectChild(String parent, String path) { -- return path.length() > parent.length() && path.startsWith(parent) && path.indexOf(30, parent.length() + 1) < 0; -- } -- -- private Map getCounterValues() { -- Map map = Maps.newTreeMap(); -- this.entries -- .forEach( -- (location, info) -> { -- Object2LongMap object2LongMap = info.getCounters(); -- if (!object2LongMap.isEmpty()) { -- List list = SPLITTER.splitToList(location); -- object2LongMap.forEach( -- (marker, count) -> map.computeIfAbsent(marker, k -> new FilledProfileResults.CounterCollector()).addValue(list.iterator(), count) -- ); -- } -- } -- ); -- return map; -- } -- -- @Override -- public long getStartTimeNano() { -- return this.startTimeNano; -- } -- -- @Override -- public int getStartTimeTicks() { -- return this.startTimeTicks; -- } -- -- @Override -- public long getEndTimeNano() { -- return this.endTimeNano; -- } -- -- @Override -- public int getEndTimeTicks() { -- return this.endTimeTicks; -- } -- -- @Override -- public boolean saveResults(Path path) { -- Writer writer = null; -- -- boolean var4; -- try { -- Files.createDirectories(path.getParent()); -- writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8); -- writer.write(this.getProfilerResults(this.getNanoDuration(), this.getTickDuration())); -- return true; -- } catch (Throwable var8) { -- LOGGER.error("Could not save profiler results to {}", path, var8); -- var4 = false; -- } finally { -- IOUtils.closeQuietly(writer); -- } -- -- return var4; -- } -- -- protected String getProfilerResults(long timeSpan, int tickSpan) { -- StringBuilder stringBuilder = new StringBuilder(); -- ReportType.PROFILE.appendHeader(stringBuilder, List.of()); -- stringBuilder.append("Version: ").append(SharedConstants.getCurrentVersion().getId()).append('\n'); -- stringBuilder.append("Time span: ").append(timeSpan / 1000000L).append(" ms\n"); -- stringBuilder.append("Tick span: ").append(tickSpan).append(" ticks\n"); -- stringBuilder.append("// This is approximately ") -- .append(String.format(Locale.ROOT, "%.2f", (float)tickSpan / ((float)timeSpan / 1.0E9F))) -- .append(" ticks per second. It should be ") -- .append(20) -- .append(" ticks per second\n\n"); -- stringBuilder.append("--- BEGIN PROFILE DUMP ---\n\n"); -- this.appendProfilerResults(0, "root", stringBuilder); -- stringBuilder.append("--- END PROFILE DUMP ---\n\n"); -- Map map = this.getCounterValues(); -- if (!map.isEmpty()) { -- stringBuilder.append("--- BEGIN COUNTER DUMP ---\n\n"); -- this.appendCounters(map, stringBuilder, tickSpan); -- stringBuilder.append("--- END COUNTER DUMP ---\n\n"); -- } -- -- return stringBuilder.toString(); -- } -- -- @Override -- public String getProfilerResults() { -- StringBuilder stringBuilder = new StringBuilder(); -- this.appendProfilerResults(0, "root", stringBuilder); -- return stringBuilder.toString(); -- } -- -- private static StringBuilder indentLine(StringBuilder sb, int size) { -- sb.append(String.format(Locale.ROOT, "[%02d] ", size)); -- -- for (int i = 0; i < size; i++) { -- sb.append("| "); -- } -- -- return sb; -- } -- -- private void appendProfilerResults(int level, String name, StringBuilder sb) { -- List list = this.getTimes(name); -- Object2LongMap object2LongMap = ObjectUtils.firstNonNull(this.entries.get(name), EMPTY).getCounters(); -- object2LongMap.forEach( -- (marker, count) -> indentLine(sb, level) -- .append('#') -- .append(marker) -- .append(' ') -- .append(count) -- .append('/') -- .append(count / (long)this.tickDuration) -- .append('\n') -- ); -- if (list.size() >= 3) { -- for (int i = 1; i < list.size(); i++) { -- ResultField resultField = list.get(i); -- indentLine(sb, level) -- .append(resultField.name) -- .append('(') -- .append(resultField.count) -- .append('/') -- .append(String.format(Locale.ROOT, "%.0f", (float)resultField.count / (float)this.tickDuration)) -- .append(')') -- .append(" - ") -- .append(String.format(Locale.ROOT, "%.2f", resultField.percentage)) -- .append("%/") -- .append(String.format(Locale.ROOT, "%.2f", resultField.globalPercentage)) -- .append("%\n"); -- if (!"unspecified".equals(resultField.name)) { -- try { -- this.appendProfilerResults(level + 1, name + "\u001e" + resultField.name, sb); -- } catch (Exception var9) { -- sb.append("[[ EXCEPTION ").append(var9).append(" ]]"); -- } -- } -- } -- } -- } -- -- private void appendCounterResults(int depth, String name, FilledProfileResults.CounterCollector info, int tickSpan, StringBuilder sb) { -- indentLine(sb, depth) -- .append(name) -- .append(" total:") -- .append(info.selfValue) -- .append('/') -- .append(info.totalValue) -- .append(" average: ") -- .append(info.selfValue / (long)tickSpan) -- .append('/') -- .append(info.totalValue / (long)tickSpan) -- .append('\n'); -- info.children -- .entrySet() -- .stream() -- .sorted(COUNTER_ENTRY_COMPARATOR) -- .forEach(entry -> this.appendCounterResults(depth + 1, entry.getKey(), entry.getValue(), tickSpan, sb)); -- } -- -- private void appendCounters(Map counters, StringBuilder sb, int tickSpan) { -- counters.forEach((name, info) -> { -- sb.append("-- Counter: ").append(name).append(" --\n"); -- this.appendCounterResults(0, "root", info.children.get("root"), tickSpan, sb); -- sb.append("\n\n"); -- }); -- } -- -- @Override -- public int getTickDuration() { -- return this.tickDuration; -- } -- -- static class CounterCollector { -- long selfValue; -- long totalValue; -- final Map children = Maps.newHashMap(); -- -- public void addValue(Iterator pathIterator, long time) { -- this.totalValue += time; -- if (!pathIterator.hasNext()) { -- this.selfValue += time; -- } else { -- this.children.computeIfAbsent(pathIterator.next(), k -> new FilledProfileResults.CounterCollector()).addValue(pathIterator, time); -- } -- } -- } --} -+@Deprecated(forRemoval = true) interface FilledProfileResults {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java b/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java -index af326c4396d0af69208c5418c8329b163f7e3d73..9c8859f264f0a57d0c74a3870cd9f38595757b12 100644 ---- a/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java -+++ b/src/main/java/net/minecraft/util/profiling/InactiveProfiler.java -@@ -1,81 +1,3 @@ - package net.minecraft.util.profiling; - --import com.google.common.collect.ImmutableSet; --import java.util.Set; --import java.util.function.Supplier; --import javax.annotation.Nullable; --import net.minecraft.util.profiling.metrics.MetricCategory; --import org.apache.commons.lang3.tuple.Pair; -- --public class InactiveProfiler implements ProfileCollector { -- public static final InactiveProfiler INSTANCE = new InactiveProfiler(); -- -- private InactiveProfiler() { -- } -- -- @Override -- public void startTick() { -- } -- -- @Override -- public void endTick() { -- } -- -- @Override -- public void push(String location) { -- } -- -- @Override -- public void push(Supplier locationGetter) { -- } -- -- @Override -- public void markForCharting(MetricCategory type) { -- } -- -- @Override -- public void pop() { -- } -- -- @Override -- public void popPush(String location) { -- } -- -- @Override -- public void popPush(Supplier locationGetter) { -- } -- -- @Override -- public Zone zone(String name) { -- return Zone.INACTIVE; -- } -- -- @Override -- public Zone zone(Supplier nameSupplier) { -- return Zone.INACTIVE; -- } -- -- @Override -- public void incrementCounter(String marker, int num) { -- } -- -- @Override -- public void incrementCounter(Supplier markerGetter, int num) { -- } -- -- @Override -- public ProfileResults getResults() { -- return EmptyProfileResults.EMPTY; -- } -- -- @Nullable -- @Override -- public ActiveProfiler.PathEntry getEntry(String name) { -- return null; -- } -- -- @Override -- public Set> getChartedPaths() { -- return ImmutableSet.of(); -- } --} -+@Deprecated(forRemoval = true) interface InactiveProfiler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ProfileCollector.java b/src/main/java/net/minecraft/util/profiling/ProfileCollector.java -index fe47a3ce6318ad74bd4d9b10dbf5ee06c94b6939..f8b0a1ce259ccee9e46a09ee0a114d210a4704ce 100644 ---- a/src/main/java/net/minecraft/util/profiling/ProfileCollector.java -+++ b/src/main/java/net/minecraft/util/profiling/ProfileCollector.java -@@ -1,15 +1,3 @@ - package net.minecraft.util.profiling; - --import java.util.Set; --import javax.annotation.Nullable; --import net.minecraft.util.profiling.metrics.MetricCategory; --import org.apache.commons.lang3.tuple.Pair; -- --public interface ProfileCollector extends ProfilerFiller { -- ProfileResults getResults(); -- -- @Nullable -- ActiveProfiler.PathEntry getEntry(String name); -- -- Set> getChartedPaths(); --} -+@Deprecated(forRemoval = true) interface ProfileCollector {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ProfileResults.java b/src/main/java/net/minecraft/util/profiling/ProfileResults.java -index afefd549cf9792a91dd8919c12697a693200d042..313a37de769e74b949fa36ca516a32297622d918 100644 ---- a/src/main/java/net/minecraft/util/profiling/ProfileResults.java -+++ b/src/main/java/net/minecraft/util/profiling/ProfileResults.java -@@ -1,34 +1,3 @@ - package net.minecraft.util.profiling; - --import java.nio.file.Path; --import java.util.List; -- --public interface ProfileResults { -- char PATH_SEPARATOR = '\u001e'; -- -- List getTimes(String parentPath); -- -- boolean saveResults(Path path); -- -- long getStartTimeNano(); -- -- int getStartTimeTicks(); -- -- long getEndTimeNano(); -- -- int getEndTimeTicks(); -- -- default long getNanoDuration() { -- return this.getEndTimeNano() - this.getStartTimeNano(); -- } -- -- default int getTickDuration() { -- return this.getEndTimeTicks() - this.getStartTimeTicks(); -- } -- -- String getProfilerResults(); -- -- static String demanglePath(String path) { -- return path.replace('\u001e', '.'); -- } --} -+@Deprecated interface ProfileResults {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/Profiler.java b/src/main/java/net/minecraft/util/profiling/Profiler.java -index fe8a8ee1f88c58a9fe730c4c0cc5fc4e3651e9f8..09d2768bd51e0bd8917e870387fd187798c809bb 100644 ---- a/src/main/java/net/minecraft/util/profiling/Profiler.java -+++ b/src/main/java/net/minecraft/util/profiling/Profiler.java -@@ -1,58 +1,3 @@ - package net.minecraft.util.profiling; - --import com.mojang.jtracy.TracyClient; --import java.util.Objects; --import java.util.concurrent.atomic.AtomicInteger; -- --public final class Profiler { -- private static final ThreadLocal TRACY_FILLER = ThreadLocal.withInitial(TracyZoneFiller::new); -- private static final ThreadLocal ACTIVE = new ThreadLocal<>(); -- private static final AtomicInteger ACTIVE_COUNT = new AtomicInteger(); -- -- private Profiler() { -- } -- -- public static Profiler.Scope use(ProfilerFiller profiler) { -- startUsing(profiler); -- return Profiler::stopUsing; -- } -- -- private static void startUsing(ProfilerFiller profiler) { -- if (ACTIVE.get() != null) { -- throw new IllegalStateException("Profiler is already active"); -- } else { -- ProfilerFiller profilerFiller = decorateFiller(profiler); -- ACTIVE.set(profilerFiller); -- ACTIVE_COUNT.incrementAndGet(); -- profilerFiller.startTick(); -- } -- } -- -- private static void stopUsing() { -- ProfilerFiller profilerFiller = ACTIVE.get(); -- if (profilerFiller == null) { -- throw new IllegalStateException("Profiler was not active"); -- } else { -- ACTIVE.remove(); -- ACTIVE_COUNT.decrementAndGet(); -- profilerFiller.endTick(); -- } -- } -- -- private static ProfilerFiller decorateFiller(ProfilerFiller builtinProfiler) { -- return ProfilerFiller.combine(getDefaultFiller(), builtinProfiler); -- } -- -- public static ProfilerFiller get() { -- return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : Objects.requireNonNullElseGet(ACTIVE.get(), Profiler::getDefaultFiller); -- } -- -- private static ProfilerFiller getDefaultFiller() { -- return (ProfilerFiller)(TracyClient.isAvailable() ? TRACY_FILLER.get() : InactiveProfiler.INSTANCE); -- } -- -- public interface Scope extends AutoCloseable { -- @Override -- void close(); -- } --} -+@Deprecated(forRemoval = true) interface Profiler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -index bc5c8879befe849ce81becf5e3fba6757b01cb70..1bce6008d63c371c666db13633902e303142127f 100644 ---- a/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -+++ b/src/main/java/net/minecraft/util/profiling/ProfilerFiller.java -@@ -1,151 +1,3 @@ - package net.minecraft.util.profiling; - --import java.util.function.Supplier; --import net.minecraft.util.profiling.metrics.MetricCategory; -- --public interface ProfilerFiller { -- String ROOT = "root"; -- -- void startTick(); -- -- void endTick(); -- -- void push(String location); -- -- void push(Supplier locationGetter); -- -- void pop(); -- -- void popPush(String location); -- -- void popPush(Supplier locationGetter); -- -- default void addZoneText(String label) { -- } -- -- default void addZoneValue(long value) { -- } -- -- default void setZoneColor(int color) { -- } -- -- default Zone zone(String name) { -- this.push(name); -- return new Zone(this); -- } -- -- default Zone zone(Supplier nameSupplier) { -- this.push(nameSupplier); -- return new Zone(this); -- } -- -- void markForCharting(MetricCategory type); -- -- default void incrementCounter(String marker) { -- this.incrementCounter(marker, 1); -- } -- -- void incrementCounter(String marker, int num); -- -- default void incrementCounter(Supplier markerGetter) { -- this.incrementCounter(markerGetter, 1); -- } -- -- void incrementCounter(Supplier markerGetter, int num); -- -- static ProfilerFiller combine(ProfilerFiller first, ProfilerFiller second) { -- if (first == InactiveProfiler.INSTANCE) { -- return second; -- } else { -- return (ProfilerFiller)(second == InactiveProfiler.INSTANCE ? first : new ProfilerFiller.CombinedProfileFiller(first, second)); -- } -- } -- -- public static class CombinedProfileFiller implements ProfilerFiller { -- private final ProfilerFiller first; -- private final ProfilerFiller second; -- -- public CombinedProfileFiller(ProfilerFiller first, ProfilerFiller second) { -- this.first = first; -- this.second = second; -- } -- -- @Override -- public void startTick() { -- this.first.startTick(); -- this.second.startTick(); -- } -- -- @Override -- public void endTick() { -- this.first.endTick(); -- this.second.endTick(); -- } -- -- @Override -- public void push(String location) { -- this.first.push(location); -- this.second.push(location); -- } -- -- @Override -- public void push(Supplier locationGetter) { -- this.first.push(locationGetter); -- this.second.push(locationGetter); -- } -- -- @Override -- public void markForCharting(MetricCategory type) { -- this.first.markForCharting(type); -- this.second.markForCharting(type); -- } -- -- @Override -- public void pop() { -- this.first.pop(); -- this.second.pop(); -- } -- -- @Override -- public void popPush(String location) { -- this.first.popPush(location); -- this.second.popPush(location); -- } -- -- @Override -- public void popPush(Supplier locationGetter) { -- this.first.popPush(locationGetter); -- this.second.popPush(locationGetter); -- } -- -- @Override -- public void incrementCounter(String marker, int num) { -- this.first.incrementCounter(marker, num); -- this.second.incrementCounter(marker, num); -- } -- -- @Override -- public void incrementCounter(Supplier markerGetter, int num) { -- this.first.incrementCounter(markerGetter, num); -- this.second.incrementCounter(markerGetter, num); -- } -- -- @Override -- public void addZoneText(String label) { -- this.first.addZoneText(label); -- this.second.addZoneText(label); -- } -- -- @Override -- public void addZoneValue(long value) { -- this.first.addZoneValue(value); -- this.second.addZoneValue(value); -- } -- -- @Override -- public void setZoneColor(int color) { -- this.first.setZoneColor(color); -- this.second.setZoneColor(color); -- } -- } --} -+@Deprecated(forRemoval = true) interface ProfilerFiller {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java b/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java -index c073262f663309e6f73e67b303927b3996ea0c16..01f2ea7461197c904038edd8920cfd4657539414 100644 ---- a/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java -+++ b/src/main/java/net/minecraft/util/profiling/ProfilerPathEntry.java -@@ -1,13 +1,3 @@ - package net.minecraft.util.profiling; - --import it.unimi.dsi.fastutil.objects.Object2LongMap; -- --public interface ProfilerPathEntry { -- long getDuration(); -- -- long getMaxDuration(); -- -- long getCount(); -- -- Object2LongMap getCounters(); --} -+@Deprecated(forRemoval = true) interface ProfilerPathEntry {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/ResultField.java b/src/main/java/net/minecraft/util/profiling/ResultField.java -index 179dd48aeeacc0b2a42c99f6213dd23683159681..06282475e1300e095a5ba47ca14066b98f29c79f 100644 ---- a/src/main/java/net/minecraft/util/profiling/ResultField.java -+++ b/src/main/java/net/minecraft/util/profiling/ResultField.java -@@ -1,28 +1,3 @@ - package net.minecraft.util.profiling; - --public final class ResultField implements Comparable { -- public final double percentage; -- public final double globalPercentage; -- public final long count; -- public final String name; -- -- public ResultField(String name, double parentUsagePercentage, double totalUsagePercentage, long visitCount) { -- this.name = name; -- this.percentage = parentUsagePercentage; -- this.globalPercentage = totalUsagePercentage; -- this.count = visitCount; -- } -- -- @Override -- public int compareTo(ResultField resultField) { -- if (resultField.percentage < this.percentage) { -- return -1; -- } else { -- return resultField.percentage > this.percentage ? 1 : resultField.name.compareTo(this.name); -- } -- } -- -- public int getColor() { -- return (this.name.hashCode() & 11184810) + 4473924; -- } --} -+@Deprecated(forRemoval = true) interface ResultField {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java b/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java -index 242237c605b4cd46958089063cf096ed29e73918..5ca52264bad74529f0a652efb91c3d5aa515e3d9 100644 ---- a/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java -+++ b/src/main/java/net/minecraft/util/profiling/SingleTickProfiler.java -@@ -1,50 +1,3 @@ - package net.minecraft.util.profiling; - --import com.mojang.logging.LogUtils; --import java.io.File; --import java.util.function.LongSupplier; --import javax.annotation.Nullable; --import net.minecraft.Util; --import org.slf4j.Logger; -- --public class SingleTickProfiler { -- private static final Logger LOGGER = LogUtils.getLogger(); -- private final LongSupplier realTime; -- private final long saveThreshold; -- private int tick; -- private final File location; -- private ProfileCollector profiler = InactiveProfiler.INSTANCE; -- -- public SingleTickProfiler(LongSupplier timeGetter, String filename, long overtime) { -- this.realTime = timeGetter; -- this.location = new File("debug", filename); -- this.saveThreshold = overtime; -- } -- -- public ProfilerFiller startTick() { -- this.profiler = new ActiveProfiler(this.realTime, () -> this.tick, false); -- this.tick++; -- return this.profiler; -- } -- -- public void endTick() { -- if (this.profiler != InactiveProfiler.INSTANCE) { -- ProfileResults profileResults = this.profiler.getResults(); -- this.profiler = InactiveProfiler.INSTANCE; -- if (profileResults.getNanoDuration() >= this.saveThreshold) { -- File file = new File(this.location, "tick-results-" + Util.getFilenameFormattedDateTime() + ".txt"); -- profileResults.saveResults(file.toPath()); -- LOGGER.info("Recorded long tick -- wrote info to: {}", file.getAbsolutePath()); -- } -- } -- } -- -- @Nullable -- public static SingleTickProfiler createTickProfiler(String name) { -- return null; -- } -- -- public static ProfilerFiller decorateFiller(ProfilerFiller profiler, @Nullable SingleTickProfiler monitor) { -- return monitor != null ? ProfilerFiller.combine(monitor.startTick(), profiler) : profiler; -- } --} -+@Deprecated(forRemoval = true) interface SingleTickProfiler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/TracyZoneFiller.java b/src/main/java/net/minecraft/util/profiling/TracyZoneFiller.java -index 8a3df14ef0cf135c5a1d2e251a51a860a3481064..73afff34ce603a9d4df725a44b3f3396d768fec7 100644 ---- a/src/main/java/net/minecraft/util/profiling/TracyZoneFiller.java -+++ b/src/main/java/net/minecraft/util/profiling/TracyZoneFiller.java -@@ -1,140 +1,3 @@ - package net.minecraft.util.profiling; - --import com.mojang.jtracy.Plot; --import com.mojang.jtracy.TracyClient; --import com.mojang.logging.LogUtils; --import java.lang.StackWalker.Option; --import java.lang.StackWalker.StackFrame; --import java.util.ArrayList; --import java.util.HashMap; --import java.util.List; --import java.util.Map; --import java.util.Optional; --import java.util.Set; --import java.util.function.Supplier; --import net.minecraft.SharedConstants; --import net.minecraft.util.profiling.metrics.MetricCategory; --import org.slf4j.Logger; -- --public class TracyZoneFiller implements ProfilerFiller { -- private static final Logger LOGGER = LogUtils.getLogger(); -- private static final StackWalker STACK_WALKER = StackWalker.getInstance(Set.of(Option.RETAIN_CLASS_REFERENCE), 5); -- private final List activeZones = new ArrayList<>(); -- private final Map plots = new HashMap<>(); -- private final String name = Thread.currentThread().getName(); -- -- @Override -- public void startTick() { -- } -- -- @Override -- public void endTick() { -- for (TracyZoneFiller.PlotAndValue plotAndValue : this.plots.values()) { -- plotAndValue.set(0); -- } -- } -- -- @Override -- public void push(String location) { -- String string = ""; -- String string2 = ""; -- int i = 0; -- if (SharedConstants.IS_RUNNING_IN_IDE) { -- Optional optional = STACK_WALKER.walk( -- stream -> stream.filter( -- frame -> frame.getDeclaringClass() != TracyZoneFiller.class -- && frame.getDeclaringClass() != ProfilerFiller.CombinedProfileFiller.class -- ) -- .findFirst() -- ); -- if (optional.isPresent()) { -- StackFrame stackFrame = optional.get(); -- string = stackFrame.getMethodName(); -- string2 = stackFrame.getFileName(); -- i = stackFrame.getLineNumber(); -- } -- } -- -- com.mojang.jtracy.Zone zone = TracyClient.beginZone(location, string, string2, i); -- this.activeZones.add(zone); -- } -- -- @Override -- public void push(Supplier locationGetter) { -- this.push(locationGetter.get()); -- } -- -- @Override -- public void pop() { -- if (this.activeZones.isEmpty()) { -- LOGGER.error("Tried to pop one too many times! Mismatched push() and pop()?"); -- } else { -- com.mojang.jtracy.Zone zone = this.activeZones.removeLast(); -- zone.close(); -- } -- } -- -- @Override -- public void popPush(String location) { -- this.pop(); -- this.push(location); -- } -- -- @Override -- public void popPush(Supplier locationGetter) { -- this.pop(); -- this.push(locationGetter.get()); -- } -- -- @Override -- public void markForCharting(MetricCategory type) { -- } -- -- @Override -- public void incrementCounter(String marker, int num) { -- this.plots.computeIfAbsent(marker, markerName -> new TracyZoneFiller.PlotAndValue(this.name + " " + marker)).add(num); -- } -- -- @Override -- public void incrementCounter(Supplier markerGetter, int num) { -- this.incrementCounter(markerGetter.get(), num); -- } -- -- private com.mojang.jtracy.Zone activeZone() { -- return this.activeZones.getLast(); -- } -- -- @Override -- public void addZoneText(String label) { -- this.activeZone().addText(label); -- } -- -- @Override -- public void addZoneValue(long value) { -- this.activeZone().addValue(value); -- } -- -- @Override -- public void setZoneColor(int color) { -- this.activeZone().setColor(color); -- } -- -- static final class PlotAndValue { -- private final Plot plot; -- private int value; -- -- PlotAndValue(String name) { -- this.plot = TracyClient.createPlot(name); -- this.value = 0; -- } -- -- void set(int count) { -- this.value = count; -- this.plot.setValue((double)count); -- } -- -- void add(int count) { -- this.set(this.value + count); -- } -- } --} -+@Deprecated(forRemoval = true) interface TracyZoneFiller {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/Zone.java b/src/main/java/net/minecraft/util/profiling/Zone.java -index 33d0790b08d92acabc7892fcac2109fa7cba6651..276ef2b2e3b936b1a243bc8bf59110173d964d72 100644 ---- a/src/main/java/net/minecraft/util/profiling/Zone.java -+++ b/src/main/java/net/minecraft/util/profiling/Zone.java -@@ -1,53 +1,3 @@ - package net.minecraft.util.profiling; - --import java.util.function.Supplier; --import javax.annotation.Nullable; -- --public class Zone implements AutoCloseable { -- public static final Zone INACTIVE = new Zone(null); -- @Nullable -- private final ProfilerFiller profiler; -- -- Zone(@Nullable ProfilerFiller wrapped) { -- this.profiler = wrapped; -- } -- -- public Zone addText(String label) { -- if (this.profiler != null) { -- this.profiler.addZoneText(label); -- } -- -- return this; -- } -- -- public Zone addText(Supplier labelSupplier) { -- if (this.profiler != null) { -- this.profiler.addZoneText(labelSupplier.get()); -- } -- -- return this; -- } -- -- public Zone addValue(long value) { -- if (this.profiler != null) { -- this.profiler.addZoneValue(value); -- } -- -- return this; -- } -- -- public Zone setColor(int color) { -- if (this.profiler != null) { -- this.profiler.setZoneColor(color); -- } -- -- return this; -- } -- -- @Override -- public void close() { -- if (this.profiler != null) { -- this.profiler.pop(); -- } -- } --} -+@Deprecated(forRemoval = true) interface Zone {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java -index 2e6edbb481d1716c5d0bd30cf518809a7953ceea..cbfe67beb6e1962455bbcf18253b67fd4047f914 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricCategory.java -@@ -1,23 +1,3 @@ - package net.minecraft.util.profiling.metrics; - --public enum MetricCategory { -- PATH_FINDING("pathfinding"), -- EVENT_LOOPS("event-loops"), -- CONSECUTIVE_EXECUTORS("consecutive-executors"), -- TICK_LOOP("ticking"), -- JVM("jvm"), -- CHUNK_RENDERING("chunk rendering"), -- CHUNK_RENDERING_DISPATCHING("chunk rendering dispatching"), -- CPU("cpu"), -- GPU("gpu"); -- -- private final String description; -- -- private MetricCategory(final String name) { -- this.description = name; -- } -- -- public String getDescription() { -- return this.description; -- } --} -+@Deprecated(forRemoval = true) interface MetricCategory {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java -index dd2bf15d22e5839ca986d3e824fb785786af86c8..87d3c172cffd4e6f3400895594fee540d838a911 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricSampler.java -@@ -1,213 +1,3 @@ - package net.minecraft.util.profiling.metrics; - --import io.netty.buffer.ByteBuf; --import io.netty.buffer.ByteBufAllocator; --import it.unimi.dsi.fastutil.ints.Int2DoubleMap; --import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap; --import java.util.Locale; --import java.util.function.Consumer; --import java.util.function.DoubleSupplier; --import java.util.function.ToDoubleFunction; --import javax.annotation.Nullable; -- --public class MetricSampler { -- private final String name; -- private final MetricCategory category; -- private final DoubleSupplier sampler; -- private final ByteBuf ticks; -- private final ByteBuf values; -- private volatile boolean isRunning; -- @Nullable -- private final Runnable beforeTick; -- @Nullable -- final MetricSampler.ThresholdTest thresholdTest; -- private double currentValue; -- -- protected MetricSampler( -- String name, MetricCategory type, DoubleSupplier retriever, @Nullable Runnable startAction, @Nullable MetricSampler.ThresholdTest deviationChecker -- ) { -- this.name = name; -- this.category = type; -- this.beforeTick = startAction; -- this.sampler = retriever; -- this.thresholdTest = deviationChecker; -- this.values = ByteBufAllocator.DEFAULT.buffer(); -- this.ticks = ByteBufAllocator.DEFAULT.buffer(); -- this.isRunning = true; -- } -- -- public static MetricSampler create(String name, MetricCategory type, DoubleSupplier retriever) { -- return new MetricSampler(name, type, retriever, null, null); -- } -- -- public static MetricSampler create(String name, MetricCategory type, T context, ToDoubleFunction retriever) { -- return builder(name, type, retriever, context).build(); -- } -- -- public static MetricSampler.MetricSamplerBuilder builder(String name, MetricCategory type, ToDoubleFunction retriever, T context) { -- return new MetricSampler.MetricSamplerBuilder<>(name, type, retriever, context); -- } -- -- public void onStartTick() { -- if (!this.isRunning) { -- throw new IllegalStateException("Not running"); -- } else { -- if (this.beforeTick != null) { -- this.beforeTick.run(); -- } -- } -- } -- -- public void onEndTick(int tick) { -- this.verifyRunning(); -- this.currentValue = this.sampler.getAsDouble(); -- this.values.writeDouble(this.currentValue); -- this.ticks.writeInt(tick); -- } -- -- public void onFinished() { -- this.verifyRunning(); -- this.values.release(); -- this.ticks.release(); -- this.isRunning = false; -- } -- -- private void verifyRunning() { -- if (!this.isRunning) { -- throw new IllegalStateException(String.format(Locale.ROOT, "Sampler for metric %s not started!", this.name)); -- } -- } -- -- DoubleSupplier getSampler() { -- return this.sampler; -- } -- -- public String getName() { -- return this.name; -- } -- -- public MetricCategory getCategory() { -- return this.category; -- } -- -- public MetricSampler.SamplerResult result() { -- Int2DoubleMap int2DoubleMap = new Int2DoubleOpenHashMap(); -- int i = Integer.MIN_VALUE; -- int j = Integer.MIN_VALUE; -- -- while (this.values.isReadable(8)) { -- int k = this.ticks.readInt(); -- if (i == Integer.MIN_VALUE) { -- i = k; -- } -- -- int2DoubleMap.put(k, this.values.readDouble()); -- j = k; -- } -- -- return new MetricSampler.SamplerResult(i, j, int2DoubleMap); -- } -- -- public boolean triggersThreshold() { -- return this.thresholdTest != null && this.thresholdTest.test(this.currentValue); -- } -- -- @Override -- public boolean equals(Object object) { -- if (this == object) { -- return true; -- } else if (object != null && this.getClass() == object.getClass()) { -- MetricSampler metricSampler = (MetricSampler)object; -- return this.name.equals(metricSampler.name) && this.category.equals(metricSampler.category); -- } else { -- return false; -- } -- } -- -- @Override -- public int hashCode() { -- return this.name.hashCode(); -- } -- -- public static class MetricSamplerBuilder { -- private final String name; -- private final MetricCategory category; -- private final DoubleSupplier sampler; -- private final T context; -- @Nullable -- private Runnable beforeTick; -- @Nullable -- private MetricSampler.ThresholdTest thresholdTest; -- -- public MetricSamplerBuilder(String name, MetricCategory type, ToDoubleFunction timeFunction, T context) { -- this.name = name; -- this.category = type; -- this.sampler = () -> timeFunction.applyAsDouble(context); -- this.context = context; -- } -- -- public MetricSampler.MetricSamplerBuilder withBeforeTick(Consumer action) { -- this.beforeTick = () -> action.accept(this.context); -- return this; -- } -- -- public MetricSampler.MetricSamplerBuilder withThresholdAlert(MetricSampler.ThresholdTest deviationChecker) { -- this.thresholdTest = deviationChecker; -- return this; -- } -- -- public MetricSampler build() { -- return new MetricSampler(this.name, this.category, this.sampler, this.beforeTick, this.thresholdTest); -- } -- } -- -- public static class SamplerResult { -- private final Int2DoubleMap recording; -- private final int firstTick; -- private final int lastTick; -- -- public SamplerResult(int startTick, int endTick, Int2DoubleMap values) { -- this.firstTick = startTick; -- this.lastTick = endTick; -- this.recording = values; -- } -- -- public double valueAtTick(int tick) { -- return this.recording.get(tick); -- } -- -- public int getFirstTick() { -- return this.firstTick; -- } -- -- public int getLastTick() { -- return this.lastTick; -- } -- } -- -- public interface ThresholdTest { -- boolean test(double value); -- } -- -- public static class ValueIncreasedByPercentage implements MetricSampler.ThresholdTest { -- private final float percentageIncreaseThreshold; -- private double previousValue = Double.MIN_VALUE; -- -- public ValueIncreasedByPercentage(float threshold) { -- this.percentageIncreaseThreshold = threshold; -- } -- -- @Override -- public boolean test(double value) { -- boolean bl2; -- if (this.previousValue != Double.MIN_VALUE && !(value <= this.previousValue)) { -- bl2 = (value - this.previousValue) / this.previousValue >= (double)this.percentageIncreaseThreshold; -- } else { -- bl2 = false; -- } -- -- this.previousValue = value; -- return bl2; -- } -- } --} -+@Deprecated(forRemoval = true) interface MetricSampler {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java -index c22a91ee393744a4eaffe1fff168b18ac1bc55bd..2a0885bed637afe31710229c6186b79389f3cb4f 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricsRegistry.java -@@ -1,85 +1,3 @@ - package net.minecraft.util.profiling.metrics; - --import java.util.List; --import java.util.Map; --import java.util.Objects; --import java.util.WeakHashMap; --import java.util.stream.Collectors; --import javax.annotation.Nullable; -- --public class MetricsRegistry { -- public static final MetricsRegistry INSTANCE = new MetricsRegistry(); -- private final WeakHashMap measuredInstances = new WeakHashMap<>(); -- -- private MetricsRegistry() { -- } -- -- public void add(ProfilerMeasured executor) { -- this.measuredInstances.put(executor, null); -- } -- -- public List getRegisteredSamplers() { -- Map> map = this.measuredInstances -- .keySet() -- .stream() -- .flatMap(executor -> executor.profiledMetrics().stream()) -- .collect(Collectors.groupingBy(MetricSampler::getName)); -- return aggregateDuplicates(map); -- } -- -- private static List aggregateDuplicates(Map> samplers) { -- return samplers.entrySet().stream().map(entry -> { -- String string = entry.getKey(); -- List list = entry.getValue(); -- return (MetricSampler)(list.size() > 1 ? new MetricsRegistry.AggregatedMetricSampler(string, list) : list.get(0)); -- }).collect(Collectors.toList()); -- } -- -- static class AggregatedMetricSampler extends MetricSampler { -- private final List delegates; -- -- AggregatedMetricSampler(String id, List delegates) { -- super(id, delegates.get(0).getCategory(), () -> averageValueFromDelegates(delegates), () -> beforeTick(delegates), thresholdTest(delegates)); -- this.delegates = delegates; -- } -- -- private static MetricSampler.ThresholdTest thresholdTest(List delegates) { -- return value -> delegates.stream().anyMatch(sampler -> sampler.thresholdTest != null && sampler.thresholdTest.test(value)); -- } -- -- private static void beforeTick(List samplers) { -- for (MetricSampler metricSampler : samplers) { -- metricSampler.onStartTick(); -- } -- } -- -- private static double averageValueFromDelegates(List samplers) { -- double d = 0.0; -- -- for (MetricSampler metricSampler : samplers) { -- d += metricSampler.getSampler().getAsDouble(); -- } -- -- return d / (double)samplers.size(); -- } -- -- @Override -- public boolean equals(@Nullable Object object) { -- if (this == object) { -- return true; -- } else if (object == null || this.getClass() != object.getClass()) { -- return false; -- } else if (!super.equals(object)) { -- return false; -- } else { -- MetricsRegistry.AggregatedMetricSampler aggregatedMetricSampler = (MetricsRegistry.AggregatedMetricSampler)object; -- return this.delegates.equals(aggregatedMetricSampler.delegates); -- } -- } -- -- @Override -- public int hashCode() { -- return Objects.hash(super.hashCode(), this.delegates); -- } -- } --} -+@Deprecated(forRemoval = true) interface MetricsRegistry {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java b/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java -index 07f78c451e5330296c38f6b599d979610a03381f..2520855b7ca25520d5cba8ba072b16e256d5a0d8 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/MetricsSamplerProvider.java -@@ -1,9 +1,3 @@ - package net.minecraft.util.profiling.metrics; - --import java.util.Set; --import java.util.function.Supplier; --import net.minecraft.util.profiling.ProfileCollector; -- --public interface MetricsSamplerProvider { -- Set samplers(Supplier profilerSupplier); --} -+@Deprecated(forRemoval = true) interface MetricsSamplerProvider {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java b/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java -index 3057e9caa1936d114e07b3dfbd0dffd8aca1223c..51cde2a829dea51513ca8f689829cd3a8d4fbd48 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/ProfilerMeasured.java -@@ -1,7 +1,3 @@ - package net.minecraft.util.profiling.metrics; - --import java.util.List; -- --public interface ProfilerMeasured { -- List profiledMetrics(); --} -+@Deprecated(forRemoval = true) interface ProfilerMeasured {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java -index c64e1afbff4a0e32beb465ae10fff6e9f21f6af6..b0bad6ab38d118f07b0da718c99df01639f64af9 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java -@@ -1,168 +1,3 @@ - package net.minecraft.util.profiling.metrics.profiling; - --import com.google.common.collect.ImmutableSet; --import com.google.common.collect.Lists; --import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; --import java.nio.file.Path; --import java.time.Instant; --import java.util.Collection; --import java.util.HashSet; --import java.util.List; --import java.util.Map; --import java.util.Set; --import java.util.concurrent.Executor; --import java.util.concurrent.TimeUnit; --import java.util.function.Consumer; --import java.util.function.LongSupplier; --import javax.annotation.Nullable; --import net.minecraft.util.profiling.ActiveProfiler; --import net.minecraft.util.profiling.ContinuousProfiler; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.InactiveProfiler; --import net.minecraft.util.profiling.ProfileCollector; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.ProfilerFiller; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsSamplerProvider; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; --import net.minecraft.util.profiling.metrics.storage.RecordedDeviation; -- --public class ActiveMetricsRecorder implements MetricsRecorder { -- public static final int PROFILING_MAX_DURATION_SECONDS = 10; -- @Nullable -- private static Consumer globalOnReportFinished = null; -- private final Map> deviationsBySampler = new Object2ObjectOpenHashMap<>(); -- private final ContinuousProfiler taskProfiler; -- private final Executor ioExecutor; -- private final MetricsPersister metricsPersister; -- private final Consumer onProfilingEnd; -- private final Consumer onReportFinished; -- private final MetricsSamplerProvider metricsSamplerProvider; -- private final LongSupplier wallTimeSource; -- private final long deadlineNano; -- private int currentTick; -- private ProfileCollector singleTickProfiler; -- private volatile boolean killSwitch; -- private Set thisTickSamplers = ImmutableSet.of(); -- -- private ActiveMetricsRecorder( -- MetricsSamplerProvider samplerSource, -- LongSupplier timeGetter, -- Executor dumpExecutor, -- MetricsPersister dumper, -- Consumer resultConsumer, -- Consumer dumpConsumer -- ) { -- this.metricsSamplerProvider = samplerSource; -- this.wallTimeSource = timeGetter; -- this.taskProfiler = new ContinuousProfiler(timeGetter, () -> this.currentTick); -- this.ioExecutor = dumpExecutor; -- this.metricsPersister = dumper; -- this.onProfilingEnd = resultConsumer; -- this.onReportFinished = globalOnReportFinished == null ? dumpConsumer : dumpConsumer.andThen(globalOnReportFinished); -- this.deadlineNano = timeGetter.getAsLong() + TimeUnit.NANOSECONDS.convert(10L, TimeUnit.SECONDS); -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); -- this.taskProfiler.enable(); -- } -- -- public static ActiveMetricsRecorder createStarted( -- MetricsSamplerProvider source, -- LongSupplier timeGetter, -- Executor dumpExecutor, -- MetricsPersister dumper, -- Consumer resultConsumer, -- Consumer dumpConsumer -- ) { -- return new ActiveMetricsRecorder(source, timeGetter, dumpExecutor, dumper, resultConsumer, dumpConsumer); -- } -- -- @Override -- public synchronized void end() { -- if (this.isRecording()) { -- this.killSwitch = true; -- } -- } -- -- @Override -- public synchronized void cancel() { -- if (this.isRecording()) { -- this.singleTickProfiler = InactiveProfiler.INSTANCE; -- this.onProfilingEnd.accept(EmptyProfileResults.EMPTY); -- this.cleanup(this.thisTickSamplers); -- } -- } -- -- @Override -- public void startTick() { -- this.verifyStarted(); -- this.thisTickSamplers = this.metricsSamplerProvider.samplers(() -> this.singleTickProfiler); -- -- for (MetricSampler metricSampler : this.thisTickSamplers) { -- metricSampler.onStartTick(); -- } -- -- this.currentTick++; -- } -- -- @Override -- public void endTick() { -- this.verifyStarted(); -- if (this.currentTick != 0) { -- for (MetricSampler metricSampler : this.thisTickSamplers) { -- metricSampler.onEndTick(this.currentTick); -- if (metricSampler.triggersThreshold()) { -- RecordedDeviation recordedDeviation = new RecordedDeviation(Instant.now(), this.currentTick, this.singleTickProfiler.getResults()); -- this.deviationsBySampler.computeIfAbsent(metricSampler, s -> Lists.newArrayList()).add(recordedDeviation); -- } -- } -- -- if (!this.killSwitch && this.wallTimeSource.getAsLong() <= this.deadlineNano) { -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); -- } else { -- this.killSwitch = false; -- ProfileResults profileResults = this.taskProfiler.getResults(); -- this.singleTickProfiler = InactiveProfiler.INSTANCE; -- this.onProfilingEnd.accept(profileResults); -- this.scheduleSaveResults(profileResults); -- } -- } -- } -- -- @Override -- public boolean isRecording() { -- return this.taskProfiler.isEnabled(); -- } -- -- @Override -- public ProfilerFiller getProfiler() { -- return ProfilerFiller.combine(this.taskProfiler.getFiller(), this.singleTickProfiler); -- } -- -- private void verifyStarted() { -- if (!this.isRecording()) { -- throw new IllegalStateException("Not started!"); -- } -- } -- -- private void scheduleSaveResults(ProfileResults result) { -- HashSet hashSet = new HashSet<>(this.thisTickSamplers); -- this.ioExecutor.execute(() -> { -- Path path = this.metricsPersister.saveReports(hashSet, this.deviationsBySampler, result); -- this.cleanup(hashSet); -- this.onReportFinished.accept(path); -- }); -- } -- -- private void cleanup(Collection samplers) { -- for (MetricSampler metricSampler : samplers) { -- metricSampler.onFinished(); -- } -- -- this.deviationsBySampler.clear(); -- this.taskProfiler.disable(); -- } -- -- public static void registerGlobalCompletionCallback(Consumer consumer) { -- globalOnReportFinished = consumer; -- } --} -+@Deprecated(forRemoval = true) interface ActiveMetricsRecorder {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java -index 12d7b7c86115b667bd8f940206985d9ed4b837d4..97dcd747868e0fd61de5731aee8abd9e49f14d88 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/InactiveMetricsRecorder.java -@@ -1,34 +1,3 @@ - package net.minecraft.util.profiling.metrics.profiling; - --import net.minecraft.util.profiling.InactiveProfiler; --import net.minecraft.util.profiling.ProfilerFiller; -- --public class InactiveMetricsRecorder implements MetricsRecorder { -- public static final MetricsRecorder INSTANCE = new InactiveMetricsRecorder(); -- -- @Override -- public void end() { -- } -- -- @Override -- public void cancel() { -- } -- -- @Override -- public void startTick() { -- } -- -- @Override -- public boolean isRecording() { -- return false; -- } -- -- @Override -- public ProfilerFiller getProfiler() { -- return InactiveProfiler.INSTANCE; -- } -- -- @Override -- public void endTick() { -- } --} -+@Deprecated(forRemoval = true) interface InactiveMetricsRecorder {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java -index 48e7211e01691a677c52cf1f5982b0c179eaf83b..15da03b91bb494e2155529962e9afb42db4073b9 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/MetricsRecorder.java -@@ -1,17 +1,3 @@ - package net.minecraft.util.profiling.metrics.profiling; - --import net.minecraft.util.profiling.ProfilerFiller; -- --public interface MetricsRecorder { -- void end(); -- -- void cancel(); -- -- void startTick(); -- -- boolean isRecording(); -- -- ProfilerFiller getProfiler(); -- -- void endTick(); --} -+@Deprecated(forRemoval = true) interface MetricsRecorder {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java -index cf47ee0f4ec9ffb130b04c7cf92e7907f9b791ef..a1490bd2f5a2eaf0f277feb728c02b036d85fcaa 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ProfilerSamplerAdapter.java -@@ -1,37 +1,3 @@ - package net.minecraft.util.profiling.metrics.profiling; - --import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; --import java.util.Set; --import java.util.function.Supplier; --import java.util.stream.Collectors; --import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.ActiveProfiler; --import net.minecraft.util.profiling.ProfileCollector; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; -- --public class ProfilerSamplerAdapter { -- private final Set previouslyFoundSamplerNames = new ObjectOpenHashSet<>(); -- -- public Set newSamplersFoundInProfiler(Supplier profilerSupplier) { -- Set set = profilerSupplier.get() -- .getChartedPaths() -- .stream() -- .filter(target -> !this.previouslyFoundSamplerNames.contains(target.getLeft())) -- .map(target -> samplerForProfilingPath(profilerSupplier, target.getLeft(), target.getRight())) -- .collect(Collectors.toSet()); -- -- for (MetricSampler metricSampler : set) { -- this.previouslyFoundSamplerNames.add(metricSampler.getName()); -- } -- -- return set; -- } -- -- private static MetricSampler samplerForProfilingPath(Supplier profilerSupplier, String id, MetricCategory type) { -- return MetricSampler.create(id, type, () -> { -- ActiveProfiler.PathEntry pathEntry = profilerSupplier.get().getEntry(id); -- return pathEntry == null ? 0.0 : (double)pathEntry.getMaxDuration() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND; -- }); -- } --} -+@Deprecated(forRemoval = true) interface ProfilerSamplerAdapter {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java -index c82ea3278c9631f0575a57ff1000fea4fbfa1fd9..dc65068e952c604ac67c8b1e8f3341437a2b3410 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/profiling/ServerMetricsSamplersProvider.java -@@ -1,106 +1,3 @@ - package net.minecraft.util.profiling.metrics.profiling; - --import com.google.common.base.Stopwatch; --import com.google.common.base.Ticker; --import com.google.common.collect.ImmutableSet; --import com.google.common.collect.ImmutableSet.Builder; --import com.mojang.logging.LogUtils; --import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; --import java.util.Set; --import java.util.concurrent.TimeUnit; --import java.util.function.LongSupplier; --import java.util.function.Supplier; --import java.util.function.ToDoubleFunction; --import java.util.stream.IntStream; --import net.minecraft.SystemReport; --import net.minecraft.util.profiling.ProfileCollector; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.MetricsSamplerProvider; --import org.slf4j.Logger; --import oshi.SystemInfo; --import oshi.hardware.CentralProcessor; -- --public class ServerMetricsSamplersProvider implements MetricsSamplerProvider { -- private static final Logger LOGGER = LogUtils.getLogger(); -- private final Set samplers = new ObjectOpenHashSet<>(); -- private final ProfilerSamplerAdapter samplerFactory = new ProfilerSamplerAdapter(); -- -- public ServerMetricsSamplersProvider(LongSupplier nanoTimeSupplier, boolean includeSystem) { -- this.samplers.add(tickTimeSampler(nanoTimeSupplier)); -- if (includeSystem) { -- this.samplers.addAll(runtimeIndependentSamplers()); -- } -- } -- -- public static Set runtimeIndependentSamplers() { -- Builder builder = ImmutableSet.builder(); -- -- try { -- ServerMetricsSamplersProvider.CpuStats cpuStats = new ServerMetricsSamplersProvider.CpuStats(); -- IntStream.range(0, cpuStats.nrOfCpus) -- .mapToObj(index -> MetricSampler.create("cpu#" + index, MetricCategory.CPU, () -> cpuStats.loadForCpu(index))) -- .forEach(builder::add); -- } catch (Throwable var2) { -- LOGGER.warn("Failed to query cpu, no cpu stats will be recorded", var2); -- } -- -- builder.add( -- MetricSampler.create( -- "heap MiB", MetricCategory.JVM, () -> (double)SystemReport.sizeInMiB(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) -- ) -- ); -- builder.addAll(MetricsRegistry.INSTANCE.getRegisteredSamplers()); -- return builder.build(); -- } -- -- @Override -- public Set samplers(Supplier profilerSupplier) { -- this.samplers.addAll(this.samplerFactory.newSamplersFoundInProfiler(profilerSupplier)); -- return this.samplers; -- } -- -- public static MetricSampler tickTimeSampler(LongSupplier nanoTimeSupplier) { -- Stopwatch stopwatch = Stopwatch.createUnstarted(new Ticker() { -- @Override -- public long read() { -- return nanoTimeSupplier.getAsLong(); -- } -- }); -- ToDoubleFunction toDoubleFunction = watch -> { -- if (watch.isRunning()) { -- watch.stop(); -- } -- -- long l = watch.elapsed(TimeUnit.NANOSECONDS); -- watch.reset(); -- return (double)l; -- }; -- MetricSampler.ValueIncreasedByPercentage valueIncreasedByPercentage = new MetricSampler.ValueIncreasedByPercentage(2.0F); -- return MetricSampler.builder("ticktime", MetricCategory.TICK_LOOP, toDoubleFunction, stopwatch) -- .withBeforeTick(Stopwatch::start) -- .withThresholdAlert(valueIncreasedByPercentage) -- .build(); -- } -- -- static class CpuStats { -- private final SystemInfo systemInfo = new SystemInfo(); -- private final CentralProcessor processor = this.systemInfo.getHardware().getProcessor(); -- public final int nrOfCpus = this.processor.getLogicalProcessorCount(); -- private long[][] previousCpuLoadTick = this.processor.getProcessorCpuLoadTicks(); -- private double[] currentLoad = this.processor.getProcessorCpuLoadBetweenTicks(this.previousCpuLoadTick); -- private long lastPollMs; -- -- public double loadForCpu(int index) { -- long l = System.currentTimeMillis(); -- if (this.lastPollMs == 0L || this.lastPollMs + 501L < l) { -- this.currentLoad = this.processor.getProcessorCpuLoadBetweenTicks(this.previousCpuLoadTick); -- this.previousCpuLoadTick = this.processor.getProcessorCpuLoadTicks(); -- this.lastPollMs = l; -- } -- -- return this.currentLoad[index] * 100.0; -- } -- } --} -+@Deprecated(forRemoval = true) interface ServerMetricsSamplersProvider {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java b/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java -index 8579309bf1b6ad0e42aa9431a8d274ee810911fd..31638f0a0e5c0b7a6f22cb10dbfa861efde4c178 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/storage/MetricsPersister.java -@@ -1,125 +1,3 @@ - package net.minecraft.util.profiling.metrics.storage; - --import com.mojang.logging.LogUtils; --import java.io.IOException; --import java.io.UncheckedIOException; --import java.io.Writer; --import java.nio.charset.StandardCharsets; --import java.nio.file.Files; --import java.nio.file.Path; --import java.nio.file.Paths; --import java.time.ZoneId; --import java.time.format.DateTimeFormatter; --import java.util.List; --import java.util.Locale; --import java.util.Map; --import java.util.Set; --import java.util.stream.Collectors; --import java.util.stream.Stream; --import net.minecraft.Util; --import net.minecraft.resources.ResourceLocation; --import net.minecraft.util.CsvOutput; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import org.apache.commons.io.IOUtils; --import org.slf4j.Logger; -- --public class MetricsPersister { -- public static final Path PROFILING_RESULTS_DIR = Paths.get("debug/profiling"); -- public static final String METRICS_DIR_NAME = "metrics"; -- public static final String DEVIATIONS_DIR_NAME = "deviations"; -- public static final String PROFILING_RESULT_FILENAME = "profiling.txt"; -- private static final Logger LOGGER = LogUtils.getLogger(); -- private final String rootFolderName; -- -- public MetricsPersister(String type) { -- this.rootFolderName = type; -- } -- -- public Path saveReports(Set samplers, Map> deviations, ProfileResults result) { -- try { -- Files.createDirectories(PROFILING_RESULTS_DIR); -- } catch (IOException var8) { -- throw new UncheckedIOException(var8); -- } -- -- try { -- Path path = Files.createTempDirectory("minecraft-profiling"); -- path.toFile().deleteOnExit(); -- Files.createDirectories(PROFILING_RESULTS_DIR); -- Path path2 = path.resolve(this.rootFolderName); -- Path path3 = path2.resolve("metrics"); -- this.saveMetrics(samplers, path3); -- if (!deviations.isEmpty()) { -- this.saveDeviations(deviations, path2.resolve("deviations")); -- } -- -- this.saveProfilingTaskExecutionResult(result, path2); -- return path; -- } catch (IOException var7) { -- throw new UncheckedIOException(var7); -- } -- } -- -- private void saveMetrics(Set samplers, Path directory) { -- if (samplers.isEmpty()) { -- throw new IllegalArgumentException("Expected at least one sampler to persist"); -- } else { -- Map> map = samplers.stream().collect(Collectors.groupingBy(MetricSampler::getCategory)); -- map.forEach((type, sampler) -> this.saveCategory(type, (List)sampler, directory)); -- } -- } -- -- private void saveCategory(MetricCategory type, List samplers, Path directory) { -- Path path = directory.resolve(Util.sanitizeName(type.getDescription(), ResourceLocation::validPathChar) + ".csv"); -- Writer writer = null; -- -- try { -- Files.createDirectories(path.getParent()); -- writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8); -- CsvOutput.Builder builder = CsvOutput.builder(); -- builder.addColumn("@tick"); -- -- for (MetricSampler metricSampler : samplers) { -- builder.addColumn(metricSampler.getName()); -- } -- -- CsvOutput csvOutput = builder.build(writer); -- List list = samplers.stream().map(MetricSampler::result).collect(Collectors.toList()); -- int i = list.stream().mapToInt(MetricSampler.SamplerResult::getFirstTick).summaryStatistics().getMin(); -- int j = list.stream().mapToInt(MetricSampler.SamplerResult::getLastTick).summaryStatistics().getMax(); -- -- for (int k = i; k <= j; k++) { -- int l = k; -- Stream stream = list.stream().map(data -> String.valueOf(data.valueAtTick(l))); -- Object[] objects = Stream.concat(Stream.of(String.valueOf(k)), stream).toArray(String[]::new); -- csvOutput.writeRow(objects); -- } -- -- LOGGER.info("Flushed metrics to {}", path); -- } catch (Exception var18) { -- LOGGER.error("Could not save profiler results to {}", path, var18); -- } finally { -- IOUtils.closeQuietly(writer); -- } -- } -- -- private void saveDeviations(Map> deviations, Path deviationsDirectory) { -- DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss.SSS", Locale.UK).withZone(ZoneId.systemDefault()); -- deviations.forEach( -- (sampler, sampleDeviations) -> sampleDeviations.forEach( -- deviation -> { -- String string = dateTimeFormatter.format(deviation.timestamp); -- Path path2 = deviationsDirectory.resolve(Util.sanitizeName(sampler.getName(), ResourceLocation::validPathChar)) -- .resolve(String.format(Locale.ROOT, "%d@%s.txt", deviation.tick, string)); -- deviation.profilerResultAtTick.saveResults(path2); -- } -- ) -- ); -- } -- -- private void saveProfilingTaskExecutionResult(ProfileResults result, Path directory) { -- result.saveResults(directory.resolve("profiling.txt")); -- } --} -+@Deprecated(forRemoval = true) interface MetricsPersister {} // Plazma - Completely remove Mojang's Profiler -diff --git a/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java b/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java -index f012d23b22b1a9d1acb6c020c66dc727f7fe9e1a..4ba8dd84105290674ee4c688f6912b5dd2e41f97 100644 ---- a/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java -+++ b/src/main/java/net/minecraft/util/profiling/metrics/storage/RecordedDeviation.java -@@ -1,16 +1,3 @@ - package net.minecraft.util.profiling.metrics.storage; - --import java.time.Instant; --import net.minecraft.util.profiling.ProfileResults; -- --public final class RecordedDeviation { -- public final Instant timestamp; -- public final int tick; -- public final ProfileResults profilerResultAtTick; -- -- public RecordedDeviation(Instant instant, int ticks, ProfileResults result) { -- this.timestamp = instant; -- this.tick = ticks; -- this.profilerResultAtTick = result; -- } --} -+@Deprecated(forRemoval = true) interface RecordedDeviation {} // Plazma - Completely remove Mojang's Profiler diff --git a/patches/server/0049-Completely-remove-Mojang-profiler.patch b/patches/server/0049-Completely-remove-Mojang-profiler.patch deleted file mode 100644 index a3849cb..0000000 --- a/patches/server/0049-Completely-remove-Mojang-profiler.patch +++ /dev/null @@ -1,2930 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Fri, 13 Dec 2024 13:54:02 +0900 -Subject: [PATCH] Completely remove Mojang profiler - - -diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index fe9a01e19ef182fb8e9c653fc1232ec7f13037e4..2ef4dc9169a9bec304b4922a2e91c31b966c711d 100644 ---- a/src/main/java/net/minecraft/commands/Commands.java -+++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -132,7 +132,7 @@ import net.minecraft.server.commands.WorldBorderCommand; - import net.minecraft.server.commands.data.DataCommands; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.tags.TagKey; --import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.profiling.jfr.JvmProfiler; - import net.minecraft.world.flag.FeatureFlagSet; - import net.minecraft.world.flag.FeatureFlags; -@@ -353,9 +353,11 @@ public class Commands { - // Paper end - CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource(); - -+ /* // Plazma - Completely remove Mojang profiler - Profiler.get().push(() -> { - return "/" + s; - }); -+ */ // Plazma - Completely remove Mojang profiler - ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent - - try { -@@ -384,9 +386,10 @@ public class Commands { - commandlistenerwrapper.sendFailure(Component.literal(Util.describeError(exception))); - Commands.LOGGER.error("'/{}' threw an exception", s, exception); - } -- } finally { -+ } /*finally { // Plazma - Completely remove Mojang profiler - Profiler.get().pop(); - } -+ */ // Plazma - Completely remove Mojang profiler - - } - -@@ -448,7 +451,7 @@ public class Commands { - int j = minecraftserver.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); - - try { -- ExecutionContext executioncontext1 = new ExecutionContext<>(i, j, Profiler.get()); -+ ExecutionContext executioncontext1 = new ExecutionContext<>(i, j/*, Profiler.get()*/); // Plazma - Completely remove Mojang profiler - - try { - Commands.CURRENT_EXECUTION_CONTEXT.set(executioncontext1); -diff --git a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -index f626a2f28f2aebb3237cebb6afef3c4fa1a6cb37..316fad1e5af6f9bbc1f8b8c8ff0422ded29afedd 100644 ---- a/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -+++ b/src/main/java/net/minecraft/commands/execution/ExecutionContext.java -@@ -12,7 +12,7 @@ import net.minecraft.commands.ExecutionCommandSource; - import net.minecraft.commands.execution.tasks.BuildContexts; - import net.minecraft.commands.execution.tasks.CallFunction; - import net.minecraft.commands.functions.InstantiatedFunction; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import org.slf4j.Logger; - - public class ExecutionContext implements AutoCloseable { -@@ -20,7 +20,7 @@ public class ExecutionContext implements AutoCloseable { - private static final Logger LOGGER = LogUtils.getLogger(); - private final int commandLimit; - private final int forkLimit; -- private final ProfilerFiller profiler; -+ //private final ProfilerFiller profiler; // Plazma - Completely remove Mojang profiler - @Nullable - private TraceCallbacks tracer; - private int commandQuota; -@@ -29,10 +29,10 @@ public class ExecutionContext implements AutoCloseable { - private final List> newTopCommands = new ObjectArrayList<>(); - private int currentFrameDepth; - -- public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount, ProfilerFiller profiler) { -+ public ExecutionContext(int maxCommandChainLength, int maxCommandForkCount/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler - this.commandLimit = maxCommandChainLength; - this.forkLimit = maxCommandForkCount; -- this.profiler = profiler; -+ //this.profiler = profiler; // Plazma - Completely remove Mojang profiler - this.commandQuota = maxCommandChainLength; - } - -@@ -129,9 +129,11 @@ public class ExecutionContext implements AutoCloseable { - return this.tracer; - } - -+ /* // Plazma - Completely remove Mojang profiler - public ProfilerFiller profiler() { - return this.profiler; - } -+ */ // Plazma - Completely remove Mojang profiler - - public int forkLimit() { - return this.forkLimit; -diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -index 9f5c3ec2eae9b30bdb8dbcb328d7f701cb7aeb9d..16de7288702aa7e4b0225d4eb1f3cd81289d9176 100644 ---- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -+++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java -@@ -42,52 +42,48 @@ public class BuildContexts> { - ChainModifiers chainModifiers = flags; - List list = sources; - if (contextChain.getStage() != Stage.EXECUTE) { -- context.profiler().push(() -> "prepare " + this.commandInput); -+ // Plazma start - Completely remove Mojang profiler -+ for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { -+ CommandContext commandContext = contextChain.getTopContext(); -+ if (commandContext.isForked()) { -+ chainModifiers = chainModifiers.setForked(); -+ } - -- try { -- for (int i = context.forkLimit(); contextChain.getStage() != Stage.EXECUTE; contextChain = contextChain.nextStage()) { -- CommandContext commandContext = contextChain.getTopContext(); -- if (commandContext.isForked()) { -- chainModifiers = chainModifiers.setForked(); -- } -+ RedirectModifier redirectModifier = commandContext.getRedirectModifier(); -+ if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error -+ customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); -+ return; -+ } - -- RedirectModifier redirectModifier = commandContext.getRedirectModifier(); -- if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error -- customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); -- return; -- } -+ if (redirectModifier != null) { -+ context.incrementCost(); -+ boolean bl = chainModifiers.isForked(); -+ List list2 = new ObjectArrayList<>(); -+ -+ for (T executionCommandSource : list) { -+ try { -+ Collection collection = ContextChain.runModifier( -+ commandContext, executionCommandSource, (contextx, successful, returnValue) -> { -+ }, bl -+ ); -+ if (list2.size() + collection.size() >= i) { -+ baseSource.handleError(ERROR_FORK_LIMIT_REACHED.create(i), bl, context.tracer()); -+ return; -+ } - -- if (redirectModifier != null) { -- context.incrementCost(); -- boolean bl = chainModifiers.isForked(); -- List list2 = new ObjectArrayList<>(); -- -- for (T executionCommandSource : list) { -- try { -- Collection collection = ContextChain.runModifier( -- commandContext, executionCommandSource, (contextx, successful, returnValue) -> { -- }, bl -- ); -- if (list2.size() + collection.size() >= i) { -- baseSource.handleError(ERROR_FORK_LIMIT_REACHED.create(i), bl, context.tracer()); -- return; -- } -- -- list2.addAll(collection); -- } catch (CommandSyntaxException var20) { -- executionCommandSource.handleError(var20, bl, context.tracer()); -- if (!bl) { -- return; -- } -+ list2.addAll(collection); -+ } catch (CommandSyntaxException var20) { -+ executionCommandSource.handleError(var20, bl, context.tracer()); -+ if (!bl) { -+ return; - } - } -- -- list = list2; - } -+ -+ list = list2; - } -- } finally { -- context.profiler().pop(); - } -+ // Plazma end - Completely remove Mojang profiler - } - - if (list.isEmpty()) { -diff --git a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -index e9775b4506909bee65a74964f0d5391a0513de1d..a72bf8986d7f93dc0b3d8830c17745cfe93001be 100644 ---- a/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -+++ b/src/main/java/net/minecraft/commands/execution/tasks/ExecuteCommand.java -@@ -23,7 +23,7 @@ public class ExecuteCommand> implements Unbo - - @Override - public void execute(T executionCommandSource, ExecutionContext executionContext, Frame frame) { -- executionContext.profiler().push(() -> "execute " + this.commandInput); -+ //executionContext.profiler().push(() -> "execute " + this.commandInput); // Plazma - Completely remove Mojang profiler - - try { - executionContext.incrementCost(); -@@ -36,8 +36,9 @@ public class ExecuteCommand> implements Unbo - } - } catch (CommandSyntaxException var9) { - executionCommandSource.handleError(var9, this.modifiers.isForked(), executionContext.tracer()); -- } finally { -+ } /*finally { // Plazma - Completely remove Mojang profiler - executionContext.profiler().pop(); - } -+ */ // Plazma - Completely remove Mojang profiler - } - } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3e0d878c3b3dcefb8f223bc93a5fc6d594998565..f8377d6165f77bc19b904ca81a0c4aa139e728b0 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -111,19 +111,19 @@ import net.minecraft.util.datafix.DataFixers; - import net.minecraft.util.debugchart.RemoteDebugSampleType; - import net.minecraft.util.debugchart.SampleLogger; - import net.minecraft.util.debugchart.TpsDebugDimensions; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; --import net.minecraft.util.profiling.ResultField; --import net.minecraft.util.profiling.SingleTickProfiler; -+//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ResultField; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.SingleTickProfiler; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.profiling.jfr.JvmProfiler; - import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; --import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; --import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; -+//import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.profiling.InactiveMetricsRecorder; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.profiling.MetricsRecorder; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvider; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.thread.ReentrantBlockableEventLoop; - import net.minecraft.world.Difficulty; - import net.minecraft.world.RandomSequences; -@@ -229,13 +229,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); -- private MetricsRecorder metricsRecorder; -- private Consumer onMetricsRecordingStopped; -- private Consumer onMetricsRecordingFinished; -- private boolean willStartRecordingMetrics; -- @Nullable -- private MinecraftServer.TimeProfiler debugCommandProfiler; -- private boolean debugCommandProfilerDelayStart; -+ //private MetricsRecorder metricsRecorder; // Plazma - Completely remove Mojang profiler -+ //private Consumer onMetricsRecordingStopped; // Plazma - Completely remove Mojang profiler -+ //private Consumer onMetricsRecordingFinished; // Plazma - Completely remove Mojang profiler -+ //private boolean willStartRecordingMetrics; // Plazma - Completely remove Mojang profiler -+ //@Nullable // Plazma - Completely remove Mojang profiler -+ //private MinecraftServer.TimeProfiler debugCommandProfiler; // Plazma - Completely remove Mojang profiler -+ //private boolean debugCommandProfilerDelayStart; // Plazma - Completely remove Mojang profiler - private ServerConnectionListener connection; - public final ChunkProgressListenerFactory progressListenerFactory; - @Nullable -@@ -435,12 +435,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - this.stopRecordingMetrics(); - }; - this.onMetricsRecordingFinished = (path) -> { - }; -+ */ // Plazma - Completely remove Mojang profiler - this.random = RandomSource.create(); - this.port = -1; - this.levels = Maps.newLinkedHashMap(); -@@ -1055,9 +1057,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- return false; -- } : this::haveTime); -- // Paper start - rewrite chunk system -- final Throwable crash = this.chunkSystemCrash; -- if (crash != null) { -- this.chunkSystemCrash = null; -- throw new RuntimeException("Chunk system crash propagated to tick()", crash); -- } -- // Paper end - rewrite chunk system -- this.tickFrame.end(); -- gameprofilerfiller.popPush("nextTickWait"); -- this.mayHaveDelayedTasks = true; -- this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos); -- // Pufferfish start - tps catchup -- if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup || !gg.pufferfish.pufferfish.PufferfishConfig.tpsCatchup) { // Purpur -- this.nextTickTimeNanos = currentTime + i; -- this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos; -- } -- // Pufferfish end -- this.startMeasuringTaskExecutionTime(); -- this.waitUntilNextTick(); -- this.finishMeasuringTaskExecutionTime(); -- if (flag) { -- this.tickRateManager.endTickWork(); -- } -- -- gameprofilerfiller.pop(); -- this.logFullTickTime(); -- } catch (Throwable throwable) { -- if (profiler_a != null) { -- try { -- profiler_a.close(); -- } catch (Throwable throwable1) { -- throwable.addSuppressed(throwable1); -- } -- } -- -- throw throwable; -- } -- -- if (profiler_a != null) { -- profiler_a.close(); -- } -- } finally { -- this.endMetricsRecordingTick(); -+ // Plazma start - Completely remove Mojang profiler -+ this.tickFrame.start(); -+ this.tickServer(flag ? () -> false : this::haveTime); -+ // Paper start - rewrite chunk system -+ final Throwable crash = this.chunkSystemCrash; -+ if (crash != null) { -+ this.chunkSystemCrash = null; -+ throw new RuntimeException("Chunk system crash propagated to tick()", crash); -+ } -+ // Paper end - rewrite chunk system -+ this.tickFrame.end(); -+ -+ this.mayHaveDelayedTasks = true; -+ this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos); -+ // Pufferfish start - tps catchup -+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup) { // Purpur // Plazma - nice code purpur -+ this.nextTickTimeNanos = currentTime + i; -+ this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos; - } -+ // Pufferfish end -+ this.startMeasuringTaskExecutionTime(); -+ this.waitUntilNextTick(); -+ this.finishMeasuringTaskExecutionTime(); -+ if (flag) this.tickRateManager.endTickWork(); -+ -+ this.logFullTickTime(); -+ // Plazma end - Completely remove Mojang profiler - - this.isReady = true; - JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); -@@ -1623,7 +1601,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; - try { - this.isSaving = true; -@@ -1742,10 +1720,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - entityplayer.connection.suspendFlushing(); -@@ -1869,9 +1847,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - Ridables - -+ /* // Plazma - Completely remove Mojang profiler - gameprofilerfiller.push(() -> { - String s = String.valueOf(worldserver); - - return s + " " + String.valueOf(worldserver.dimension().location()); - }); -+ */ // Plazma - Completely remove Mojang profiler - /* Drop global time updates - if (this.tickCount % 20 == 0) { - gameprofilerfiller.push("timeSync"); -@@ -1923,7 +1903,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { // Plazma - Remove persist 'isClientSide' flag -- this.executeBlocking(() -> { -- this.saveDebugReport(path.resolve("server")); -- }); -- this.onMetricsRecordingFinished.accept(path); -- }); -- this.willStartRecordingMetrics = false; -- } -- -- this.metricsRecorder.startTick(); -- return SingleTickProfiler.decorateFiller(this.metricsRecorder.getProfiler(), SingleTickProfiler.createTickProfiler("Server")); -+ throw new UnsupportedOperationException("Profiler not supported"); // Plazma - compiler fix - } - - public void endMetricsRecordingTick() { -@@ -2984,6 +2953,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop prepared, ResourceManager manager, ProfilerFiller profiler) { -+ protected void apply(Map prepared, ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler - Builder builder = ImmutableMap.builder(); - - prepared.forEach((minecraftkey, advancement) -> { -diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java -index 0b348f701b61c7b7ed0190eff8b2d73f3a3d5c74..c7f64b3aed44591d282760785ee9c83b93bd6e32 100644 ---- a/src/main/java/net/minecraft/server/ServerFunctionManager.java -+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java -@@ -16,8 +16,8 @@ import net.minecraft.commands.functions.CommandFunction; - import net.minecraft.commands.functions.InstantiatedFunction; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.resources.ResourceLocation; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import org.slf4j.Logger; - - public class ServerFunctionManager { -@@ -54,10 +54,10 @@ public class ServerFunctionManager { - } - - private void executeTagFunctions(Collection> functions, ResourceLocation label) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - - Objects.requireNonNull(label); -- gameprofilerfiller.push(label::toString); -+ //gameprofilerfiller.push(label::toString); // Plazma - Completely remove Mojang profiler - Iterator iterator = functions.iterator(); - - while (iterator.hasNext()) { -@@ -66,15 +66,17 @@ public class ServerFunctionManager { - this.execute(commandfunction, this.getGameLoopSender()); - } - -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler - } - - public void execute(CommandFunction function, CommandSourceStack source) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -+ /* // Plazma - Completely remove Mojang profiler - gameprofilerfiller.push(() -> { - return "function " + String.valueOf(function.id()); - }); -+ */ // Plazma - Completely remove Mojang profiler - - try { - InstantiatedFunction instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher()); -@@ -86,9 +88,9 @@ public class ServerFunctionManager { - ; - } catch (Exception exception) { - ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception); -- } finally { -+ } /*finally { // Plazma - Completely remove Mojang profiler - gameprofilerfiller.pop(); -- } -+ }*/ // Plazma - Completely remove Mojang profiler - - } - -diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java -index c3374d11753d8cd152784727bf7ed08d18931136..d343e463363aeb4307ce0dcf24784ebc322bf7aa 100644 ---- a/src/main/java/net/minecraft/server/commands/DebugCommand.java -+++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java -@@ -35,8 +35,9 @@ import net.minecraft.network.chat.Component; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.server.MinecraftServer; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.ProfileResults; -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profiler - import org.apache.commons.io.IOUtils; -+import org.bukkit.command.CommandSender; - import org.slf4j.Logger; - - public class DebugCommand { -@@ -52,8 +53,8 @@ public class DebugCommand { - dispatcher.register( - Commands.literal("debug") - .requires(source -> source.hasPermission(3)) -- .then(Commands.literal("start").executes(context -> start(context.getSource()))) -- .then(Commands.literal("stop").executes(context -> stop(context.getSource()))) -+ //.then(Commands.literal("start").executes(context -> start(context.getSource()))) // Plazma - Completely remove Mojang profiler -+ //.then(Commands.literal("stop").executes(context -> stop(context.getSource()))) // Plazma - Completely remove Mojang profiler - .then( - Commands.literal("function") - .requires(source -> source.hasPermission(3)) -@@ -66,6 +67,7 @@ public class DebugCommand { - ); - } - -+ /* // Plazma - Completely remove Mojang profiler - private static int start(CommandSourceStack source) throws CommandSyntaxException { - MinecraftServer minecraftServer = source.getServer(); - if (minecraftServer.isTimeProfilerRunning()) { -@@ -97,6 +99,7 @@ public class DebugCommand { - return (int)e; - } - } -+ */ // Plazma - Completely remove Mojang profiler - - static class TraceCustomExecutor - extends CustomCommandExecutor.WithErrorHandling -diff --git a/src/main/java/net/minecraft/server/commands/PerfCommand.java b/src/main/java/net/minecraft/server/commands/PerfCommand.java -index 8c587f829c5e8c6b6df3150024c4ae704988c47b..818c6730aeed88438cd77289a8aa5c5726a1fe0f 100644 ---- a/src/main/java/net/minecraft/server/commands/PerfCommand.java -+++ b/src/main/java/net/minecraft/server/commands/PerfCommand.java -@@ -19,9 +19,9 @@ import net.minecraft.network.chat.Component; - import net.minecraft.server.MinecraftServer; - import net.minecraft.util.FileZipper; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; -+//import net.minecraft.util.profiling.EmptyProfileResults; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfileResults; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.storage.MetricsPersister; // Plazma - Completely remove Mojang profiler - import org.apache.commons.io.FileUtils; - import org.slf4j.Logger; - -@@ -36,11 +36,12 @@ public class PerfCommand { - dispatcher.register( - Commands.literal("perf") - .requires(source -> source.hasPermission(4)) -- .then(Commands.literal("start").executes(context -> startProfilingDedicatedServer(context.getSource()))) -- .then(Commands.literal("stop").executes(context -> stopProfilingDedicatedServer(context.getSource()))) -+ //.then(Commands.literal("start").executes(context -> startProfilingDedicatedServer(context.getSource()))) // Plazma - Completely remove Mojang profiler -+ //.then(Commands.literal("stop").executes(context -> stopProfilingDedicatedServer(context.getSource()))) // Plazma - Completely remove Mojang profiler - ); - } - -+ /* // Plazma - Completely remove Mojang profiler - private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { - MinecraftServer minecraftServer = source.getServer(); - if (minecraftServer.isRecordingMetrics()) { -@@ -104,4 +105,5 @@ public class PerfCommand { - ); - } - } -+ */ // Plazma - Completely remove Mojang profiler - } -diff --git a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -index 7ea8c13c9993576c1408e710d3ceb9947b09090d..6db0eb0c3f7190840c39bd5ca1027f60c40948f4 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -+++ b/src/main/java/net/minecraft/server/level/ChunkGenerationTask.java -@@ -5,8 +5,8 @@ import java.util.List; - import java.util.concurrent.CompletableFuture; - import javax.annotation.Nullable; - import net.minecraft.util.StaticCache2D; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.Zone; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.Zone; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.chunk.ChunkAccess; - import net.minecraft.world.level.chunk.status.ChunkDependencies; -@@ -67,7 +67,7 @@ public class ChunkGenerationTask { - chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1); - } - -- this.scheduleLayer(chunkStatus, this.needsGeneration); -+ //this.scheduleLayer(chunkStatus, this.needsGeneration); // Plazma - Completely remove Mojang profiler - this.scheduledStatus = chunkStatus; - } - -@@ -112,6 +112,7 @@ public class ChunkGenerationTask { - return this.cache.get(this.pos.x, this.pos.z); - } - -+ /* // Plazma - Completely remove Mojang profiler - private void scheduleLayer(ChunkStatus targetStatus, boolean allowGeneration) { - try (Zone zone = Profiler.get().zone("scheduleLayer")) { - zone.addText(targetStatus::getName); -@@ -127,6 +128,7 @@ public class ChunkGenerationTask { - } - } - } -+ */ // Plazma - Completely remove Mojang profiler - - private int getRadiusForLayer(ChunkStatus status, boolean generate) { - ChunkPyramid chunkPyramid = generate ? ChunkPyramid.GENERATION_PYRAMID : ChunkPyramid.LOADING_PYRAMID; -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index cfeeddf2cb4ff50dbc29c6913e78ca1dee076790..af7d150e77001c514e306b4fb1369aae0569d494 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -65,8 +65,8 @@ import net.minecraft.server.network.ServerPlayerConnection; - import net.minecraft.util.CsvOutput; - import net.minecraft.util.Mth; - import net.minecraft.util.StaticCache2D; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.util.thread.BlockableEventLoop; - import net.minecraft.util.thread.ConsecutiveExecutor; - import net.minecraft.world.entity.Entity; -@@ -406,16 +406,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } - - protected void tick(BooleanSupplier shouldKeepTicking) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("poi"); -+ //gameprofilerfiller.push("poi"); // Plazma - Completely remove Mojang profiler - this.poiManager.tick(shouldKeepTicking); -- gameprofilerfiller.popPush("chunk_unload"); -+ //gameprofilerfiller.popPush("chunk_unload"); // Plazma - Completely remove Mojang profiler - if (!this.level.noSave()) { - this.processUnloads(shouldKeepTicking); - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - public boolean hasWork() { -diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index aea9a45c0916501f71018d3250b56da435f5664e..a84faa2e82a8d33b7bfe71f174f2913b585d99e8 100644 ---- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java -+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -26,8 +26,8 @@ import net.minecraft.network.protocol.Packet; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.progress.ChunkProgressListener; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.thread.BlockableEventLoop; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.ai.village.poi.PoiManager; -@@ -446,6 +446,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.close(save, true); // Paper - rewrite chunk system - } - -+ /* // Plazma - Completely remove Mojang profiler - // CraftBukkit start - modelled on below - public void purgeUnload() { - if (true) return; // Paper - rewrite chunk system -@@ -460,27 +461,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - this.clearCache(); - } - // CraftBukkit end -+ */ // Plazma - Completely remove Mojang profiler - - @Override - public void tick(BooleanSupplier shouldKeepTicking, boolean tickChunks) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("purge"); -+ //gameprofilerfiller.push("purge"); // Plazma - Completely remove Mojang profiler - if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot - this.distanceManager.purgeStaleTickets(); - } - - this.runDistanceManagerUpdates(); -- gameprofilerfiller.popPush("chunks"); -+ //gameprofilerfiller.popPush("chunks"); // Plazma - Completely remove Mojang profiler - if (tickChunks) { - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().tick(); // Paper - rewrite chunk system - this.tickChunks(); - this.chunkMap.tick(); - } - -- gameprofilerfiller.popPush("unload"); -+ //gameprofilerfiller.popPush("unload"); // Plazma - Completely remove Mojang profiler - this.chunkMap.tick(shouldKeepTicking); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - this.clearCache(); - } - -@@ -490,29 +492,29 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - - this.lastInhabitedUpdate = i; - if (!this.level.isDebug()) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("pollingChunks"); -+ //gameprofilerfiller.push("pollingChunks"); // Plazma - Completely remove Mojang profiler - if (this.level.tickRateManager().runsNormally()) { - List list = this.tickingChunks; - - try { -- gameprofilerfiller.push("filteringTickingChunks"); -+ //gameprofilerfiller.push("filteringTickingChunks"); // Plazma - Completely remove Mojang profiler - this.collectTickingChunks(list); -- gameprofilerfiller.popPush("shuffleChunks"); -+ //gameprofilerfiller.popPush("shuffleChunks"); // Plazma - Completely remove Mojang profiler - // Paper start - chunk tick iteration optimisation - this.shuffleRandom.setSeed(this.level.random.nextLong()); - if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled - // Paper end - chunk tick iteration optimisation -- this.tickChunks(gameprofilerfiller, j, list); -- gameprofilerfiller.pop(); -+ this.tickChunks(/*gameprofilerfiller,*/ j, list); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } finally { - list.clear(); - } - } - -- this.broadcastChangedChunks(gameprofilerfiller); -- gameprofilerfiller.pop(); -+ this.broadcastChangedChunks(/*gameprofilerfiller*/); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - // Pufferfish start - optimize mob spawning -@@ -553,8 +555,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Pufferfish end - } - -- private void broadcastChangedChunks(ProfilerFiller profiler) { -- profiler.push("broadcast"); -+ private void broadcastChangedChunks(/*ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler -+ //profiler.push("broadcast"); // Plazma - Completely remove Mojang profiler - Iterator iterator = this.chunkHoldersToBroadcast.iterator(); - - while (iterator.hasNext()) { -@@ -567,7 +569,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } - - this.chunkHoldersToBroadcast.clear(); -- profiler.pop(); -+ //profiler.pop(); // Plazma - Completely remove Mojang profiler - } - - private void collectTickingChunks(List chunks) { -@@ -593,8 +595,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Paper end - chunk tick iteration optimisation - } - -- private void tickChunks(ProfilerFiller profiler, long timeDelta, List chunks) { -- profiler.popPush("naturalSpawnCount"); -+ private void tickChunks(/*ProfilerFiller profiler,*/ long timeDelta, List chunks) { -+ //profiler.popPush("naturalSpawnCount"); // Plazma - Completely remove Mojang profiler - int j = this.distanceManager.getNaturalSpawnChunkCount(); - // Paper start - Optional per player mob spawns - final int naturalSpawnChunkCount = j; -@@ -626,7 +628,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Paper end - Optional per player mob spawns - - // this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously -- profiler.popPush("spawnAndTick"); -+ //profiler.popPush("spawnAndTick"); // Plazma - Completely remove Mojang profiler - boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit - int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); - List list1; -@@ -663,7 +665,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } - } - -- profiler.popPush("customSpawners"); -+ //profiler.popPush("customSpawners"); // Plazma - Completely remove Mojang profiler - if (flag) { - this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); - } -@@ -861,7 +863,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - - @Override - protected void doRunTask(Runnable task) { -- Profiler.get().incrementCounter("runTask"); -+ //Profiler.get().incrementCounter("runTask"); // Plazma - Completely remove Mojang profiler - 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 df0f52ee12eeab816c8920d6844a284239143054..518b9feb5e2494e52fe9719ddc22dce7da4db0fb 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -80,8 +80,8 @@ import net.minecraft.util.ProgressListener; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; - import net.minecraft.util.datafix.DataFixTypes; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.valueproviders.IntProvider; - import net.minecraft.util.valueproviders.UniformInt; - import net.minecraft.world.DifficultyInstance; -@@ -749,18 +749,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - - public void tick(BooleanSupplier shouldKeepTicking) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - - this.handlingTick = true; - TickRateManager tickratemanager = this.tickRateManager(); - boolean flag = tickratemanager.runsNormally(); - - if (flag) { -- gameprofilerfiller.push("world border"); -+ //gameprofilerfiller.push("world border"); // Plazma - Completely remove Mojang profiler - this.getWorldBorder().tick(); -- gameprofilerfiller.popPush("weather"); -+ //gameprofilerfiller.popPush("weather"); // Plazma - Completely remove Mojang profiler - this.advanceWeatherCycle(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); -@@ -791,30 +791,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - this.tickTime(); - } - -- gameprofilerfiller.push("tickPending"); -+ //gameprofilerfiller.push("tickPending"); // Plazma - Completely remove Mojang profiler - if (!this.isDebug() && flag) { - j = this.getGameTime(); -- gameprofilerfiller.push("blockTicks"); -+ //gameprofilerfiller.push("blockTicks"); // Plazma - Completely remove Mojang profiler - this.blockTicks.tick(j, paperConfig().environment.maxBlockTicks, this::tickBlock); // Paper - configurable max block ticks -- gameprofilerfiller.popPush("fluidTicks"); -+ //gameprofilerfiller.popPush("fluidTicks"); // Plazma - Completely remove Mojang profiler - this.fluidTicks.tick(j, paperConfig().environment.maxFluidTicks, this::tickFluid); // Paper - configurable max fluid ticks -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - -- gameprofilerfiller.popPush("raid"); -+ //gameprofilerfiller.popPush("raid"); // Plazma - Completely remove Mojang profiler - if (flag) { - this.raids.tick(); - } - -- gameprofilerfiller.popPush("chunkSource"); -+ //gameprofilerfiller.popPush("chunkSource"); // Plazma - Completely remove Mojang profiler - this.getChunkSource().tick(shouldKeepTicking, true); -- gameprofilerfiller.popPush("blockEvents"); -+ //gameprofilerfiller.popPush("blockEvents"); // Plazma - Completely remove Mojang profiler - if (flag) { - this.runBlockEvents(); - } - - this.handlingTick = false; -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - boolean flag1 = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this - - if (flag1) { -@@ -822,11 +822,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - - if (flag1 || this.emptyTime++ < 300) { -- gameprofilerfiller.push("entities"); -+ //gameprofilerfiller.push("entities"); // Plazma - Completely remove Mojang profiler - if (this.dragonFight != null && flag) { -- gameprofilerfiller.push("dragonFight"); -+ //gameprofilerfiller.push("dragonFight"); // Plazma - Completely remove Mojang profiler - this.dragonFight.tick(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - org.spigotmc.ActivationRange.activateEntities(this); // Spigot -@@ -834,9 +834,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - entity.activatedPriorityReset = false; // Pufferfish - DAB - if (!entity.isRemoved()) { - if (!tickratemanager.isEntityFrozen(entity)) { -- gameprofilerfiller.push("checkDespawn"); -+ //gameprofilerfiller.push("checkDespawn"); // Plazma - Completely remove Mojang profiler - entity.checkDespawn(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - if (true) { // Paper - rewrite chunk system - Entity entity1 = entity.getVehicle(); - -@@ -848,7 +848,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - entity.stopRiding(); - } - -- gameprofilerfiller.push("tick"); -+ //gameprofilerfiller.push("tick"); // Plazma - Completely remove Mojang profiler - // Pufferfish start - copied from this.guardEntityTick - try { - this.tickNonPassenger(entity); // Pufferfish - changed -@@ -863,18 +863,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - this.moonrise$midTickTasks(); // Paper - rewrite chunk system - // Pufferfish end -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - } - } - }); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - this.tickBlockEntities(); - } - -- gameprofilerfiller.push("entityManagement"); -+ //gameprofilerfiller.push("entityManagement"); // Plazma - Completely remove Mojang profiler - // Paper - rewrite chunk system -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - @Override -@@ -890,9 +890,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - long i = this.levelData.getGameTime() + 1L; - - this.serverLevelData.setGameTime(i); -- Profiler.get().push("scheduledFunctions"); -+ //Profiler.get().push("scheduledFunctions"); // Plazma - Completely remove Mojang profiler - this.serverLevelData.getScheduledEvents().tick(this.server, i); -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler - if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { - // Purpur start - Configurable daylight cycle - int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -@@ -1001,9 +1001,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - boolean flag = this.isRaining(); - int j = chunkcoordintpair.getMinBlockX(); - int k = chunkcoordintpair.getMinBlockZ(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); - -- gameprofilerfiller.push("thunder"); -+ //gameprofilerfiller.push("thunder"); // Plazma - Completely remove Mojang profiler - if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && /*simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0*/ chunk.shouldDoLightning(this.simpleRandom)) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking // Pufferfish - replace random with shouldDoLightning - BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); - -@@ -1040,7 +1040,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } - -- gameprofilerfiller.popPush("iceandsnow"); -+ //gameprofilerfiller.popPush("iceandsnow"); // Plazma - Completely remove Mojang profiler - - if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow - for (int l = 0; l < randomTickSpeed; ++l) { -@@ -1050,12 +1050,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } // Paper - Option to disable ice and snow - -- gameprofilerfiller.popPush("tickBlocks"); -+ //gameprofilerfiller.popPush("tickBlocks"); // Plazma - Completely remove Mojang profiler - if (randomTickSpeed > 0) { - this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - @VisibleForTesting -@@ -1388,19 +1388,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - }*/ // Paper - comment out EAR 2 - // Spigot end - entity.setOldPosAndRot(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - - ++entity.tickCount; -+ /* // Plazma - Completely remove Mojang profiler - gameprofilerfiller.push(() -> { - return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); - }); -- gameprofilerfiller.incrementCounter("tickNonPassenger"); -+ */ // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Plazma - Completely remove Mojang profiler - final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); // Paper - EAR 2 - if (isActive) { // Paper - EAR 2 - entity.tick(); - entity.postTick(); // CraftBukkit - } else { entity.inactiveTick(); } // Paper - EAR 2 -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - Iterator iterator = entity.getPassengers().iterator(); - - while (iterator.hasNext()) { -@@ -1423,12 +1425,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - if (passenger instanceof Player || this.entityTickList.contains(passenger)) { - passenger.setOldPosAndRot(); - ++passenger.tickCount; -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); - -+ /* // Plazma - Completely remove Mojang profiler - gameprofilerfiller.push(() -> { - return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); - }); -- gameprofilerfiller.incrementCounter("tickPassenger"); -+ */ // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.incrementCounter("tickPassenger"); // Plazma - Completely remove Mojang profiler - // Paper start - EAR 2 - if (isActive) { - passenger.rideTick(); -@@ -1440,7 +1444,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - vehicle.positionRider(passenger); - } - // Paper end - EAR 2 -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - Iterator iterator = passenger.getPassengers().iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6f39fd99ffb28d6c0267f4251c54af0c519289db..98f3f1d5319821c24920aabc27029c7f5fd58fd1 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -101,8 +101,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.damagesource.DamageTypes; - import net.minecraft.world.effect.MobEffectInstance; -@@ -1664,15 +1664,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple - this.unsetRemoved(); - */ - // CraftBukkit end -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("moving"); -+ //gameprofilerfiller.push("moving"); // Plazma - Completely remove Mojang profiler - if (worldserver != null && resourcekey == LevelStem.OVERWORLD && worldserver.getTypeKey() == LevelStem.NETHER) { // CraftBukkit - empty to fall through to null to event - this.enteredNetherPosition = this.position(); - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("placing"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("placing"); // Plazma - Completely remove Mojang profiler - // CraftBukkit start - this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds - LevelData worlddata = worldserver.getLevelData(); -@@ -1690,7 +1690,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple - this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event - this.connection.resetPosition(); - worldserver.addDuringTeleport(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - this.triggerDimensionChangeTriggers(worldserver1); - this.stopUsingItem(); - this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); -diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 10120b2ac4c4aea480ee4bb23b3203bad74dc9ae..24cd8ae3018d93e0f25834407a98804dddfe2cd7 100644 ---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -30,7 +30,7 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ClientInformation; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.thread.BlockableEventLoop; - import org.slf4j.Logger; - -@@ -275,7 +275,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - - protected void keepConnectionAlive() { -- Profiler.get().push("keepAlive"); -+ //Profiler.get().push("keepAlive"); // Plazma - Completely remove Mojang profiler - // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings - // This should effectively place the keepalive handling back to "as it was" before 1.12.2 - long currentTime = Util.getMillis(); -@@ -308,7 +308,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings - -- Profiler.get().pop(); -+ //Profiler.get().pop(); // Plazma - Completely remove Mojang profiler - } - - private boolean checkIfClosed(long time) { -diff --git a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index 5a2b07340c63577f6d32c0658ce5f9b616c82f91..9245d2010c8d0579fe58f7eab4acd7ed1891d8dc 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -+++ b/src/main/java/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -@@ -9,8 +9,8 @@ import java.util.concurrent.TimeUnit; - import java.util.concurrent.atomic.AtomicLong; - import net.minecraft.Util; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import org.slf4j.Logger; - - public class ProfiledReloadInstance extends SimpleReloadInstance { -@@ -51,12 +51,12 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push(string); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push(string); // Plazma - Completely remove Mojang profiler - long l = Util.getNanos(); - runnable.run(); - atomicLong.addAndGet(Util.getNanos() - l); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - }); - } - -diff --git a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index d2d82e4f22bfeac8881b6815e4bef56c254fded9..3e307274084df5304e801acdde2ae3b8f75ce8d6 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -@@ -3,8 +3,8 @@ package net.minecraft.server.packs.resources; - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - - public interface ResourceManagerReloadListener extends PreparableReloadListener { - @Override -@@ -12,10 +12,10 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener - PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor - ) { - return synchronizer.wait(Unit.INSTANCE).thenRunAsync(() -> { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("listener"); -+ //ProfilerFiller profilerFiller = Profiler.get(); -+ //profilerFiller.push("listener"); - this.onResourceManagerReload(manager); -- profilerFiller.pop(); -+ //profilerFiller.pop(); - }, applyExecutor); - } - -diff --git a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -index b6b79e6482d04098b4086bc307a83921df322760..83f309323586f96a97246b65e25e1592b9cd3395 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -17,7 +17,7 @@ import net.minecraft.core.Registry; - import net.minecraft.resources.FileToIdConverter; - import net.minecraft.resources.ResourceKey; - import net.minecraft.resources.ResourceLocation; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import org.slf4j.Logger; - - public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { -@@ -41,7 +41,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparab - } - - @Override -- protected Map prepare(ResourceManager resourceManager, ProfilerFiller profilerFiller) { -+ protected Map prepare(ResourceManager resourceManager/*, ProfilerFiller profilerFiller*/) { // Plazma - Completely remove Mojang profiler - Map map = new HashMap<>(); - scanDirectory(resourceManager, this.lister, this.ops, this.codec, map); - return map; -diff --git a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -index 0aaab6a2a10bf012c9d275f7cee2095c8fbb8809..524417d6726249a06371918155a94add2d421b98 100644 ---- a/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -+++ b/src/main/java/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -@@ -2,20 +2,20 @@ package net.minecraft.server.packs.resources; - - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - - public abstract class SimplePreparableReloadListener implements PreparableReloadListener { - @Override - public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor - ) { -- return CompletableFuture.supplyAsync(() -> this.prepare(manager, Profiler.get()), prepareExecutor) -+ return CompletableFuture.supplyAsync(() -> this.prepare(manager/*, Profiler.get()*/), prepareExecutor) // Plazma - Completely remove Mojang profiler - .thenCompose(synchronizer::wait) -- .thenAcceptAsync(prepared -> this.apply((T)prepared, manager, Profiler.get()), applyExecutor); -+ .thenAcceptAsync(prepared -> this.apply((T)prepared, manager/*, Profiler.get()*/), applyExecutor); // Plazma - Completely remove Mojang profiler - } - -- protected abstract T prepare(ResourceManager manager, ProfilerFiller profiler); -+ protected abstract T prepare(ResourceManager manager/*, ProfilerFiller profiler*/); // Plazma - Completely remove Mojang profiler - -- protected abstract void apply(T prepared, ResourceManager manager, ProfilerFiller profiler); -+ protected abstract void apply(T prepared, ResourceManager manager/*, ProfilerFiller profiler*/); // Plazma - Completely remove Mojang profiler - } -diff --git a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -index 805532c7acc4ad81b83e305d669f5cee0e7597e9..f37e42621b50d183c17efdda14211736fc7968c9 100644 ---- a/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -+++ b/src/main/java/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -@@ -7,13 +7,13 @@ import java.util.concurrent.Executor; - import java.util.concurrent.RejectedExecutionException; - import java.util.concurrent.atomic.AtomicReference; - import net.minecraft.Util; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.ProfilerMeasured; -+//import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.MetricSampler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.metrics.ProfilerMeasured; // Plazma - Completely remove Mojang profiler - import org.slf4j.Logger; - --public abstract class AbstractConsecutiveExecutor implements ProfilerMeasured, TaskScheduler, Runnable { -+public abstract class AbstractConsecutiveExecutor implements /*ProfilerMeasured,*/ TaskScheduler, Runnable { // Plazma - Completely remove Mojang profiler - private static final Logger LOGGER = LogUtils.getLogger(); - private final AtomicReference status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING); - private final StrictQueue queue; -@@ -24,7 +24,7 @@ public abstract class AbstractConsecutiveExecutor implements - this.executor = executor; - this.queue = queue; - this.name = name; -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler - } - - private boolean canBeScheduled() { -@@ -108,10 +108,12 @@ public abstract class AbstractConsecutiveExecutor implements - return this.name; - } - -+ /* // Plazma - Completely remove Mojang profiler - @Override - public List profiledMetrics() { - return ImmutableList.of(MetricSampler.create(this.name + "-queue-size", MetricCategory.CONSECUTIVE_EXECUTORS, this::size)); - } -+ */ // Plazma - Completely remove Mojang profiler - - private boolean setRunning() { - return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING); -diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index 9b706276dc5b5f55b966c5472c6c4e864342b916..d8efe335be1808422abef6d7ba094c9a3a4f3be3 100644 ---- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -15,13 +15,13 @@ import java.util.function.Supplier; - import javax.annotation.CheckReturnValue; - import net.minecraft.ReportedException; - import net.minecraft.SharedConstants; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.ProfilerMeasured; -+//import net.minecraft.util.profiling.metrics.MetricCategory; -+//import net.minecraft.util.profiling.metrics.MetricSampler; -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; -+//import net.minecraft.util.profiling.metrics.ProfilerMeasured; - import org.slf4j.Logger; - --public abstract class BlockableEventLoop implements ProfilerMeasured, TaskScheduler, Executor { -+public abstract class BlockableEventLoop implements /*ProfilerMeasured,*/ TaskScheduler, Executor { // Plazma - Completely remove Mojang profiler - public static final long BLOCK_TIME_NANOS = 100000L; - private final String name; - private static final Logger LOGGER = LogUtils.getLogger(); -@@ -30,7 +30,7 @@ public abstract class BlockableEventLoop implements Profiler - - protected BlockableEventLoop(String name) { - this.name = name; -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler - } - - protected abstract boolean shouldRun(R task); -@@ -160,10 +160,12 @@ public abstract class BlockableEventLoop implements Profiler - } - } - -+ /* // Plazma - Completely remove Mojang profiler - @Override - public List profiledMetrics() { - return ImmutableList.of(MetricSampler.create(this.name + "-pending-tasks", MetricCategory.EVENT_LOOPS, this::getPendingTasksCount)); - } -+ */ // Plazma - Completely remove Mojang profiler - - public static boolean isNonRecoverable(Throwable exception) { - return exception instanceof ReportedException reportedException -diff --git a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -index c67846e4d5583d79c6e9760c10d2581f0d54f45c..fdace9b3dedcd2c0879ea4ef30657d9d0e37ad7e 100644 ---- a/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -+++ b/src/main/java/net/minecraft/util/thread/PriorityConsecutiveExecutor.java -@@ -3,12 +3,12 @@ package net.minecraft.util.thread; - import java.util.concurrent.CompletableFuture; - import java.util.concurrent.Executor; - import java.util.function.Consumer; --import net.minecraft.util.profiling.metrics.MetricsRegistry; -+//import net.minecraft.util.profiling.metrics.MetricsRegistry; // Plazma - Completely remove Mojang profiler - - public class PriorityConsecutiveExecutor extends AbstractConsecutiveExecutor { - public PriorityConsecutiveExecutor(int priorityCount, Executor executor, String name) { - super(new StrictQueue.FixedPriorityQueue(priorityCount), executor, name); -- MetricsRegistry.INSTANCE.add(this); -+ //MetricsRegistry.INSTANCE.add(this); // Plazma - Completely remove Mojang profiler - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9b5379edf00ab7256e7e90702e319de9b20ac0b4..af0b090a831205ba681012d465842b07a1b7fda9 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -84,8 +84,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.Nameable; -@@ -919,9 +919,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // CraftBukkit end - - public void baseTick() { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("entityBaseTick"); -+ //gameprofilerfiller.push("entityBaseTick"); // Plazma - Completely remove Mojang profiler - if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups - this.inBlockState = null; - if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -990,7 +990,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - public void setSharedFlagOnFire(boolean onFire) { -@@ -1221,9 +1221,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("move"); -+ //gameprofilerfiller.push("move"); // Plazma - Completely remove Mojang profiler - if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { - movement = movement.multiply(this.stuckSpeedMultiplier); - this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1232,7 +1232,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // Paper start - ignore movement changes while inactive. - if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { - setDeltaMovement(Vec3.ZERO); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - return; - } - // Paper end -@@ -1253,8 +1253,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z); - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("rest"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("rest"); // Plazma - Completely remove Mojang profiler - boolean flag = !Mth.equal(movement.x, vec3d1.x); - boolean flag1 = !Mth.equal(movement.z, vec3d1.z); - -@@ -1281,7 +1281,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - */ // Plazma - Remove persist 'isClientSide' flag - - if (this.isRemoved()) { -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } else { - if (this.horizontalCollision) { - Vec3 vec3d2 = this.getDeltaMovement(); -@@ -1330,7 +1330,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - float f = this.getBlockSpeedFactor(); - - this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - } - // Paper start - detailed watchdog information -@@ -3524,9 +3524,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.processPortalCooldown(); - if (this.portalProcess != null) { - if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("portal"); -+ //gameprofilerfiller.push("portal"); // Plazma - Completely remove Mojang profiler - this.setPortalCooldown(); - TeleportTransition teleporttransition = this.portalProcess.getPortalDestination(worldserver, this); - -@@ -3538,7 +3538,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } else if (this.portalProcess.hasExpired()) { - this.portalProcess = null; - } -@@ -4062,16 +4062,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - entity.teleport(this.calculatePassengerTransition(teleportTarget, entity)); - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("teleportSameDimension"); -+ //gameprofilerfiller.push("teleportSameDimension"); // Plazma - Completely remove Mojang profiler - this.teleportSetPosition(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); - if (!teleportTarget.asPassenger()) { - this.sendTeleportTransitionToRidingPlayers(teleportTarget); - } - - teleportTarget.postTeleportTransition().onTransition(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - return this; - } - -@@ -4093,12 +4093,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - } - -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("teleportCrossDimension"); -+ //gameprofilerfiller.push("teleportCrossDimension"); // Plazma - Completely remove Mojang profiler - entity = this.getType().create(world, EntitySpawnReason.DIMENSION_TRAVEL); - if (entity == null) { -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - return null; - } else { - // Paper start - Fix item duplication and teleport issues -@@ -4124,7 +4124,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - world.resetEmptyTime(); - teleportTarget.postTeleportTransition().onTransition(entity); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - return entity; - } - } -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 9940c74dac4ebcfacdaf88d0b1e95e78e964e1ba..d6d43ad1677d035c26619b73e5a2dd6e72ab278b 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -72,8 +72,8 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.damagesource.CombatRules; -@@ -455,9 +455,9 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - super.baseTick(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("livingEntityBaseTick"); -+ //gameprofilerfiller.push("livingEntityBaseTick"); // Plazma - Completely remove Mojang profiler - if (this.fireImmune() /*|| this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag - this.clearFire(); - } -@@ -567,7 +567,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO = this.yHeadRot; - this.yRotO = this.getYRot(); - this.xRotO = this.getXRot(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - // Pufferfish start - optimize suffocation -@@ -3451,12 +3451,12 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - this.run += (f3 - this.run) * 0.3F; -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("headTurn"); -+ //gameprofilerfiller.push("headTurn"); // Plazma - Completely remove Mojang profiler - f2 = this.tickHeadTurn(f1, f2); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("rangeChecks"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("rangeChecks"); // Plazma - Completely remove Mojang profiler - - // Paper start - stop large pitch and yaw changes from crashing the server - this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3468,7 +3468,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; - // Paper end - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - this.animStep += f2; - if (this.isFallFlying()) { - ++this.fallFlyTicks; -@@ -3700,21 +3700,21 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - this.setDeltaMovement(d0, d1, d2); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("ai"); -+ //gameprofilerfiller.push("ai"); // Plazma - Completely remove Mojang profiler - if (this.isImmobile()) { - this.jumping = false; - this.xxa = 0.0F; - this.zza = 0.0F; - } else /*if (this.isEffectiveAi())*/ { // Plazma - Remove persist 'isClientSide' flag -- gameprofilerfiller.push("newAi"); -+ //gameprofilerfiller.push("newAi"); // Plazma - Completely remove Mojang profiler - this.serverAiStep(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("jump"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("jump"); // Plazma - Completely remove Mojang profiler - if (this.jumping && this.isAffectedByFluids()) { - double d3; - -@@ -3741,8 +3741,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.noJumpDelay = 0; - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("travel"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("travel"); // Plazma - Completely remove Mojang profiler - this.xxa *= 0.98F; - this.zza *= 0.98F; - if (this.isFallFlying()) { -@@ -3775,8 +3775,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - //} // Plazma - Remove persist 'isClientSide' flag - - this.calculateEntityAnimation(this instanceof FlyingAnimal); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("freezing"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("freezing"); // Plazma - Completely remove Mojang profiler - if (/*!this.level().isClientSide &&*/ !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API // Plazma - Remove persist 'isClientSide' flag - int i = this.getTicksFrozen(); - -@@ -3797,15 +3797,15 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - } - -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("push"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("push"); // Plazma - Completely remove Mojang profiler - if (this.autoSpinAttackTicks > 0) { - --this.autoSpinAttackTicks; - this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); - } - - this.pushEntities(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - // Paper start - Add EntityMoveEvent - // Purpur start - Ridables - if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index ae1dcf013b03c6d04ccf34be4e54048581479183..af8a02ea3daaf8c147f87e5a58d25a1583490413 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -34,8 +34,8 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -@@ -369,15 +369,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - @Override - public void baseTick() { - super.baseTick(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("mobBaseTick"); -+ //gameprofilerfiller.push("mobBaseTick"); // Plazma - Completely remove Mojang profiler - if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { - this.resetAmbientSoundTime(); - this.playAmbientSound(); - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - incrementTicksSinceLastInteraction(); // Purpur - } - -@@ -712,9 +712,9 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - @Override - public void aiStep() { - super.aiStep(); -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("looting"); -+ //gameprofilerfiller.push("looting"); // Plazma - Completely remove Mojang profiler - Level world = this.level(); - - if (world instanceof ServerLevel worldserver) { -@@ -738,7 +738,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - protected Vec3i getPickupReach() { -@@ -950,49 +950,49 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - return; - } - // Paper end - Allow nerfed mobs to jump and float -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("sensing"); -+ //gameprofilerfiller.push("sensing"); // Plazma - Completely remove Mojang profiler - //this.sensing.tick(); // Plazma - moved down -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - int i = this.tickCount + this.getId(); - - if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick - if (i % 2 != 0 && this.tickCount > 1) { -- gameprofilerfiller.push("targetSelector"); -+ //gameprofilerfiller.push("targetSelector"); // Plazma - Completely remove Mojang profiler - if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.targetSelector.tickRunningGoals(false); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goalSelector"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("goalSelector"); // Plazma - Completely remove Mojang profiler - if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.goalSelector.tickRunningGoals(false); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } else { -- gameprofilerfiller.push("targetSelector"); -+ //gameprofilerfiller.push("targetSelector"); // Plazma - Completely remove Mojang profiler - if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.targetSelector.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goalSelector"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("goalSelector"); // Plazma - Completely remove Mojang profiler - if (this.goalSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking - this.goalSelector.tick(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - -- gameprofilerfiller.push("navigation"); -+ //gameprofilerfiller.push("navigation"); // Plazma - Completely remove Mojang profiler - this.navigation.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("mob tick"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("mob tick"); // Plazma - Completely remove Mojang profiler - this.customServerAiStep((ServerLevel) this.level()); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("controls"); -- gameprofilerfiller.push("move"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("controls"); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("move"); // Plazma - Completely remove Mojang profiler - this.moveControl.tick(); -- gameprofilerfiller.popPush("look"); -+ //gameprofilerfiller.popPush("look"); // Plazma - Completely remove Mojang profiler - this.lookControl.tick(); -- gameprofilerfiller.popPush("jump"); -+ //gameprofilerfiller.popPush("jump"); // Plazma - Completely remove Mojang profiler - this.jumpControl.tick(); -- gameprofilerfiller.pop(); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - this.sendDebugPackets(); - } - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 5a439e3b0fdc1010884634c1e046e49d8b9aee17..e04f1f946e0b37ea1362aa2af7ff4232cc73c123 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -7,8 +7,8 @@ import java.util.EnumSet; - import java.util.Map; - import java.util.Set; - import java.util.function.Predicate; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - - public class GoalSelector { - private static final WrappedGoal NO_GOAL = new WrappedGoal(Integer.MAX_VALUE, new Goal() { -@@ -85,8 +85,8 @@ public class GoalSelector { - } - - public void tick() { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("goalCleanup"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("goalCleanup"); // Plazma - Completely remove Mojang profiler - - for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams -@@ -95,8 +95,8 @@ public class GoalSelector { - } - - this.lockedFlags.entrySet().removeIf(entry -> !entry.getValue().isRunning()); -- profilerFiller.pop(); -- profilerFiller.push("goalUpdate"); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("goalUpdate"); // Plazma - Completely remove Mojang profiler - - for (WrappedGoal wrappedGoal2 : this.availableGoals) { - // Paper start -@@ -116,13 +116,13 @@ public class GoalSelector { - } - } - -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - this.tickRunningGoals(true); - } - - public void tickRunningGoals(boolean tickAll) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("goalTick"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("goalTick"); // Plazma - Completely remove Mojang profiler - - for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (tickAll || wrappedGoal.requiresUpdateEveryTick())) { -@@ -130,7 +130,7 @@ public class GoalSelector { - } - } - -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - } - - public Set getAvailableGoals() { -diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 99e31c8e8488ce7138c5385575cbbabe0bd7394e..ac4d7310f50340da668c0e6d63982f99d71f7e05 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -10,8 +10,8 @@ import net.minecraft.core.Vec3i; - import net.minecraft.network.protocol.game.DebugPackets; - import net.minecraft.tags.BlockTags; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.Mob; - import net.minecraft.world.entity.ai.attributes.Attributes; -@@ -189,13 +189,13 @@ public abstract class PathNavigation { - } - } - // Paper end - EntityPathfindEvent -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("pathfind"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("pathfind"); // Plazma - Completely remove Mojang profiler - BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); - int i = (int)(followRange + (float)range); - PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); - Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - // Plazma start - Process pathfinding asynchronously - if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) { - if (!positions.isEmpty()) this.targetPos = positions.iterator().next(); -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -index 116b1e251ffe68bae5c404d0823c2bc7c1afddf6..24aa626c1ccd12c6a00d004ac3af46980d3042f2 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensing.java -@@ -2,8 +2,8 @@ package net.minecraft.world.entity.ai.sensing; - - import it.unimi.dsi.fastutil.ints.IntOpenHashSet; - import it.unimi.dsi.fastutil.ints.IntSet; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.Mob; - -@@ -28,10 +28,10 @@ public class Sensing { - } else if (this.unseen.contains(i)) { - return false; - } else { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("hasLineOfSight"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("hasLineOfSight"); // Plazma - Completely remove Mojang profiler - boolean bl = this.mob.hasLineOfSight(entity); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - if (bl) { - this.seen.add(i); - } else { -diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index 502277270c38cfcbd686455552d2b54701774e5f..f63ae92412184949e085ee23c434a4bc1a236b16 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -@@ -31,8 +31,8 @@ import net.minecraft.tags.GameEventTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.SimpleContainer; -@@ -280,15 +280,15 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("allayBrain"); -+ //gameprofilerfiller.push("allayBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("allayActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("allayActivityUpdate"); // Plazma - Completely remove Mojang profiler - AllayAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index d239c8325468c72fc7acf3831115c3cdf1f77f43..ece73c0cdf7358fa0e2bdc4512fbd873c085983b 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -23,8 +23,8 @@ import net.minecraft.util.ByIdMap; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -@@ -166,15 +166,15 @@ public class Armadillo extends Animal { - private int behaviorTick; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("armadilloBrain"); -+ //gameprofilerfiller.push("armadilloBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("armadilloActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("armadilloActivityUpdate"); // Plazma - Completely remove Mojang profiler - ArmadilloAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { - this.forceDrops = true; // CraftBukkit - if (this.dropFromGiftLootTable(world, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { -diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index a38bca8cf5fbb218f8dbd2fb27705051c4d4836f..87bc28617a2c56bd4d04705885631de43a038a65 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -26,8 +26,8 @@ import net.minecraft.util.ByIdMap; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -339,15 +339,15 @@ public class Axolotl extends Animal implements VariantHolder, B - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("axolotlBrain"); -+ //gameprofilerfiller.push("axolotlBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("axolotlActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("axolotlActivityUpdate"); // Plazma - Completely remove Mojang profiler - AxolotlAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - if (!this.isNoAi()) { - Optional optional = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); - -diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 70c3bb5d0c35fa79f74f76f452e9b34ebfe8041e..6e3572c9151743b231fafcc81b56b5d114691e65 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -17,8 +17,8 @@ import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.BlockTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -169,17 +169,17 @@ public class Camel extends AbstractHorse { - private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("camelBrain"); -+ //gameprofilerfiller.push("camelBrain"); // Plazma - Completely remove Mojang profiler - Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error - - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - behaviorcontroller.tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("camelActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("camelActivityUpdate"); // Plazma - Completely remove Mojang profiler - CamelAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 963e55584c741a3a3f903f465d897c7ecbf5cd4d..3dbd2205fdabf316819d05818e9f75089bc506cf 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -28,8 +28,8 @@ import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AgeableMob; -@@ -260,14 +260,14 @@ public class Frog extends Animal implements VariantHolder> { - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("frogBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("frogBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- profilerFiller.pop(); -- profilerFiller.push("frogActivityUpdate"); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("frogActivityUpdate"); // Plazma - Completely remove Mojang profiler - FrogAi.updateActivity(this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index e5affd87506a717f4cffa9fad4873c1efbded295..f69bfc81a7990ddb9043557a767083f687aeb248 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -12,8 +12,8 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.tags.ItemTags; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -@@ -140,15 +140,15 @@ public class Tadpole extends AbstractFish { - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("tadpoleBrain"); -+ //gameprofilerfiller.push("tadpoleBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("tadpoleActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("tadpoleActivityUpdate"); // Plazma - Completely remove Mojang profiler - TadpoleAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -index 9cd08bb4e9069bb2f701ef3825ba4c5af6f56790..ea1c1fe3da78b90a3a2b5d40b17508d25eb05b03 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java -@@ -20,8 +20,8 @@ import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -230,15 +230,15 @@ public class Goat extends Animal { - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("goatBrain"); -+ //gameprofilerfiller.push("goatBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -- gameprofilerfiller.push("goatActivityUpdate"); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler -+ //gameprofilerfiller.push("goatActivityUpdate"); // Plazma - Completely remove Mojang profiler - GoatAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 5a101b5ff1f2e3f6f3882f84e219ba7c502ec462..4f9c44973a125e7a82b289f405b4451542310f5d 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -30,8 +30,8 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.ByIdMap; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.damagesource.DamageSource; -@@ -514,14 +514,14 @@ public class Sniffer extends Animal { - private int behaviorTick; // Plazma - Add missing pufferfish configurations - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("snifferBrain"); -+ //gameprofilerfiller.push("snifferBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations - this.getBrain().tick(world, this); -- gameprofilerfiller.popPush("snifferActivityUpdate"); -+ //gameprofilerfiller.popPush("snifferActivityUpdate"); // Plazma - Completely remove Mojang profiler - SnifferAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -index a933e33a1b30d53e90d10bea3dadf1f35ed94398..eae9a9d433f425e3f2e2fed727dfd00facdea262 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java -@@ -15,8 +15,8 @@ import net.minecraft.network.syncher.SynchedEntityData; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.util.valueproviders.UniformInt; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; -@@ -284,11 +284,11 @@ public class Zoglin extends Monster implements HoglinBase { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("zoglinBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("zoglinBrain"); // Plazma - Completely remove Mojang profiler - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - this.updateActivity(); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index 0f2e655eae6c6ab00cead76e256dfad5b19cbb60..2aaf70c202b3d08add495ebda0700d753bec3051 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -+++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -12,8 +12,8 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.EntityTypeTags; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AnimationState; - import net.minecraft.world.entity.Entity; -@@ -235,13 +235,13 @@ public class Breeze extends Monster { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("breezeBrain"); -+ //gameprofilerfiller.push("breezeBrain"); // Plazma - Completely remove Mojang profiler - this.getBrain().tick(world, this); -- gameprofilerfiller.popPush("breezeActivityUpdate"); -+ //gameprofilerfiller.popPush("breezeActivityUpdate"); // Plazma - Completely remove Mojang profiler - BreezeAi.updateActivity(this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -index cff47b1e136c07b0fa21efa76b7fd5675d0d0b02..5d6166a9fd22f909f8e4c2192ebe11d9ccf2043d 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -+++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -19,8 +19,8 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.tags.DamageTypeTags; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.AnimationState; - import net.minecraft.world.entity.Entity; -@@ -241,11 +241,11 @@ public class Creaking extends Monster { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("creakingBrain"); -+ //gameprofilerfiller.push("creakingBrain"); // Plazma - Completely remove Mojang profiler - this.getBrain().tick((ServerLevel) this.level(), this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - CreakingAi.updateActivity(this); - } - -diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 5ff8c677d54a9538c07425ac1a6336e17be51760..6dcdd3ef9de2a46275aee3b3580c4a5f63a3aa00 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -16,8 +16,8 @@ import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -183,12 +183,12 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - private int behaviorTick; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("hoglinBrain"); -+ //gameprofilerfiller.push("hoglinBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - HoglinAi.updateActivity(this); - if (this.isConverting()) { - ++this.timeInOverworld; -diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -index 60dadde71ae0d32dfe04d7aad282b9f17cf05823..7b090b48fa9379940728c8c737a684ba0cabae00 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -8,8 +8,8 @@ import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; - import net.minecraft.util.RandomSource; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -346,12 +346,12 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento - private int behaviorTick; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("piglinBrain"); -+ //gameprofilerfiller.push("piglinBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - PiglinAi.updateActivity(this); - super.customServerAiStep(world); - } -diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index 24e198440d4841daac664dc6c5a8a3dc6825b469..e6f642e4004ce54c5c49436315869c57f850150a 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -@@ -8,8 +8,8 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.EntitySpawnReason; -@@ -151,11 +151,11 @@ public class PiglinBrute extends AbstractPiglin { - - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("piglinBruteBrain"); -+ //ProfilerFiller profilerFiller = Profiler.get(); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.push("piglinBruteBrain"); // Plazma - Completely remove Mojang profiler - if (getRider() == null || this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(world, this); -- profilerFiller.pop(); -+ //profilerFiller.pop(); // Plazma - Completely remove Mojang profiler - PiglinBruteAi.updateActivity(this); - PiglinBruteAi.maybePlayActivitySound(this); - super.customServerAiStep(world); -diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 839a5550a6d613abf4567b32b5f1a04700d6ccf4..fdadca863827f19f8a27915fd7d2bb296064cc78 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -32,8 +32,8 @@ import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.effect.MobEffectInstance; -@@ -321,12 +321,12 @@ public class Warden extends Monster implements VibrationSystem { - private int behaviorTick = 0; // Pufferfish - @Override - protected void customServerAiStep(ServerLevel world) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("wardenBrain"); -+ //gameprofilerfiller.push("wardenBrain"); // Plazma - Completely remove Mojang profiler - if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing Purpur configurations - this.getBrain().tick(world, this); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - super.customServerAiStep(world); - if ((this.tickCount + this.getId()) % 120 == 0) { - Warden.applyDarknessAround(world, this.position(), this, 20); -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index e15d07f33db78872363f02cc5a631b7ab1255314..95d9bba10fa589c4858fd99d2cc6de3397bdcab2 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -38,8 +38,8 @@ import net.minecraft.stats.Stats; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; - import net.minecraft.util.SpawnUtil; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.Difficulty; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -@@ -349,9 +349,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - } - protected void customServerAiStep(ServerLevel world, boolean inactive) { // Purpur - not final - // Paper end - EAR 2 -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("villagerBrain"); -+ //gameprofilerfiller.push("villagerBrain"); // Plazma - Completely remove Mojang profiler - // Purpur start - if (this.level().purpurConfig.villagerLobotomizeEnabled) { - // treat as inactive if lobotomized -@@ -365,7 +365,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - this.getBrain().tick(world, this); // Paper // Purpur - Ridables - } - // Pufferfish end -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - if (this.assignProfessionWhenSpawned) { - this.assignProfessionWhenSpawned = false; - } -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 2483627f807d7a3907f6848a8bc45d7a798e746d..3f5bda2682891a15c7507ef10dbaad38f6856f5d 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -42,7 +42,7 @@ import net.minecraft.server.level.ServerLevel; - import net.minecraft.server.packs.resources.ResourceManager; - import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; - import net.minecraft.server.packs.resources.SimplePreparableReloadListener; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - - public class RecipeManager extends SimplePreparableReloadListener implements RecipeAccess { - -@@ -96,7 +96,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp - } - - @Override -- protected RecipeMap prepare(ResourceManager manager, ProfilerFiller profiler) { -+ protected RecipeMap prepare(ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler - SortedMap> sortedmap = new TreeMap(); - - SimpleJsonResourceReloadListener.scanDirectory(manager, RecipeManager.RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, sortedmap); -@@ -111,7 +111,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp - return RecipeMap.create(list); - } - -- protected void apply(RecipeMap prepared, ResourceManager manager, ProfilerFiller profiler) { -+ protected void apply(RecipeMap prepared, ResourceManager manager/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler - this.recipes = prepared; - RecipeManager.LOGGER.info("Loaded {} recipes", prepared.values().size()); - } -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9a6152fc74ba6c71b32da7519cec537e34291fa2..805db223ad83b50546c32747fc127d9fe42b34f9 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -36,8 +36,8 @@ import net.minecraft.util.AbortableIterationConsumer; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.StringRepresentable; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profilers -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profilers - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.TickRateManager; - import net.minecraft.world.damagesource.DamageSource; -@@ -276,7 +276,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - - @Override - public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers - final List ret = new java.util.ArrayList<>(); - - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -286,7 +286,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - - @Override - public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers - final List ret = new java.util.ArrayList<>(); - - ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); -@@ -1513,9 +1513,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - } - - protected void tickBlockEntities() { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profilers - -- gameprofilerfiller.push("blockEntities"); -+ //gameprofilerfiller.push("blockEntities"); // Plazma - Completely remove Mojang profilers - this.tickingBlockEntities = true; - if (!this.pendingBlockEntityTickers.isEmpty()) { - this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); -@@ -1553,7 +1553,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 - - this.tickingBlockEntities = false; -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profilers - this.spigotConfig.currentPrimedTnt = 0; // Spigot - } - -@@ -1723,7 +1723,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - - @Override - public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers - //List list = Lists.newArrayList(); // Plazma - minor optimizations - - // Paper start - rewrite chunk system -@@ -1753,7 +1753,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public void getEntities(final EntityTypeTest entityTypeTest, - final AABB boundingBox, final Predicate predicate, - final List into, final int maxCount) { -- Profiler.get().incrementCounter("getEntities"); -+ //Profiler.get().incrementCounter("getEntities"); // Plazma - Completely remove Mojang profilers - - if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { - if (maxCount != Integer.MAX_VALUE) { -diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index dc15c15951e4ca30b8341d24f813259a77f41c77..ff61aee501131c4141c79354f408d89bfdda21cd 100644 ---- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java -+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -24,8 +24,8 @@ import net.minecraft.tags.BlockTags; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; - import net.minecraft.util.VisibleForDebug; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.util.random.WeightedRandomList; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntitySpawnReason; -@@ -163,9 +163,9 @@ public final class NaturalSpawner { - } - - public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, List spawnableGroups) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("spawner"); -+ //gameprofilerfiller.push("spawner"); // Plazma - Completely remove Mojang profiler - Iterator iterator = spawnableGroups.iterator(); - - while (iterator.hasNext()) { -@@ -211,7 +211,7 @@ public final class NaturalSpawner { - } - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - // Paper start - Add mobcaps commands -diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java -index 4c7e4683c53afb0800b7f17c5964ba8ff31848d1..f894b47b228a2dc37b4486f7e5b89681cdcaa849 100644 ---- a/src/main/java/net/minecraft/world/level/ServerExplosion.java -+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java -@@ -15,8 +15,8 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.Holder; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.util.Mth; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.damagesource.DamageSource; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityType; -@@ -700,11 +700,11 @@ public class ServerExplosion implements Explosion { - - this.hurtEntities(); - if (this.interactsWithBlocks()) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("explosion_blocks"); -+ //gameprofilerfiller.push("explosion_blocks"); // Plazma - Completely remove Mojang profiler - this.interactWithBlocks(list); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - if (this.fire) { -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 2144652adb3259a4d5113fe3337e13280cda3f12..ee836953b1d6a362a3a785dc1fd0ea0416bdd984 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -26,8 +26,8 @@ import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; - import net.minecraft.server.level.FullChunkStatus; - import net.minecraft.server.level.ServerLevel; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.Level; -@@ -424,13 +424,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - } - - if (LightEngine.hasDifferentLightProperties(iblockdata1, iblockdata)) { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push("updateSkyLightSources"); -+ //gameprofilerfiller.push("updateSkyLightSources"); // Plazma - Completely remove Mojang profiler - // Paper - rewrite chunk system -- gameprofilerfiller.popPush("queueCheckLight"); -+ //gameprofilerfiller.popPush("queueCheckLight"); // Plazma - Completely remove Mojang profiler - this.level.getChunkSource().getLightEngine().checkBlock(blockposition); -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } - - boolean flag3 = iblockdata1.hasBlockEntity(); -@@ -1077,9 +1077,9 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - - if (LevelChunk.this.isTicking(blockposition)) { - try { -- ProfilerFiller gameprofilerfiller = Profiler.get(); -+ //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler - -- gameprofilerfiller.push(this::getType); -+ //gameprofilerfiller.push(this::getType); // Plazma - Completely remove Mojang profiler - BlockState iblockdata = LevelChunk.this.getBlockState(blockposition); - - if (this.blockEntity.getType().isValid(iblockdata)) { -@@ -1095,7 +1095,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - // Paper end - Remove the Block Entity if it's invalid - } - -- gameprofilerfiller.pop(); -+ //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler - } catch (Throwable throwable) { - if (throwable instanceof ThreadDeath) throw throwable; // Paper - // Paper start - Prevent block entity and entity crashes -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index 95e71c471904fc54003180632dc85398ae06d241..376d7715daee8fd97757746d6a6f1c665558c8b8 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -12,9 +12,9 @@ import java.util.function.Function; - import java.util.stream.Collectors; - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; --import net.minecraft.util.profiling.metrics.MetricCategory; -+//import net.minecraft.util.profiling.Profiler; -+//import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.metrics.MetricCategory; - import net.minecraft.world.entity.Mob; - import net.minecraft.world.level.PathNavigationRegion; - import dev.kaiijumc.kaiiju.path.*; // Plazma - Process pathfinding asynchronously -diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -index 778e6476c86d823dc8efe603a95e589e8b2ea9d9..fe3ba3e7fb5c2711edfa7c78441a590b08a68aa3 100644 ---- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java -+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java -@@ -23,8 +23,8 @@ import net.minecraft.Util; - import net.minecraft.core.BlockPos; - import net.minecraft.core.SectionPos; - import net.minecraft.core.Vec3i; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; -+//import net.minecraft.util.profiling.Profiler; // Plazma - Completely remove Mojang profiler -+//import net.minecraft.util.profiling.ProfilerFiller; // Plazma - Completely remove Mojang profiler - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.levelgen.structure.BoundingBox; - -@@ -79,20 +79,20 @@ public class LevelTicks implements LevelTickAccess { - } - - public void tick(long time, int maxTicks, BiConsumer ticker) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("collect"); -- this.collectTicks(time, maxTicks, profilerFiller); -- profilerFiller.popPush("run"); -- profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); -+ //ProfilerFiller profilerFiller = Profiler.get(); -+ //profilerFiller.push("collect"); -+ this.collectTicks(time, maxTicks/*, profilerFiller*/); // Plazma - Completely remove Mojang profiler -+ //profilerFiller.popPush("run"); -+ //profilerFiller.incrementCounter("ticksToRun", this.toRunThisTick.size()); - this.runCollectedTicks(ticker); -- profilerFiller.popPush("cleanup"); -+ //profilerFiller.popPush("cleanup"); - this.cleanupAfterTick(); -- profilerFiller.pop(); -+ //profilerFiller.pop(); - } - -- private void collectTicks(long time, int maxTicks, ProfilerFiller profiler) { -+ private void collectTicks(long time, int maxTicks/*, ProfilerFiller profiler*/) { // Plazma - Completely remove Mojang profiler - this.sortContainersToTick(time); -- profiler.incrementCounter("containersToTick", this.containersToTick.size()); -+ //profiler.incrementCounter("containersToTick", this.containersToTick.size()); - this.drainContainers(time, maxTicks); - this.rescheduleLeftoverContainers(); - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index deddf588826dda9b15beff3acf20be56837d240b..0c1409f190d67029b090c025f1657467d8113004 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -471,7 +471,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { - } - this.unloadChunkRequest(x, z); - -- this.world.getChunkSource().purgeUnload(); -+ //this.world.getChunkSource().purgeUnload(); // Plazma - Completely remove Mojang profiler - return !this.isChunkLoaded(x, z); - } - diff --git a/plazma-api/paper-patches/features/0001-Completely-remove-Timings.patch b/plazma-api/paper-patches/features/0001-Completely-remove-Timings.patch new file mode 100644 index 0000000..ffff617 --- /dev/null +++ b/plazma-api/paper-patches/features/0001-Completely-remove-Timings.patch @@ -0,0 +1,3202 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sun, 23 Feb 2025 19:51:41 +0900 +Subject: [PATCH] Completely remove Timings + + +diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java +deleted file mode 100644 +index 73b125979e2f2dfd13cbf689a90b29cc68a36e09..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java ++++ /dev/null +@@ -1,89 +0,0 @@ +-package co.aikar.timings; +- +-import static co.aikar.timings.TimingsManager.*; +- +-import org.bukkit.Bukkit; +-import org.jetbrains.annotations.NotNull; +- +-/** +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-public class FullServerTickHandler extends TimingHandler { +- private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null); +- final TimingData minuteData; +- double avgFreeMemory = -1D; +- double avgUsedMemory = -1D; +- FullServerTickHandler() { +- super(IDENTITY); +- minuteData = new TimingData(id); +- +- TIMING_MAP.put(IDENTITY, this); +- } +- +- @NotNull +- @Override +- public Timing startTiming() { +- if (TimingsManager.needsFullReset) { +- TimingsManager.resetTimings(); +- } else if (TimingsManager.needsRecheckEnabled) { +- TimingsManager.recheckEnabled(); +- } +- return super.startTiming(); +- } +- +- @Override +- public void stopTiming() { +- super.stopTiming(); +- if (!isEnabled()) { +- return; +- } +- if (TimingHistory.timedTicks % 20 == 0) { +- final Runtime runtime = Runtime.getRuntime(); +- double usedMemory = runtime.totalMemory() - runtime.freeMemory(); +- double freeMemory = runtime.maxMemory() - usedMemory; +- if (this.avgFreeMemory == -1) { +- this.avgFreeMemory = freeMemory; +- } else { +- this.avgFreeMemory = (this.avgFreeMemory * (59 / 60D)) + (freeMemory * (1 / 60D)); +- } +- +- if (this.avgUsedMemory == -1) { +- this.avgUsedMemory = usedMemory; +- } else { +- this.avgUsedMemory = (this.avgUsedMemory * (59 / 60D)) + (usedMemory * (1 / 60D)); +- } +- } +- +- long start = System.nanoTime(); +- TimingsManager.tick(); +- long diff = System.nanoTime() - start; +- TIMINGS_TICK.addDiff(diff, null); +- // addDiff for TIMINGS_TICK incremented this, bring it back down to 1 per tick. +- record.setCurTickCount(record.getCurTickCount()-1); +- +- minuteData.setCurTickTotal(record.getCurTickTotal()); +- minuteData.setCurTickCount(1); +- +- boolean violated = isViolated(); +- minuteData.processTick(violated); +- TIMINGS_TICK.processTick(violated); +- processTick(violated); +- +- +- if (TimingHistory.timedTicks % 1200 == 0) { +- MINUTE_REPORTS.add(new TimingHistory.MinuteReport()); +- TimingHistory.resetTicks(false); +- minuteData.reset(); +- } +- if (TimingHistory.timedTicks % Timings.getHistoryInterval() == 0) { +- TimingsManager.HISTORY.add(new TimingHistory()); +- TimingsManager.resetTimings(); +- } +- //Bukkit.getUnsafe().reportTimings(); +- } +- +- boolean isViolated() { +- return record.getCurTickTotal() > 50000000; +- } +-} +diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java +deleted file mode 100644 +index 42e7e712403676171d34d5f2be27e48e7a071ebd..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/NullTimingHandler.java ++++ /dev/null +@@ -1,72 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-public final class NullTimingHandler implements Timing { +- public static final Timing NULL = new NullTimingHandler(); +- @NotNull +- @Override +- public Timing startTiming() { +- return this; +- } +- +- @Override +- public void stopTiming() { +- +- } +- +- @NotNull +- @Override +- public Timing startTimingIfSync() { +- return this; +- } +- +- @Override +- public void stopTimingIfSync() { +- +- } +- +- @Override +- public void abort() { +- +- } +- +- @Nullable +- @Override +- public TimingHandler getTimingHandler() { +- return null; +- } +- +- @Override +- public void close() { +- +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java +deleted file mode 100644 +index c178d77bd23a484043f50e46ccd603734f7b6059..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java ++++ /dev/null +@@ -1,93 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import org.bukkit.Bukkit; +-import org.bukkit.event.Event; +-import org.bukkit.event.EventException; +-import org.bukkit.event.Listener; +-import org.bukkit.plugin.EventExecutor; +-import org.bukkit.plugin.Plugin; +- +-import java.lang.reflect.Method; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-public class TimedEventExecutor implements EventExecutor { +- +- private final EventExecutor executor; +- private final Timing timings; +- +- /** +- * Wraps an event executor and associates a timing handler to it. +- * +- * @param executor Executor to wrap +- * @param plugin Owning plugin +- * @param method EventHandler method +- * @param eventClass Owning class +- */ +- public TimedEventExecutor(@NotNull EventExecutor executor, @NotNull Plugin plugin, @Nullable Method method, @NotNull Class eventClass) { +- this.executor = executor; +- String id; +- +- if (method == null) { +- if (executor.getClass().getEnclosingClass() != null) { // Oh Skript, how we love you +- method = executor.getClass().getEnclosingMethod(); +- } +- } +- +- if (method != null) { +- id = method.getDeclaringClass().getName(); +- } else { +- id = executor.getClass().getName(); +- } +- +- +- final String eventName = eventClass.getSimpleName(); +- boolean verbose = "BlockPhysicsEvent".equals(eventName); +- this.timings = Timings.ofSafe(plugin, (verbose ? "## " : "") + +- "Event: " + id + " (" + eventName + ")"); +- } +- +- @Override +- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { +- if (event.isAsynchronous() || !Timings.timingsEnabled || !Bukkit.isPrimaryThread()) { +- executor.execute(listener, event); +- return; +- } +- //try (Timing ignored = timings.startTiming()){ // Purpur - Remove Timings +- executor.execute(listener, event); +- //} // Purpur - Remove Timings +- } +- +- @Override +- @NotNull +- public String toString() { +- return "TimedEventExecutor['" + this.executor.toString() + "']"; +- } +-} +diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java +index acd06662bf1da1f12f73e2e85c0fd1b10f3b8b93..15e41945ba5acee7956758899fd6f1c0229053e4 100644 +--- a/src/main/java/co/aikar/timings/Timing.java ++++ b/src/main/java/co/aikar/timings/Timing.java +@@ -33,22 +33,28 @@ import org.jetbrains.annotations.Nullable; + */ + @Deprecated(forRemoval = true) + public interface Timing extends AutoCloseable { ++ + /** + * Starts timing the execution until {@link #stopTiming()} is called. + * + * @return Timing + */ +- @NotNull ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- Timing startTiming(); ++ default Timing startTiming() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings + + /** + *

Stops timing and records the data. Propagates the data up to group handlers.

+ * + * Will automatically be called when this Timing is used with try-with-resources + */ ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- void stopTiming(); ++ default void stopTiming() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings + + /** + * Starts timing the execution until {@link #stopTiming()} is called. +@@ -57,9 +63,11 @@ public interface Timing extends AutoCloseable { + * + * @return Timing + */ +- @NotNull ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- Timing startTimingIfSync(); ++ default Timing startTimingIfSync() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings + + /** + *

Stops timing and records the data. Propagates the data up to group handlers.

+@@ -68,25 +76,34 @@ public interface Timing extends AutoCloseable { + * + * But only if we are on the primary thread. + */ ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- void stopTimingIfSync(); ++ default void stopTimingIfSync() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings + + /** + * @deprecated Doesn't do anything - Removed + */ +- @Deprecated ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- void abort(); ++ default void abort() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings + + /** + * Used internally to get the actual backing Handler in the case of delegated Handlers + * + * @return TimingHandler + */ +- @Nullable +- TimingHandler getTimingHandler(); ++ //@Nullable // Plazma - Completely remove timings ++ //TimingHandler getTimingHandler(); // Plazma - Completely remove timings + + @Override ++ @Deprecated(forRemoval = true) // Plazma - Completely remove timings + @io.papermc.paper.annotation.DoNotUse // Purpur - Remove Timings +- void close(); ++ default void close() { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings ++ } // Plazma - Completely remove timings ++ + } +diff --git a/src/main/java/co/aikar/timings/TimingData.java b/src/main/java/co/aikar/timings/TimingData.java +deleted file mode 100644 +index a5d13a1e44edb861f45c83a9b4309fbf799d407d..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingData.java ++++ /dev/null +@@ -1,122 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import java.util.List; +-import org.jetbrains.annotations.NotNull; +- +-import static co.aikar.util.JSONUtil.toArray; +- +-/** +- *

Lightweight object for tracking timing data

+- * +- * This is broken out to reduce memory usage +- */ +-class TimingData { +- private final int id; +- private int count = 0; +- private int lagCount = 0; +- private long totalTime = 0; +- private long lagTotalTime = 0; +- private int curTickCount = 0; +- private long curTickTotal = 0; +- +- TimingData(int id) { +- this.id = id; +- } +- +- private TimingData(TimingData data) { +- this.id = data.id; +- this.totalTime = data.totalTime; +- this.lagTotalTime = data.lagTotalTime; +- this.count = data.count; +- this.lagCount = data.lagCount; +- } +- +- void add(long diff) { +- ++curTickCount; +- curTickTotal += diff; +- } +- +- void processTick(boolean violated) { +- totalTime += curTickTotal; +- count += curTickCount; +- if (violated) { +- lagTotalTime += curTickTotal; +- lagCount += curTickCount; +- } +- curTickTotal = 0; +- curTickCount = 0; +- } +- +- void reset() { +- count = 0; +- lagCount = 0; +- curTickTotal = 0; +- curTickCount = 0; +- totalTime = 0; +- lagTotalTime = 0; +- } +- +- protected TimingData clone() { +- return new TimingData(this); +- } +- +- @NotNull +- List export() { +- List list = toArray( +- id, +- count, +- totalTime); +- if (lagCount > 0) { +- list.add(lagCount); +- list.add(lagTotalTime); +- } +- return list; +- } +- +- boolean hasData() { +- return count > 0; +- } +- +- long getTotalTime() { +- return totalTime; +- } +- +- int getCurTickCount() { +- return curTickCount; +- } +- +- void setCurTickCount(int curTickCount) { +- this.curTickCount = curTickCount; +- } +- +- long getCurTickTotal() { +- return curTickTotal; +- } +- +- void setCurTickTotal(long curTickTotal) { +- this.curTickTotal = curTickTotal; +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java +deleted file mode 100644 +index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingHandler.java ++++ /dev/null +@@ -1,226 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import co.aikar.util.LoadingIntMap; +-import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +- +-import java.util.ArrayDeque; +-import java.util.Deque; +-import java.util.concurrent.atomic.AtomicInteger; +-import java.util.logging.Level; +-import java.util.logging.Logger; +- +-import org.bukkit.Bukkit; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-class TimingHandler implements Timing { +- +- private static AtomicInteger idPool = new AtomicInteger(1); +- private static Deque TIMING_STACK = new ArrayDeque<>(); +- final int id = idPool.getAndIncrement(); +- +- final TimingIdentifier identifier; +- private final boolean verbose; +- +- private final Int2ObjectOpenHashMap children = new LoadingIntMap<>(TimingData::new); +- +- final TimingData record; +- private TimingHandler startParent; +- private final TimingHandler groupHandler; +- +- private long start = 0; +- private int timingDepth = 0; +- private boolean added; +- private boolean timed; +- private boolean enabled; +- +- TimingHandler(@NotNull TimingIdentifier id) { +- this.identifier = id; +- this.verbose = id.name.startsWith("##"); +- this.record = new TimingData(this.id); +- this.groupHandler = id.groupHandler; +- +- TimingIdentifier.getGroup(id.group).handlers.add(this); +- checkEnabled(); +- } +- +- final void checkEnabled() { +- enabled = Timings.timingsEnabled && (!verbose || Timings.verboseEnabled); +- } +- +- void processTick(boolean violated) { +- if (timingDepth != 0 || record.getCurTickCount() == 0) { +- timingDepth = 0; +- start = 0; +- return; +- } +- +- record.processTick(violated); +- for (TimingData handler : children.values()) { +- handler.processTick(violated); +- } +- } +- +- @NotNull +- @Override +- public Timing startTimingIfSync() { +- startTiming(); +- return this; +- } +- +- @Override +- public void stopTimingIfSync() { +- stopTiming(); +- } +- +- @NotNull +- public Timing startTiming() { +- if (!enabled || !Bukkit.isPrimaryThread()) { +- return this; +- } +- if (++timingDepth == 1) { +- startParent = TIMING_STACK.peekLast(); +- start = System.nanoTime(); +- } +- TIMING_STACK.addLast(this); +- return this; +- } +- +- public void stopTiming() { +- if (!enabled || timingDepth <= 0 || start == 0 || !Bukkit.isPrimaryThread()) { +- return; +- } +- +- popTimingStack(); +- if (--timingDepth == 0) { +- addDiff(System.nanoTime() - start, startParent); +- startParent = null; +- start = 0; +- } +- } +- +- private void popTimingStack() { +- TimingHandler last; +- while ((last = TIMING_STACK.removeLast()) != this) { +- last.timingDepth = 0; +- if ("Minecraft".equalsIgnoreCase(last.identifier.group)) { +- Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to Paper unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)"); +- } else { +- Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to the plugin " + last.identifier.group + " (Look for errors above this in the logs) (" + last.identifier + " did not stopTiming)", new Throwable()); +- } +- +- boolean found = TIMING_STACK.contains(this); +- if (!found) { +- // We aren't even in the stack... Don't pop everything +- TIMING_STACK.addLast(last); +- break; +- } +- } +- } +- +- @Override +- public final void abort() { +- +- } +- +- void addDiff(long diff, @Nullable TimingHandler parent) { +- if (parent != null) { +- parent.children.get(id).add(diff); +- } +- +- record.add(diff); +- if (!added) { +- added = true; +- timed = true; +- TimingsManager.HANDLERS.add(this); +- } +- if (groupHandler != null) { +- groupHandler.addDiff(diff, parent); +- groupHandler.children.get(id).add(diff); +- } +- } +- +- /** +- * Reset this timer, setting all values to zero. +- */ +- void reset(boolean full) { +- record.reset(); +- if (full) { +- timed = false; +- } +- start = 0; +- timingDepth = 0; +- added = false; +- children.clear(); +- checkEnabled(); +- } +- +- @NotNull +- @Override +- public TimingHandler getTimingHandler() { +- return this; +- } +- +- @Override +- public boolean equals(Object o) { +- return (this == o); +- } +- +- @Override +- public int hashCode() { +- return id; +- } +- +- /** +- * This is simply for the Closeable interface so it can be used with try-with-resources () +- */ +- @Override +- public void close() { +- stopTimingIfSync(); +- } +- +- public boolean isSpecial() { +- return this == TimingsManager.FULL_SERVER_TICK || this == TimingsManager.TIMINGS_TICK; +- } +- +- boolean isTimed() { +- return timed; +- } +- +- public boolean isEnabled() { +- return enabled; +- } +- +- @NotNull +- TimingData[] cloneChildren() { +- final TimingData[] clonedChildren = new TimingData[children.size()]; +- int i = 0; +- for (TimingData child : children.values()) { +- clonedChildren[i++] = child.clone(); +- } +- return clonedChildren; +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java +deleted file mode 100644 +index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingHistory.java ++++ /dev/null +@@ -1,357 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import co.aikar.timings.TimingHistory.RegionData.RegionId; +-import com.google.common.base.Function; +-import com.google.common.collect.Sets; +-import org.bukkit.Bukkit; +-import org.bukkit.Chunk; +-import org.bukkit.Material; +-import org.bukkit.World; +-import org.bukkit.block.BlockState; +-import org.bukkit.entity.Entity; +-import org.bukkit.entity.EntityType; +-import org.bukkit.entity.Player; +-import co.aikar.util.LoadingMap; +-import co.aikar.util.MRUMapCache; +- +-import java.lang.management.ManagementFactory; +-import java.util.Collection; +-import java.util.EnumMap; +-import java.util.List; +-import java.util.Map; +-import java.util.Set; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-import static co.aikar.timings.TimingsManager.FULL_SERVER_TICK; +-import static co.aikar.timings.TimingsManager.MINUTE_REPORTS; +-import static co.aikar.util.JSONUtil.*; +- +-/** +- * Internal. +- * +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-@SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"}) +-public class TimingHistory { +- public static long lastMinuteTime; +- public static long timedTicks; +- public static long playerTicks; +- public static long entityTicks; +- public static long tileEntityTicks; +- public static long activatedEntityTicks; +- private static int worldIdPool = 1; +- static Map worldMap = LoadingMap.newHashMap(new Function() { +- @NotNull +- @Override +- public Integer apply(@Nullable String input) { +- return worldIdPool++; +- } +- }); +- private final long endTime; +- private final long startTime; +- private final long totalTicks; +- private final long totalTime; // Represents all time spent running the server this history +- private final MinuteReport[] minuteReports; +- +- private final TimingHistoryEntry[] entries; +- final Set tileEntityTypeSet = Sets.newHashSet(); +- final Set entityTypeSet = Sets.newHashSet(); +- private final Map worlds; +- +- TimingHistory() { +- this.endTime = System.currentTimeMillis() / 1000; +- this.startTime = TimingsManager.historyStart / 1000; +- if (timedTicks % 1200 != 0 || MINUTE_REPORTS.isEmpty()) { +- this.minuteReports = MINUTE_REPORTS.toArray(new MinuteReport[MINUTE_REPORTS.size() + 1]); +- this.minuteReports[this.minuteReports.length - 1] = new MinuteReport(); +- } else { +- this.minuteReports = MINUTE_REPORTS.toArray(new MinuteReport[MINUTE_REPORTS.size()]); +- } +- long ticks = 0; +- for (MinuteReport mp : this.minuteReports) { +- ticks += mp.ticksRecord.timed; +- } +- this.totalTicks = ticks; +- this.totalTime = FULL_SERVER_TICK.record.getTotalTime(); +- this.entries = new TimingHistoryEntry[TimingsManager.HANDLERS.size()]; +- +- int i = 0; +- for (TimingHandler handler : TimingsManager.HANDLERS) { +- entries[i++] = new TimingHistoryEntry(handler); +- } +- +- // Information about all loaded chunks/entities +- //noinspection unchecked +- this.worlds = toObjectMapper(Bukkit.getWorlds(), new Function() { +- @NotNull +- @Override +- public JSONPair apply(World world) { +- Map regions = LoadingMap.newHashMap(RegionData.LOADER); +- +- for (Chunk chunk : world.getLoadedChunks()) { +- RegionData data = regions.get(new RegionId(chunk.getX(), chunk.getZ())); +- +- for (Entity entity : chunk.getEntities()) { +- if (entity == null) { +- Bukkit.getLogger().warning("Null entity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); +- continue; +- } +- +- data.entityCounts.get(entity.getType()).increment(); +- } +- +- for (BlockState tileEntity : chunk.getTileEntities(false)) { +- if (tileEntity == null) { +- Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); +- continue; +- } +- +- data.tileEntityCounts.get(tileEntity.getBlock().getType()).increment(); +- } +- } +- return pair( +- worldMap.get(world.getName()), +- toArrayMapper(regions.values(),new Function() { +- @NotNull +- @Override +- public Object apply(RegionData input) { +- return toArray( +- input.regionId.x, +- input.regionId.z, +- toObjectMapper(input.entityCounts.entrySet(), +- new Function, JSONPair>() { +- @NotNull +- @Override +- public JSONPair apply(Map.Entry entry) { +- entityTypeSet.add(entry.getKey()); +- return pair( +- String.valueOf(entry.getKey().ordinal()), +- entry.getValue().count() +- ); +- } +- } +- ), +- toObjectMapper( +- input.tileEntityCounts.entrySet(), +- entry -> { +- tileEntityTypeSet.add(entry.getKey()); +- return pair( +- String.valueOf(entry.getKey().ordinal()), +- entry.getValue().count() +- ); +- } +- ) +- ); +- } +- }) +- ); +- } +- }); +- } +- static class RegionData { +- final RegionId regionId; +- @SuppressWarnings("Guava") +- static Function LOADER = new Function() { +- @NotNull +- @Override +- public RegionData apply(@NotNull RegionId id) { +- return new RegionData(id); +- } +- }; +- RegionData(@NotNull RegionId id) { +- this.regionId = id; +- } +- +- @Override +- public boolean equals(Object o) { +- if (this == o) { +- return true; +- } +- if (o == null || getClass() != o.getClass()) { +- return false; +- } +- +- RegionData that = (RegionData) o; +- +- return regionId.equals(that.regionId); +- +- } +- +- @Override +- public int hashCode() { +- return regionId.hashCode(); +- } +- +- @SuppressWarnings("unchecked") +- final Map entityCounts = MRUMapCache.of(LoadingMap.of( +- new EnumMap(EntityType.class), k -> new Counter() +- )); +- @SuppressWarnings("unchecked") +- final Map tileEntityCounts = MRUMapCache.of(LoadingMap.of( +- new EnumMap(Material.class), k -> new Counter() +- )); +- +- static class RegionId { +- final int x, z; +- final long regionId; +- RegionId(int x, int z) { +- this.x = x >> 5 << 5; +- this.z = z >> 5 << 5; +- this.regionId = ((long) (this.x) << 32) + (this.z >> 5 << 5) - Integer.MIN_VALUE; +- } +- +- @Override +- public boolean equals(Object o) { +- if (this == o) return true; +- if (o == null || getClass() != o.getClass()) return false; +- +- RegionId regionId1 = (RegionId) o; +- +- return regionId == regionId1.regionId; +- +- } +- +- @Override +- public int hashCode() { +- return (int) (regionId ^ (regionId >>> 32)); +- } +- } +- } +- static void resetTicks(boolean fullReset) { +- if (fullReset) { +- // Non full is simply for 1 minute reports +- timedTicks = 0; +- } +- lastMinuteTime = System.nanoTime(); +- playerTicks = 0; +- tileEntityTicks = 0; +- entityTicks = 0; +- activatedEntityTicks = 0; +- } +- +- @NotNull +- Object export() { +- return createObject( +- pair("s", startTime), +- pair("e", endTime), +- pair("tk", totalTicks), +- pair("tm", totalTime), +- pair("w", worlds), +- pair("h", toArrayMapper(entries, new Function() { +- @Nullable +- @Override +- public Object apply(TimingHistoryEntry entry) { +- TimingData record = entry.data; +- if (!record.hasData()) { +- return null; +- } +- return entry.export(); +- } +- })), +- pair("mp", toArrayMapper(minuteReports, new Function() { +- @NotNull +- @Override +- public Object apply(MinuteReport input) { +- return input.export(); +- } +- })) +- ); +- } +- +- static class MinuteReport { +- final long time = System.currentTimeMillis() / 1000; +- +- final TicksRecord ticksRecord = new TicksRecord(); +- final PingRecord pingRecord = new PingRecord(); +- final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone(); +- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed; +- final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory; +- final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory; +- final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); +- +- @NotNull +- List export() { +- return toArray( +- time, +- Math.round(tps * 100D) / 100D, +- Math.round(pingRecord.avg * 100D) / 100D, +- fst.export(), +- toArray(ticksRecord.timed, +- ticksRecord.player, +- ticksRecord.entity, +- ticksRecord.activatedEntity, +- ticksRecord.tileEntity +- ), +- usedMemory, +- freeMemory, +- loadAvg +- ); +- } +- } +- +- private static class TicksRecord { +- final long timed; +- final long player; +- final long entity; +- final long tileEntity; +- final long activatedEntity; +- +- TicksRecord() { +- timed = timedTicks - (TimingsManager.MINUTE_REPORTS.size() * 1200); +- player = playerTicks; +- entity = entityTicks; +- tileEntity = tileEntityTicks; +- activatedEntity = activatedEntityTicks; +- } +- +- } +- +- private static class PingRecord { +- final double avg; +- +- PingRecord() { +- final Collection onlinePlayers = Bukkit.getOnlinePlayers(); +- int totalPing = 0; +- for (Player player : onlinePlayers) { +- totalPing += player.spigot().getPing(); +- } +- avg = onlinePlayers.isEmpty() ? 0 : totalPing / onlinePlayers.size(); +- } +- } +- +- +- private static class Counter { +- private int count = 0; +- public int increment() { +- return ++count; +- } +- public int count() { +- return count; +- } +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimingHistoryEntry.java b/src/main/java/co/aikar/timings/TimingHistoryEntry.java +deleted file mode 100644 +index 86d5ac6bd0d7d0003688761aceb3f3343575319f..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingHistoryEntry.java ++++ /dev/null +@@ -1,58 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import com.google.common.base.Function; +- +-import java.util.List; +-import org.jetbrains.annotations.NotNull; +- +-import static co.aikar.util.JSONUtil.toArrayMapper; +- +-class TimingHistoryEntry { +- final TimingData data; +- private final TimingData[] children; +- +- TimingHistoryEntry(@NotNull TimingHandler handler) { +- this.data = handler.record.clone(); +- children = handler.cloneChildren(); +- } +- +- @NotNull +- List export() { +- List result = data.export(); +- if (children.length > 0) { +- result.add( +- toArrayMapper(children, new Function() { +- @NotNull +- @Override +- public Object apply(TimingData child) { +- return child.export(); +- } +- }) +- ); +- } +- return result; +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java +deleted file mode 100644 +index df142a89b8c43acb81eb383eac0ef048a1f49a6e..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingIdentifier.java ++++ /dev/null +@@ -1,116 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import co.aikar.util.LoadingMap; +- +-import java.util.ArrayList; +-import java.util.Collections; +-import java.util.List; +-import java.util.Map; +-import java.util.Objects; +-import java.util.concurrent.ConcurrentHashMap; +-import java.util.concurrent.atomic.AtomicInteger; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- *

Used as a basis for fast HashMap key comparisons for the Timing Map.

+- * +- * This class uses interned strings giving us the ability to do an identity check instead of equals() on the strings +- */ +-final class TimingIdentifier { +- /** +- * Holds all groups. Autoloads on request for a group by name. +- */ +- static final Map GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new); +- private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft"); +- final String group; +- final String name; +- final TimingHandler groupHandler; +- private final int hashCode; +- +- TimingIdentifier(@Nullable String group, @NotNull String name, @Nullable Timing groupHandler) { +- this.group = group != null ? group: DEFAULT_GROUP.name; +- this.name = name; +- this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null; +- this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode(); +- } +- +- @NotNull +- static TimingGroup getGroup(@Nullable String groupName) { +- if (groupName == null) { +- //noinspection ConstantConditions +- return DEFAULT_GROUP; +- } +- +- return GROUP_MAP.get(groupName); +- } +- +- @Override +- public boolean equals(Object o) { +- if (o == null) { +- return false; +- } +- +- TimingIdentifier that = (TimingIdentifier) o; +- return Objects.equals(group, that.group) && Objects.equals(name, that.name); +- } +- +- @Override +- public int hashCode() { +- return hashCode; +- } +- +- @Override +- public String toString() { +- return "TimingIdentifier{id=" + group + ":" + name +'}'; +- } +- +- static class TimingGroup { +- +- private static AtomicInteger idPool = new AtomicInteger(1); +- final int id = idPool.getAndIncrement(); +- +- final String name; +- final List handlers = Collections.synchronizedList(new ArrayList<>(64)); +- +- private TimingGroup(String name) { +- this.name = name; +- } +- +- @Override +- public boolean equals(Object o) { +- if (this == o) return true; +- if (o == null || getClass() != o.getClass()) return false; +- TimingGroup that = (TimingGroup) o; +- return id == that.id; +- } +- +- @Override +- public int hashCode() { +- return id; +- } +- } +-} +diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java +index 627922fa5c65e9b77e79cd896c8c52889f5a0cc5..5c7e8953e2ea221546d0d61e7dd8a161434da003 100644 +--- a/src/main/java/co/aikar/timings/Timings.java ++++ b/src/main/java/co/aikar/timings/Timings.java +@@ -40,6 +40,9 @@ import java.util.logging.Level; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + ++import org.jetbrains.annotations.Contract; // Plazma - Completely remove timings ++import io.papermc.paper.annotation.DoNotUse; // Plazma - Completely remove timings ++ + /** + * @deprecated Timings will be removed in the future + */ +@@ -47,15 +50,6 @@ import org.jetbrains.annotations.Nullable; + @SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"}) + public final class Timings { + +- final static List requestingReport = Lists.newArrayList(); +- private static final int MAX_HISTORY_FRAMES = 12; +- public static final Timing NULL_HANDLER = new NullTimingHandler(); +- static boolean timingsEnabled = false; +- static boolean verboseEnabled = false; +- private static int historyInterval = -1; +- private static int historyLength = -1; +- private static boolean warnedAboutDeprecationOnEnable; +- + private Timings() {} + + /** +@@ -65,13 +59,10 @@ public final class Timings { + * @param name Name of Timing + * @return Handler + */ +- @NotNull ++ @Contract(value = "_, _ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static Timing of(@NotNull Plugin plugin, @NotNull String name) { +- Timing pluginHandler = null; +- if (plugin != null) { +- pluginHandler = ofSafe(plugin.getName(), "Combined Total", TimingsManager.PLUGIN_GROUP_HANDLER); +- } +- return of(plugin, name, pluginHandler); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -86,11 +77,10 @@ public final class Timings { + * @param groupHandler Parent handler to mirror .start/stop calls to + * @return Timing Handler + */ +- @NotNull ++ @Contract(value = "_, _, _ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static Timing of(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { +- Preconditions.checkNotNull(plugin, "Plugin can not be null"); +- Bukkit.getLogger().warning(String.format("Plugin '%s' is creating timing '%s' - this is deprecated behavior, please report it to the authors: %s", plugin.getName(), name, String.join(", ", plugin.getDescription().getAuthors()))); +- return TimingsManager.getHandler(plugin.getName(), name, groupHandler); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -104,9 +94,10 @@ public final class Timings { + * @param name Name of Timing + * @return Timing Handler + */ +- @NotNull ++ @Contract(value = "_, _ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name) { +- return ofStart(plugin, name, null); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -121,11 +112,10 @@ public final class Timings { + * @param groupHandler Parent handler to mirror .start/stop calls to + * @return Timing Handler + */ +- @NotNull ++ @Contract(value = "_, _, _ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { +- Timing timing = of(plugin, name, groupHandler); +- //timing.startTiming(); // Purpur - Remove Timings +- return timing; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -133,8 +123,10 @@ public final class Timings { + * + * @return Enabled or not + */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static boolean isTimingsEnabled() { +- return timingsEnabled; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -144,28 +136,19 @@ public final class Timings { + * + * @param enabled Should timings be reported + */ ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void setTimingsEnabled(boolean enabled) { +- if (enabled && !warnedAboutDeprecationOnEnable) { +- //Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage())); // Purpur - Remove Timings +- warnedAboutDeprecationOnEnable = true; +- } ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + ++ /** ++ * @return The deprecation message. ++ */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static Component deprecationMessage() { +- return Component.text() +- .color(TextColor.color(0xffc93a)) +- .append(Component.text("[!] The timings profiler is in no-op mode and will be fully removed in a later update.")) +- .append(Component.newline()) +- .append(Component.text(" We recommend migrating to the spark profiler.")) +- .append(Component.newline()) +- .append( +- Component.text(" For more information please visit: ") +- .append( +- Component.text() +- .content("https://github.com/PaperMC/Paper/discussions/10565") +- .clickEvent(ClickEvent.openUrl("https://github.com/PaperMC/Paper/discussions/10565"))) +- ) +- .build(); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -175,8 +158,10 @@ public final class Timings { + * + * @return Enabled or not + */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static boolean isVerboseTimingsEnabled() { +- return verboseEnabled; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -187,9 +172,10 @@ public final class Timings { + * + * @param enabled Should high-frequency timings be reported + */ ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void setVerboseTimingsEnabled(boolean enabled) { +- verboseEnabled = enabled; +- TimingsManager.needsRecheckEnabled = true; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -199,8 +185,10 @@ public final class Timings { + * + * @return Interval in ticks + */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static int getHistoryInterval() { +- return historyInterval; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -213,12 +201,10 @@ public final class Timings { + * + * @param interval Interval in ticks + */ ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void setHistoryInterval(int interval) { +- historyInterval = Math.max(20*60, interval); +- // Recheck the history length with the new Interval +- if (historyLength != -1) { +- setHistoryLength(historyLength); +- } ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -228,8 +214,10 @@ public final class Timings { + * + * @return Duration in Ticks + */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static int getHistoryLength() { +- return historyLength; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -243,30 +231,19 @@ public final class Timings { + * + * @param length Duration in ticks + */ ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void setHistoryLength(int length) { +- // Cap at 12 History Frames, 1 hour at 5 minute frames. +- int maxLength = historyInterval * MAX_HISTORY_FRAMES; +- // For special cases of servers with special permission to bypass the max. +- // This max helps keep data file sizes reasonable for processing on Aikar's Timing parser side. +- // Setting this will not help you bypass the max unless Aikar has added an exception on the API side. +- if (System.getProperty("timings.bypassMax") != null) { +- maxLength = Integer.MAX_VALUE; +- } +- historyLength = Math.max(Math.min(maxLength, length), historyInterval); +- Queue oldQueue = TimingsManager.HISTORY; +- int frames = (getHistoryLength() / getHistoryInterval()); +- if (length > maxLength) { +- Bukkit.getLogger().log(Level.WARNING, "Timings Length too high. Requested " + length + ", max is " + maxLength + ". To get longer history, you must increase your interval. Set Interval to " + Math.ceil(length / MAX_HISTORY_FRAMES) + " to achieve this length."); +- } +- TimingsManager.HISTORY = EvictingQueue.create(frames); +- TimingsManager.HISTORY.addAll(oldQueue); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** + * Resets all Timing Data + */ ++ @Contract(value = " -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void reset() { +- TimingsManager.reset(); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -275,11 +252,10 @@ public final class Timings { + * If sender is null, ConsoleCommandSender will be used. + * @param sender The sender to send to, or null to use the ConsoleCommandSender + */ ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public static void generateReport(@Nullable CommandSender sender) { +- if (sender == null) { +- sender = Bukkit.getConsoleSender(); +- } +- requestingReport.add(sender); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -287,9 +263,10 @@ public final class Timings { + * Use with {@link org.bukkit.command.BufferedCommandSender} to get full response when done! + * @param sender The listener to send responses too. + */ +- public static void generateReport(@NotNull TimingsReportListener sender) { +- Preconditions.checkNotNull(sender); +- requestingReport.add(sender); ++ @Contract(value = "_ -> fail", pure = true) // Plazma - Completely remove timings ++ @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings ++ public static void generateReport(@NotNull Object sender) { // Plazma - Completely remove timings ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /* +@@ -298,6 +275,7 @@ public final class Timings { + These do not have isPrimaryThread() checks in the startTiming/stopTiming + ================= + */ ++ /* // Plazma - Completely remove timings + @NotNull + static TimingHandler ofSafe(@NotNull String name) { + return ofSafe(null, name, null); +@@ -321,4 +299,5 @@ public final class Timings { + static TimingHandler ofSafe(@Nullable String groupName, @NotNull String name, @Nullable Timing groupHandler) { + return TimingsManager.getHandler(groupName, name, groupHandler); + } ++ */ // Plazma - Completely remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java +index 04d0dc27406e9f96224f88edb1c535176e84d395..082d897cd86219907c3e8a47a6bae99668d34230 100644 +--- a/src/main/java/co/aikar/timings/TimingsCommand.java ++++ b/src/main/java/co/aikar/timings/TimingsCommand.java +@@ -40,31 +40,30 @@ import static net.kyori.adventure.text.Component.text; + * @deprecated Timings will be removed in the future + */ + @Deprecated(forRemoval = true) +-public class TimingsCommand extends BukkitCommand { +- private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste", "verbon", "verboff"); +- private long lastResetAttempt = 0; ++public final class TimingsCommand extends BukkitCommand { // Plazma - Completely remove timings ++ //private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste", "verbon", "verboff"); // Plazma - Completely remove timings ++ //private long lastResetAttempt = 0; // Plazma - Completely remove timings + + public TimingsCommand(@NotNull String name) { + super(name); +- this.description = "Manages Spigot Timings data to see performance of the server."; ++ this.description = "Deprecated command. It should not be used."; // Plazma - Completely remove timings + this.usageMessage = "/timings";// "; // Purpur - Remove Timings + this.setPermission("bukkit.command.timings"); + } + + @Override + public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { +- if (!testPermission(sender)) { +- return true; +- } +- if (true) { ++ if (testPermission(sender)) { // Plazma - Completely remove timings + // Purpur start - Remove Timings + net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage(); + sender.sendMessage(mm.deserialize("Purpur has removed timings to save your performance. Please use /spark instead")); + sender.sendMessage(mm.deserialize("For more information, view its documentation at")); + sender.sendMessage(mm.deserialize("https://spark.lucko.me/docs/Command-Usage")); + // Purpur end - Remove Timings +- return true; ++ //return true; // Plazma - Completely remove timings + } ++ return false; // Plazma - Completely remove timings ++ /* // Plazma - Completely remove timings + if (args.length < 1) { + sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); + return true; +@@ -114,8 +113,10 @@ public class TimingsCommand extends BukkitCommand { + sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); + } + return true; ++ */ // Plazma - Completely remove timings + } + ++ /* // Plazma - Completely remove timings + @NotNull + @Override + public List tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { +@@ -129,4 +130,5 @@ public class TimingsCommand extends BukkitCommand { + } + return ImmutableList.of(); + } ++ */ // Plazma - Completely remove timings + } +diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java +deleted file mode 100644 +index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingsManager.java ++++ /dev/null +@@ -1,192 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import co.aikar.util.LoadingMap; +-import com.google.common.collect.EvictingQueue; +-import org.bukkit.Bukkit; +-import org.bukkit.Server; +-import org.bukkit.command.Command; +-import org.bukkit.plugin.Plugin; +-import org.bukkit.plugin.java.PluginClassLoader; +- +-import java.util.ArrayList; +-import java.util.List; +-import java.util.Map; +-import java.util.concurrent.ConcurrentHashMap; +-import java.util.logging.Level; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-public final class TimingsManager { +- static final Map TIMING_MAP = LoadingMap.of( +- new ConcurrentHashMap<>(4096, .5F), TimingHandler::new +- ); +- public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler(); +- public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK); +- public static final Timing PLUGIN_GROUP_HANDLER = Timings.ofSafe("Plugins"); +- public static String url = "https://timings.aikar.co/"; +- public static List hiddenConfigs = new ArrayList(); +- public static boolean privacy = false; +- +- static final List HANDLERS = new ArrayList<>(1024); +- static final List MINUTE_REPORTS = new ArrayList<>(64); +- +- static EvictingQueue HISTORY = EvictingQueue.create(12); +- static long timingStart = 0; +- static long historyStart = 0; +- static boolean needsFullReset = false; +- static boolean needsRecheckEnabled = false; +- +- private TimingsManager() {} +- +- /** +- * Resets all timing data on the next tick +- */ +- static void reset() { +- needsFullReset = true; +- } +- +- /** +- * Ticked every tick by CraftBukkit to count the number of times a timer +- * caused TPS loss. +- */ +- static void tick() { +- if (Timings.timingsEnabled) { +- boolean violated = FULL_SERVER_TICK.isViolated(); +- +- for (TimingHandler handler : HANDLERS) { +- if (handler.isSpecial()) { +- // We manually call this +- continue; +- } +- handler.processTick(violated); +- } +- +- TimingHistory.playerTicks += Bukkit.getOnlinePlayers().size(); +- TimingHistory.timedTicks++; +- // Generate TPS/Ping/Tick reports every minute +- } +- } +- static void stopServer() { +- Timings.timingsEnabled = false; +- recheckEnabled(); +- } +- static void recheckEnabled() { +- synchronized (TIMING_MAP) { +- for (TimingHandler timings : TIMING_MAP.values()) { +- timings.checkEnabled(); +- } +- } +- needsRecheckEnabled = false; +- } +- static void resetTimings() { +- if (needsFullReset) { +- // Full resets need to re-check every handlers enabled state +- // Timing map can be modified from async so we must sync on it. +- synchronized (TIMING_MAP) { +- for (TimingHandler timings : TIMING_MAP.values()) { +- timings.reset(true); +- } +- } +- Bukkit.getLogger().log(Level.INFO, "Timings Reset"); +- HISTORY.clear(); +- needsFullReset = false; +- needsRecheckEnabled = false; +- timingStart = System.currentTimeMillis(); +- } else { +- // Soft resets only need to act on timings that have done something +- // Handlers can only be modified on main thread. +- for (TimingHandler timings : HANDLERS) { +- timings.reset(false); +- } +- } +- +- HANDLERS.clear(); +- MINUTE_REPORTS.clear(); +- +- TimingHistory.resetTicks(true); +- historyStart = System.currentTimeMillis(); +- } +- +- @NotNull +- static TimingHandler getHandler(@Nullable String group, @NotNull String name, @Nullable Timing parent) { +- return TIMING_MAP.get(new TimingIdentifier(group, name, parent)); +- } +- +- +- /** +- *

Due to access restrictions, we need a helper method to get a Command TimingHandler with String group

+- * +- * Plugins should never call this +- * +- * @param pluginName Plugin this command is associated with +- * @param command Command to get timings for +- * @return TimingHandler +- */ +- @NotNull +- public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { +- Plugin plugin = null; +- final Server server = Bukkit.getServer(); +- if (!( server == null || pluginName == null || +- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || +- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) +- )) { +- plugin = server.getPluginManager().getPlugin(pluginName); +- } +- if (plugin == null) { +- // Plugin is passing custom fallback prefix, try to look up by class loader +- plugin = getPluginByClassloader(command.getClass()); +- } +- if (plugin == null) { +- return Timings.ofSafe("Command: " + pluginName + ":" + command.getTimingName()); +- } +- +- return Timings.ofSafe(plugin, "Command: " + pluginName + ":" + command.getTimingName()); +- } +- +- /** +- * Looks up the class loader for the specified class, and if it is a PluginClassLoader, return the +- * Plugin that created this class. +- * +- * @param clazz Class to check +- * @return Plugin if created by a plugin +- */ +- @Nullable +- public static Plugin getPluginByClassloader(@Nullable Class clazz) { +- if (clazz == null) { +- return null; +- } +- final ClassLoader classLoader = clazz.getClassLoader(); +- if (classLoader instanceof PluginClassLoader) { +- PluginClassLoader pluginClassLoader = (PluginClassLoader) classLoader; +- return pluginClassLoader.getPlugin(); +- } +- return null; +- } +-} +diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java +deleted file mode 100644 +index df066d6f8d55afbc0c1897c486d638657a5f8df9..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/TimingsReportListener.java ++++ /dev/null +@@ -1,90 +0,0 @@ +-package co.aikar.timings; +- +-import com.google.common.base.Preconditions; +-import com.google.common.collect.Lists; +-import org.bukkit.Bukkit; +-import org.bukkit.command.CommandSender; +-import org.bukkit.command.ConsoleCommandSender; +-import org.bukkit.command.MessageCommandSender; +-import org.bukkit.command.RemoteConsoleCommandSender; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-import java.util.List; +- +-/** +- * @deprecated Timings will be removed in the future +- */ +-@Deprecated(forRemoval = true) +-@SuppressWarnings("WeakerAccess") +-public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { +- private final List senders; +- private final Runnable onDone; +- private String timingsURL; +- +- public TimingsReportListener(@NotNull CommandSender senders) { +- this(senders, null); +- } +- public TimingsReportListener(@NotNull CommandSender sender, @Nullable Runnable onDone) { +- this(Lists.newArrayList(sender), onDone); +- } +- public TimingsReportListener(@NotNull List senders) { +- this(senders, null); +- } +- public TimingsReportListener(@NotNull List senders, @Nullable Runnable onDone) { +- Preconditions.checkNotNull(senders); +- Preconditions.checkArgument(!senders.isEmpty(), "senders is empty"); +- +- this.senders = Lists.newArrayList(senders); +- this.onDone = onDone; +- } +- +- @Nullable +- public String getTimingsURL() { +- return timingsURL; +- } +- +- public void done() { +- done(null); +- } +- +- public void done(@Nullable String url) { +- this.timingsURL = url; +- if (onDone != null) { +- onDone.run(); +- } +- for (CommandSender sender : senders) { +- if (sender instanceof TimingsReportListener) { +- ((TimingsReportListener) sender).done(); +- } +- } +- } +- +- @Override +- public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { +- net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type); +- } +- +- @NotNull +- @Override +- public Iterable audiences() { +- return this.senders; +- } +- +- @Override +- public void sendMessage(@NotNull String message) { +- senders.forEach((sender) -> sender.sendMessage(message)); +- } +- +- public void addConsoleIfNeeded() { +- boolean hasConsole = false; +- for (CommandSender sender : this.senders) { +- if (sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender) { +- hasConsole = true; +- } +- } +- if (!hasConsole) { +- this.senders.add(Bukkit.getConsoleSender()); +- } +- } +-} +diff --git a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java +deleted file mode 100644 +index 632c4961515f5052551f841cfa840e60bba7a257..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java ++++ /dev/null +@@ -1,53 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.timings; +- +-import org.bukkit.Bukkit; +-import org.jetbrains.annotations.NotNull; +- +-class UnsafeTimingHandler extends TimingHandler { +- +- UnsafeTimingHandler(@NotNull TimingIdentifier id) { +- super(id); +- } +- +- private static void checkThread() { +- if (!Bukkit.isPrimaryThread()) { +- throw new IllegalStateException("Calling Timings from Async Operation"); +- } +- } +- +- @NotNull +- @Override +- public Timing startTiming() { +- checkThread(); +- return super.startTiming(); +- } +- +- @Override +- public void stopTiming() { +- checkThread(); +- super.stopTiming(); +- } +-} +diff --git a/src/main/java/co/aikar/util/Counter.java b/src/main/java/co/aikar/util/Counter.java +deleted file mode 100644 +index dae84243804b4b076cafb3e1b29bdcf614efc93f..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/Counter.java ++++ /dev/null +@@ -1,39 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.collect.ForwardingMap; +- +-import java.util.HashMap; +-import java.util.Map; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-@Deprecated(forRemoval = true) +-public class Counter extends ForwardingMap { +- private final Map counts = new HashMap<>(); +- +- public long decrement(@Nullable T key) { +- return increment(key, -1); +- } +- public long increment(@Nullable T key) { +- return increment(key, 1); +- } +- public long decrement(@Nullable T key, long amount) { +- return increment(key, -amount); +- } +- public long increment(@Nullable T key, long amount) { +- Long count = this.getCount(key); +- count += amount; +- this.counts.put(key, count); +- return count; +- } +- +- public long getCount(@Nullable T key) { +- return this.counts.getOrDefault(key, 0L); +- } +- +- @NotNull +- @Override +- protected Map delegate() { +- return this.counts; +- } +-} +diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java +deleted file mode 100644 +index c105a1429ca58b37be265708ec345e00f0d43ed8..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/JSONUtil.java ++++ /dev/null +@@ -1,141 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.base.Function; +-import com.google.common.collect.Lists; +-import com.google.common.collect.Maps; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +-import org.json.simple.JSONArray; +-import org.json.simple.JSONObject; +- +-import java.util.ArrayList; +-import java.util.LinkedHashMap; +-import java.util.List; +-import java.util.Map; +- +-/** +- * Provides Utility methods that assist with generating JSON Objects +- */ +-@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) +-@Deprecated(forRemoval = true) +-public final class JSONUtil { +- private JSONUtil() {} +- +- /** +- * Creates a key/value "JSONPair" object +- * +- * @param key Key to use +- * @param obj Value to use +- * @return JSONPair +- */ +- @NotNull +- public static JSONPair pair(@NotNull String key, @Nullable Object obj) { +- return new JSONPair(key, obj); +- } +- +- @NotNull +- public static JSONPair pair(long key, @Nullable Object obj) { +- return new JSONPair(String.valueOf(key), obj); +- } +- +- /** +- * Creates a new JSON object from multiple JSONPair key/value pairs +- * +- * @param data JSONPairs +- * @return Map +- */ +- @NotNull +- public static Map createObject(@NotNull JSONPair... data) { +- return appendObjectData(new LinkedHashMap(), data); +- } +- +- /** +- * This appends multiple key/value Obj pairs into a JSON Object +- * +- * @param parent Map to be appended to +- * @param data Data to append +- * @return Map +- */ +- @NotNull +- public static Map appendObjectData(@NotNull Map parent, @NotNull JSONPair... data) { +- for (JSONPair JSONPair : data) { +- parent.put(JSONPair.key, JSONPair.val); +- } +- return parent; +- } +- +- /** +- * This builds a JSON array from a set of data +- * +- * @param data Data to build JSON array from +- * @return List +- */ +- @NotNull +- public static List toArray(@NotNull Object... data) { +- return Lists.newArrayList(data); +- } +- +- /** +- * These help build a single JSON array using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return List +- */ +- @NotNull +- public static List toArrayMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toArrayMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static List toArrayMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- List array = Lists.newArrayList(); +- for (E e : collection) { +- Object object = mapper.apply(e); +- if (object != null) { +- array.add(object); +- } +- } +- return array; +- } +- +- /** +- * These help build a single JSON Object from a collection, using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return Map +- */ +- @NotNull +- public static Map toObjectMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toObjectMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static Map toObjectMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- Map object = Maps.newLinkedHashMap(); +- for (E e : collection) { +- JSONPair JSONPair = mapper.apply(e); +- if (JSONPair != null) { +- object.put(JSONPair.key, JSONPair.val); +- } +- } +- return object; +- } +- +- /** +- * Simply stores a key and a value, used internally by many methods below. +- */ +- @SuppressWarnings("PublicInnerClass") +- public static class JSONPair { +- final String key; +- final Object val; +- +- JSONPair(@NotNull String key, @NotNull Object val) { +- this.key = key; +- this.val = val; +- } +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingIntMap.java b/src/main/java/co/aikar/util/LoadingIntMap.java +deleted file mode 100644 +index 5753b9bce89db2ac378ec41f1b61907cc2e23335..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingIntMap.java ++++ /dev/null +@@ -1,77 +0,0 @@ +-/* +- * Copyright (c) 2015. Starlis LLC / dba Empire Minecraft +- * +- * This source code is proprietary software and must not be redistributed without Starlis LLC's approval +- * +- */ +-package co.aikar.util; +- +- +-import com.google.common.base.Function; +-import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exist, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingIntMap extends Int2ObjectOpenHashMap { +- private final Function loader; +- +- public LoadingIntMap(@NotNull Function loader) { +- super(); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, @NotNull Function loader) { +- super(expectedSize); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, float loadFactor, @NotNull Function loader) { +- super(expectedSize, loadFactor); +- this.loader = loader; +- } +- +- +- @Nullable +- @Override +- public V get(int key) { +- V res = super.get(key); +- if (res == null) { +- res = loader.apply(key); +- if (res != null) { +- put(key, res); +- } +- } +- return res; +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java +deleted file mode 100644 +index 1786eeb5cbeaad75602c9c5649bbcd9b2af5cf81..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingMap.java ++++ /dev/null +@@ -1,369 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import com.google.common.base.Preconditions; +-import java.lang.reflect.Constructor; +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.HashMap; +-import java.util.IdentityHashMap; +-import java.util.Map; +-import java.util.Set; +-import java.util.function.Function; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exists, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Key +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingMap extends AbstractMap { +- private final Map backingMap; +- private final java.util.function.Function loader; +- +- /** +- * Initializes an auto loading map using specified loader and backing map +- * @param backingMap Map to wrap +- * @param loader Loader +- */ +- public LoadingMap(@NotNull Map backingMap, @NotNull java.util.function.Function loader) { +- this.backingMap = backingMap; +- this.loader = loader; +- } +- +- /** +- * Creates a new LoadingMap with the specified map and loader +- * +- * @param backingMap Actual map being used. +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map backingMap, @NotNull Function loader) { +- return new LoadingMap<>(backingMap, loader); +- } +- +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, @Nullable final Class keyClass, +- @NotNull final Class valueClass) { +- return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); +- } +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, +- @NotNull final Class valueClass) { +- return newAutoMap(backingMap, null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass) { +- return newAutoMap(new HashMap<>(), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass) { +- return newHashAutoMap(null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newHashAutoMap(null, valueClass, initialCapacity, loadFactor); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new HashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new HashMap<>(initialCapacity), loader); +- } +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity, float loadFactor) { +- return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new IdentityHashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); +- } +- +- @Override +- public int size() {return backingMap.size();} +- +- @Override +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- @Override +- public boolean containsKey(@Nullable Object key) {return backingMap.containsKey(key);} +- +- @Override +- public boolean containsValue(@Nullable Object value) {return backingMap.containsValue(value);} +- +- @Nullable +- @Override +- public V get(@Nullable Object key) { +- V v = backingMap.get(key); +- if (v != null) { +- return v; +- } +- return backingMap.computeIfAbsent((K) key, loader); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) {return backingMap.put(key, value);} +- +- @Nullable +- @Override +- public V remove(@Nullable Object key) {return backingMap.remove(key);} +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- @Override +- public void clear() {backingMap.clear();} +- +- @NotNull +- @Override +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- @Override +- public Collection values() {return backingMap.values();} +- +- @Override +- public boolean equals(@Nullable Object o) {return backingMap.equals(o);} +- +- @Override +- public int hashCode() {return backingMap.hashCode();} +- +- @NotNull +- @Override +- public Set> entrySet() { +- return backingMap.entrySet(); +- } +- +- @NotNull +- public LoadingMap clone() { +- return new LoadingMap<>(backingMap, loader); +- } +- +- private static class AutoInstantiatingLoader implements Function { +- final Constructor constructor; +- private final Class valueClass; +- +- AutoInstantiatingLoader(@Nullable Class keyClass, @NotNull Class valueClass) { +- try { +- this.valueClass = valueClass; +- if (keyClass != null) { +- constructor = valueClass.getConstructor(keyClass); +- } else { +- constructor = null; +- } +- } catch (NoSuchMethodException e) { +- throw new IllegalStateException( +- valueClass.getName() + " does not have a constructor for " + (keyClass != null ? keyClass.getName() : null)); +- } +- } +- +- @NotNull +- @Override +- public V apply(@Nullable K input) { +- try { +- return (constructor != null ? constructor.newInstance(input) : valueClass.newInstance()); +- } catch (Exception e) { +- throw new ExceptionInInitializerError(e); +- } +- } +- +- @Override +- public int hashCode() { +- return super.hashCode(); +- } +- +- @Override +- public boolean equals(Object object) { +- return false; +- } +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/MRUMapCache.java b/src/main/java/co/aikar/util/MRUMapCache.java +deleted file mode 100644 +index 3e61a926620a67daec3af54b72a1b911eaef2ed4..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/MRUMapCache.java ++++ /dev/null +@@ -1,112 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.Map; +-import java.util.Set; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Implements a Most Recently Used cache in front of a backing map, to quickly access the last accessed result. +- * +- * @param Key Type of the Map +- * @param Value Type of the Map +- */ +-@Deprecated(forRemoval = true) +-public class MRUMapCache extends AbstractMap { +- final Map backingMap; +- Object cacheKey; +- V cacheValue; +- public MRUMapCache(@NotNull final Map backingMap) { +- this.backingMap = backingMap; +- } +- +- public int size() {return backingMap.size();} +- +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- public boolean containsKey(@Nullable Object key) { +- return key != null && key.equals(cacheKey) || backingMap.containsKey(key); +- } +- +- public boolean containsValue(@Nullable Object value) { +- return value != null && value == cacheValue || backingMap.containsValue(value); +- } +- +- @Nullable +- public V get(@Nullable Object key) { +- if (cacheKey != null && cacheKey.equals(key)) { +- return cacheValue; +- } +- cacheKey = key; +- return cacheValue = backingMap.get(key); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) { +- cacheKey = key; +- return cacheValue = backingMap.put(key, value); +- } +- +- @Nullable +- public V remove(@Nullable Object key) { +- if (key != null && key.equals(cacheKey)) { +- cacheKey = null; +- } +- return backingMap.remove(key); +- } +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- public void clear() { +- cacheKey = null; +- cacheValue = null; +- backingMap.clear(); +- } +- +- @NotNull +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- public Collection values() {return backingMap.values();} +- +- @NotNull +- public Set> entrySet() {return backingMap.entrySet();} +- +- /** +- * Wraps the specified map with a most recently used cache +- * +- * @param map Map to be wrapped +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map map) { +- return new MRUMapCache(map); +- } +-} +diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java +index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..d16d1d6b9b625e0843f17c60b40e1c2df81fe378 100644 +--- a/src/main/java/org/bukkit/command/Command.java ++++ b/src/main/java/org/bukkit/command/Command.java +@@ -16,6 +16,7 @@ import org.bukkit.entity.minecart.CommandMinecart; + import org.bukkit.permissions.Permissible; + import org.bukkit.plugin.PluginDescriptionFile; + import org.bukkit.util.StringUtil; ++import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +@@ -42,7 +43,7 @@ public abstract class Command { + * @deprecated Timings will be removed in the future + */ + @Deprecated(forRemoval = true) +- @NotNull public String getTimingName() {return getName();} // Paper ++ @Contract(value = " -> fail", pure = true) @NotNull public final String getTimingName() {throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead.");} // Paper // Plazma - Completely remove timings + + protected Command(@NotNull String name) { + this(name, "", "/" + name, new ArrayList()); +diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java +index abe256e1e45ce28036da4aa1586715bc8a1a3414..0ce5ecb25703b568e62cdd52ba61ae35d9e27d9f 100644 +--- a/src/main/java/org/bukkit/command/FormattedCommandAlias.java ++++ b/src/main/java/org/bukkit/command/FormattedCommandAlias.java +@@ -12,7 +12,7 @@ public class FormattedCommandAlias extends Command { + + public FormattedCommandAlias(@NotNull String alias, @NotNull String[] formatStrings) { + super(alias); +- timings = co.aikar.timings.TimingsManager.getCommandTiming("minecraft", this); // Spigot ++ //timings = co.aikar.timings.TimingsManager.getCommandTiming("minecraft", this); // Spigot // Plazma - Completely remove timings + this.formatStrings = formatStrings; + } + +@@ -120,9 +120,11 @@ public class FormattedCommandAlias extends Command { + return formatString.trim(); // Paper - Causes an extra space at the end, breaks with brig commands + } + ++ /* // Plazma - Completely remove timings + @NotNull + @Override // Paper + public String getTimingName() {return "Command Forwarder - " + super.getTimingName();} // Paper ++ */ // Plazma - Completely remove timings + + private static boolean inRange(int i, int j, int k) { + return i >= j && i <= k; +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index 685aa9d73f14a5e3a85b251b83fbe8134b0a244c..24e99ec28607bf807456cfc1ff47bec991b45ef9 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -71,7 +71,7 @@ public class SimpleCommandMap implements CommandMap { + */ + @Override + public boolean register(@NotNull String label, @NotNull String fallbackPrefix, @NotNull Command command) { +- command.timings = co.aikar.timings.TimingsManager.getCommandTiming(fallbackPrefix, command); // Paper ++ //command.timings = co.aikar.timings.TimingsManager.getCommandTiming(fallbackPrefix, command); // Paper // Plazma - Completely remove timings + label = label.toLowerCase(Locale.ROOT).trim(); + fallbackPrefix = fallbackPrefix.toLowerCase(Locale.ROOT).trim(); + boolean registered = register(label, command, false, fallbackPrefix); +@@ -166,11 +166,13 @@ public class SimpleCommandMap implements CommandMap { + parsedArgs = event.getArgs(); + // Purpur end - ExecuteCommandEvent + ++ /* // Plazma - Completely remove timings + // Paper start - Plugins do weird things to workaround normal registration + if (target.timings == null) { + target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target); + } + // Paper end ++ */ // Plazma - Completely remove timings + + try { + //try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur - Remove Timings +diff --git a/src/main/java/org/bukkit/plugin/PluginManager.java b/src/main/java/org/bukkit/plugin/PluginManager.java +index 47153dee66782a00b980ecf15e8774ab6f3d887d..d996f70fdbf2b50da89a058786eb5bfb2c68cfd7 100644 +--- a/src/main/java/org/bukkit/plugin/PluginManager.java ++++ b/src/main/java/org/bukkit/plugin/PluginManager.java +@@ -312,7 +312,8 @@ public interface PluginManager extends io.papermc.paper.plugin.PermissionManager + * + * @return True if event timings are to be used + */ +- public boolean useTimings(); ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Plazma - Completely remove timings ++ default boolean useTimings() { throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); } // Plazma - Completely remove timings + + // Paper start + @org.jetbrains.annotations.ApiStatus.Internal +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index 001465eedafa51ac027a4db51cba6223edfe1171..9f2ca17201a4fcef3d0ce1895e3f7c4ec8f4979a 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -61,7 +61,7 @@ public final class SimplePluginManager implements PluginManager { + public final Map> defSubs = new HashMap>(); + public PluginManager paperPluginManager; + // Paper end +- private boolean useTimings = false; ++ //private boolean useTimings = false; // Plazma - Completely remove timings + + public SimplePluginManager(@NotNull Server instance, @NotNull SimpleCommandMap commandMap) { + server = instance; +@@ -720,12 +720,7 @@ public final class SimplePluginManager implements PluginManager { + throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); + } + +- executor = new co.aikar.timings.TimedEventExecutor(executor, plugin, null, event); // Paper +- if (false) { // Spigot - RL handles useTimings check now // Paper +- getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); +- } else { +- getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); +- } ++ getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); // Plazma - Completely remove timings + } + + @NotNull +@@ -953,21 +948,18 @@ public final class SimplePluginManager implements PluginManager { + return false; + } + ++ /* // Plazma - Completely remove timings + @Override + public boolean useTimings() { + if (true) {return this.paperPluginManager.useTimings();} // Paper + return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot + } + +- /** +- * Sets whether or not per event timing code should be used +- * +- * @param use True if per event timing code should be used +- */ + @Deprecated(forRemoval = true) + public void useTimings(boolean use) { + co.aikar.timings.Timings.setTimingsEnabled(use); // Paper + } ++ */ // Plazma - Completely remove timings + + // Paper start + public void clearPermissions() { +diff --git a/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java b/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java +index 1d76e30b82ca56bb4cf3b9a33f5a129ab829e3f0..14cf79a8d9af96811b8e1bf1b12f17c902f1913f 100644 +--- a/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java ++++ b/src/main/java/org/bukkit/plugin/TimedRegisteredListener.java +@@ -7,38 +7,28 @@ import org.bukkit.event.Listener; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + ++import org.jetbrains.annotations.Contract; // Plazma - Completely remove timings ++import io.papermc.paper.annotation.DoNotUse; // Plazma - Completely remove timings ++ + /** + * Extends RegisteredListener to include timing information + */ +-public class TimedRegisteredListener extends RegisteredListener { +- private int count; +- private long totalTime; +- private Class eventClass; +- private boolean multiple = false; ++@Deprecated(forRemoval = true) // Plazma - Completely remove timings ++public final class TimedRegisteredListener extends RegisteredListener { // Plazma - Completely remove timings + ++ @Contract(value = "_, _, _, _, _ -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public TimedRegisteredListener(@NotNull final Listener pluginListener, @NotNull final EventExecutor eventExecutor, @NotNull final EventPriority eventPriority, @NotNull final Plugin registeredPlugin, final boolean listenCancelled) { + super(pluginListener, eventExecutor, eventPriority, registeredPlugin, listenCancelled); ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + ++ @Contract(value = "_ -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + @Override + public void callEvent(@NotNull Event event) throws EventException { +- if (event.isAsynchronous()) { +- super.callEvent(event); +- return; +- } +- count++; +- Class newEventClass = event.getClass(); +- if (this.eventClass == null) { +- this.eventClass = newEventClass; +- } else if (!this.eventClass.equals(newEventClass)) { +- multiple = true; +- this.eventClass = getCommonSuperclass(newEventClass, this.eventClass).asSubclass(Event.class); +- } +- long start = System.nanoTime(); +- super.callEvent(event); +- totalTime += System.nanoTime() - start; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + ++ /* // Plazma - Completely remove timings + @NotNull + private static Class getCommonSuperclass(@NotNull Class class1, @NotNull Class class2) { + while (!class1.isAssignableFrom(class2)) { +@@ -46,13 +36,14 @@ public class TimedRegisteredListener extends RegisteredListener { + } + return class1; + } ++ */ // Plazma - Completely remove timings + + /** + * Resets the call count and total time for this listener + */ ++ @Contract(value = " -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public void reset() { +- count = 0; +- totalTime = 0; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -60,8 +51,9 @@ public class TimedRegisteredListener extends RegisteredListener { + * + * @return Times this listener has been called + */ ++ @Contract(value = " -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public int getCount() { +- return count; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -69,8 +61,9 @@ public class TimedRegisteredListener extends RegisteredListener { + * + * @return Total time for all calls of this listener + */ ++ @Contract(value = " -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public long getTotalTime() { +- return totalTime; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -84,9 +77,10 @@ public class TimedRegisteredListener extends RegisteredListener { + * + * @return the event class handled by this RegisteredListener + */ ++ @Contract(value = " -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + @Nullable + public Class getEventClass() { +- return eventClass; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + + /** +@@ -95,7 +89,8 @@ public class TimedRegisteredListener extends RegisteredListener { + * + * @return true if this listener has handled multiple events + */ ++ @Contract(value = " -> fail", pure = true) @Deprecated(forRemoval = true) @DoNotUse // Plazma - Completely remove timings + public boolean hasMultiple() { +- return multiple; ++ throw new UnsupportedOperationException("Timings feature was removed from Plazma. Use Spark instead."); // Plazma - Completely remove timings + } + } +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 065f182fbfe4541d602f57d548f286ee3c2fab19..fc62bd441f78417cad13eaa07a3f036d1c38bb30 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -39,11 +39,11 @@ import org.bukkit.plugin.PluginDescriptionFile; + import org.bukkit.plugin.PluginLoader; + import org.bukkit.plugin.RegisteredListener; + import org.bukkit.plugin.SimplePluginManager; +-import org.bukkit.plugin.TimedRegisteredListener; ++//import org.bukkit.plugin.TimedRegisteredListener; // Plazma - Completely remove timings + import org.bukkit.plugin.UnknownDependencyException; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; +-import org.spigotmc.CustomTimingsHandler; // Spigot ++//import org.spigotmc.CustomTimingsHandler; // Spigot // Plazma - Completely remove timings + import org.yaml.snakeyaml.error.YAMLException; + + /** +@@ -233,7 +233,7 @@ public final class JavaPluginLoader implements PluginLoader { + Preconditions.checkArgument(plugin != null, "Plugin can not be null"); + Preconditions.checkArgument(listener != null, "Listener can not be null"); + +- boolean useTimings = server.getPluginManager().useTimings(); ++ //boolean useTimings = server.getPluginManager().useTimings(); // Plazma - Completely remove timings + Map, Set> ret = new HashMap, Set>(); + Set methods; + try { +@@ -294,7 +294,7 @@ public final class JavaPluginLoader implements PluginLoader { + } + } + +- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper ++ EventExecutor executor = new EventExecutor() { // Paper // Plazma - Completely remove timings + @Override + public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper + try { +@@ -308,12 +308,8 @@ public final class JavaPluginLoader implements PluginLoader { + throw new EventException(t); + } + } +- }, plugin, method, eventClass); // Paper +- if (false) { // Spigot - RL handles useTimings check now +- eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); +- } else { +- eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); +- } ++ }; // Paper // Plazma - Completely remove timings ++ eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); // Plazma - Completely remove timings + } + return ret; + } +diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java +deleted file mode 100644 +index b4249da3eb26eae26ec000cc4d56cd21ac2fc6d5..0000000000000000000000000000000000000000 +--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java ++++ /dev/null +@@ -1,67 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package org.spigotmc; +- +-import org.bukkit.Bukkit; +-import org.jetbrains.annotations.NotNull; +-import org.bukkit.plugin.AuthorNagException; +-import co.aikar.timings.Timing; +-import co.aikar.timings.Timings; +-import co.aikar.timings.TimingsManager; +- +-import java.lang.reflect.Method; +-import java.util.logging.Level; +- +-/** +- * This is here for legacy purposes incase any plugin used it. +- * +- * If you use this, migrate ASAP as this will be removed in the future! +- * +- * @deprecated +- * @see co.aikar.timings.Timings#of +- */ +-@Deprecated(forRemoval = true) +-public final class CustomTimingsHandler { +- private final Timing handler; +- +- public CustomTimingsHandler(@NotNull String name) { +- Timing timing; +- +- new AuthorNagException("Deprecated use of CustomTimingsHandler. Timings has been removed.").printStackTrace(); +- try { +- final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class); +- ofSafe.setAccessible(true); +- timing = (Timing) ofSafe.invoke(null,"Minecraft", "(Deprecated API) " + name, null); +- } catch (Exception e) { +- e.printStackTrace(); +- Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered"); +- timing = Timings.NULL_HANDLER; +- } +- handler = timing; +- } +- +- public void startTiming() { /*handler.startTiming();*/ } // Purpur - Remove Timings +- public void stopTiming() { /*handler.stopTiming();*/ } // Purpur - Remove Timings +- +-} +diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java +index 37feafd626aaa17aba888d7ff13728b3c6f26d4d..c840d3efe018754d3188a4ed3dae9104044bd2a7 100644 +--- a/src/test/java/org/bukkit/AnnotationTest.java ++++ b/src/test/java/org/bukkit/AnnotationTest.java +@@ -50,14 +50,6 @@ public class AnnotationTest { + // Paper start + "io/papermc/paper/util/TransformingRandomAccessList", + "io/papermc/paper/util/TransformingRandomAccessList$TransformedListIterator", +- // Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull +- "co/aikar/timings/TimingHistory$2", +- "co/aikar/timings/TimingHistory$2$1", +- "co/aikar/timings/TimingHistory$2$1$1", +- "co/aikar/timings/TimingHistory$2$1$2", +- "co/aikar/timings/TimingHistory$3", +- "co/aikar/timings/TimingHistory$4", +- "co/aikar/timings/TimingHistoryEntry$1" + // Paper end + }; + +diff --git a/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java b/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java +deleted file mode 100644 +index 9ed416ed57676c845833736f93ed6088513c6da4..0000000000000000000000000000000000000000 +--- a/src/test/java/org/bukkit/plugin/TimedRegisteredListenerTest.java ++++ /dev/null +@@ -1,56 +0,0 @@ +-package org.bukkit.plugin; +- +-import static org.bukkit.support.MatcherAssert.*; +-import static org.hamcrest.Matchers.*; +-import org.bukkit.event.Event; +-import org.bukkit.event.EventException; +-import org.bukkit.event.EventPriority; +-import org.bukkit.event.Listener; +-import org.bukkit.event.block.BlockBreakEvent; +-import org.bukkit.event.player.PlayerEvent; +-import org.bukkit.event.player.PlayerInteractEvent; +-import org.bukkit.event.player.PlayerMoveEvent; +-import org.junit.jupiter.api.Test; +- +-public class TimedRegisteredListenerTest { +- +- @Test +- public void testEventClass() throws EventException { +- Listener listener = new Listener() {}; +- EventExecutor executor = new EventExecutor() { +- @Override +- public void execute(Listener listener, Event event) {} +- }; +- TestPlugin plugin = new TestPlugin("Test"); +- +- PlayerInteractEvent interactEvent = new PlayerInteractEvent(null, null, null, null, null); +- PlayerMoveEvent moveEvent = new PlayerMoveEvent(null, null, null); +- BlockBreakEvent breakEvent = new BlockBreakEvent(null, null); +- +- TimedRegisteredListener trl = new TimedRegisteredListener(listener, executor, EventPriority.NORMAL, plugin, false); +- +- // Ensure that the correct event type is reported for a single event +- trl.callEvent(interactEvent); +- assertThat(trl.getEventClass(), is((Object) PlayerInteractEvent.class)); +- // Ensure that no superclass is used in lieu of the actual event, after two identical event types +- trl.callEvent(interactEvent); +- assertThat(trl.getEventClass(), is((Object) PlayerInteractEvent.class)); +- // Ensure that the closest superclass of the two events is chosen +- trl.callEvent(moveEvent); +- assertThat(trl.getEventClass(), is((Object) PlayerEvent.class)); +- // As above, so below +- trl.callEvent(breakEvent); +- assertThat(trl.getEventClass(), is((Object) Event.class)); +- // In the name of being thorough, check that it never travels down the hierarchy again. +- trl.callEvent(breakEvent); +- assertThat(trl.getEventClass(), is((Object) Event.class)); +- +- trl = new TimedRegisteredListener(listener, executor, EventPriority.NORMAL, plugin, false); +- +- trl.callEvent(breakEvent); +- assertThat(trl.getEventClass(), is((Object) BlockBreakEvent.class)); +- // Test moving up the class hierarchy by more than one class at a time +- trl.callEvent(moveEvent); +- assertThat(trl.getEventClass(), is((Object) Event.class)); +- } +-} diff --git a/plazma-server/paper-patches/features/0001-Completely-remove-Timings.patch b/plazma-server/paper-patches/features/0001-Completely-remove-Timings.patch new file mode 100644 index 0000000..3b5eb28 --- /dev/null +++ b/plazma-server/paper-patches/features/0001-Completely-remove-Timings.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sun, 23 Feb 2025 19:54:00 +0900 +Subject: [PATCH] Completely remove Timings + + +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..7db570ec86a18566131f2df61a64971510fad2ba 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +@@ -1,6 +1,6 @@ + package io.papermc.paper.plugin.manager; + +-import co.aikar.timings.TimedEventExecutor; ++//import co.aikar.timings.TimedEventExecutor; // Plazma - Completely remove timings + import com.destroystokyo.paper.event.server.ServerExceptionEvent; + import com.destroystokyo.paper.exception.ServerEventException; + import com.google.common.collect.Sets; +@@ -95,7 +95,7 @@ class PaperEventManager { + throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); + } + +- executor = new TimedEventExecutor(executor, plugin, null, event); ++ //executor = new TimedEventExecutor(executor, plugin, null, event); // Plazma - Completely remove timings + this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); + } + +@@ -182,8 +182,8 @@ class PaperEventManager { + } + } + +- EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); +- eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); ++ //EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); // Plazma - Completely remove timings ++ eventSet.add(new RegisteredListener(listener, EventExecutor.create(method, eventClass), eh.priority(), plugin, eh.ignoreCancelled())); // Plazma - Completely remove timings + } + return ret; + } +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +index 097500a59336db1bbfffcd1aa4cff7a8586e46ec..ed3e37bba8941ddb4398243db543c5d8ab4f4472 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +@@ -230,10 +230,12 @@ public class PaperPluginManagerImpl implements PluginManager, DependencyContext + + // Etc + ++ /* // Plazma - Completely remove timings + @Override + public boolean useTimings() { + return co.aikar.timings.Timings.isTimingsEnabled(); + } ++ */ // Plazma - Completely remove timings + + @Override + public void registerInterface(@NotNull Class loader) throws IllegalArgumentException {