diff --git a/libs/common.versions.toml b/libs/common.versions.toml index 318b501..51062d0 100644 --- a/libs/common.versions.toml +++ b/libs/common.versions.toml @@ -42,6 +42,6 @@ adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-seri [bundles] asm = [ "asm-head", "asm-commons" ] -test = [ "jupiter", "hamcrest", "mockito", "asm-tree" ] +test = [ "jupiter", "hamcrest", "mockito", "asm-tree", "junit" ] maven = [ "maven-connector", "maven-transport" ] adventure = [ "adventure-api", "adventure-slf4j", "adventure-minimessage", "adventure-serializer-gson", "adventure-serializer-plain", "adventure-serializer-legacy" ] diff --git a/patches/generated-api/0001-Purpur-Generated-API-Changes.patch b/patches/generated-api/0001-Purpur-Generated-API-Changes.patch index dba4293..4a8d50a 100644 --- a/patches/generated-api/0001-Purpur-Generated-API-Changes.patch +++ b/patches/generated-api/0001-Purpur-Generated-API-Changes.patch @@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java -index 0241146..2718c0e 100644 +index 02411466bdcf4ff731f01ccebb2c99942e0db878..2718c0e5061838b01881bb231c53f4da348adce3 100644 --- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java +++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java @@ -436,6 +436,18 @@ public interface VanillaGoal extends Goal { diff --git a/patches/generated-api/0001-fixup.patch b/patches/generated-api/0001-fixup.patch deleted file mode 100644 index 32ae1a8..0000000 --- a/patches/generated-api/0001-fixup.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaKR93 -Date: Fri, 25 Oct 2024 14:10:19 +0900 -Subject: [PATCH] fixup - - -diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java -index 02411466bdcf4ff731f01ccebb2c99942e0db878..2718c0e5061838b01881bb231c53f4da348adce3 100644 ---- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java -+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java -@@ -436,6 +436,18 @@ public interface VanillaGoal extends Goal { - - GoalKey ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class); - -+ // Purpur start -+ GoalKey MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider")); -+ GoalKey HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider")); -+ GoalKey LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider")); -+ GoalKey FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal")); -+ GoalKey ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal")); -+ GoalKey DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager")); -+ GoalKey ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager")); -+ GoalKey AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf")); -+ GoalKey RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower")); -+ // Purpur end -+ - private static @NonNull GoalKey create(final @NonNull String key, - final @NonNull Class type) { - return GoalKey.of(type, NamespacedKey.minecraft(key)); diff --git a/patches/server/0006-Plazma-Configurations.patch b/patches/server/0006-Plazma-Configurations.patch index 1f99aba..f39f468 100644 --- a/patches/server/0006-Plazma-Configurations.patch +++ b/patches/server/0006-Plazma-Configurations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Plazma Configurations diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index 17e52f4b6..62efd5439 100644 +index 17e52f4b6b698c1f8148fc3c1038b3b142eb390b..dd4e77e106afdc3ce153dd9abb3ca997d3bc0163 100644 --- a/src/main/java/io/papermc/paper/configuration/Configurations.java +++ b/src/main/java/io/papermc/paper/configuration/Configurations.java @@ -39,27 +39,94 @@ public abstract class Configurations { @@ -157,7 +157,7 @@ index 17e52f4b6..62efd5439 100644 return node -> { ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type)); ObjectMapper.Mutable mutable = (ObjectMapper.Mutable) factory.get(type); -@@ -106,7 +177,7 @@ public abstract class Configurations { +@@ -106,19 +177,19 @@ public abstract class Configurations { } public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException { @@ -166,7 +166,12 @@ index 17e52f4b6..62efd5439 100644 } private void trySaveFileNode(YamlConfigurationLoader loader, ConfigurationNode node, String filename) throws ConfigurateException { -@@ -118,7 +189,7 @@ public abstract class Configurations { + try { + loader.save(node); + } catch (ConfigurateException ex) { +- if (ex.getCause() instanceof AccessDeniedException) LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex) else throw ex; // Plazma - Fork-friendly Rebranding ++ if (ex.getCause() instanceof AccessDeniedException) LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); else throw ex; // Plazma - Fork-friendly Rebranding + } } protected G initializeGlobalConfiguration(final CheckedFunction creator) throws ConfigurateException { @@ -295,7 +300,7 @@ index 17e52f4b6..62efd5439 100644 public static class ContextMap { diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index ee0d1df78..3807ab246 100644 +index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d1f26aa4a 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java @@ -135,6 +135,7 @@ public class PaperConfigurations extends Configurations builder +- .register(MapSerializer.TYPE, new MapSerializer(false)) +- .register(new EnumValueSerializer()) +- .register(new ComponentSerializer()) + .register(IntOr.Default.SERIALIZER) + .register(IntOr.Disabled.SERIALIZER) + .register(DoubleOr.Default.SERIALIZER) +@@ -181,6 +236,7 @@ public class PaperConfigurations extends Configurations options @@ -405,7 +443,7 @@ index ee0d1df78..3807ab246 100644 .serializers(serializers -> serializers .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2IntOpenHashMap::new, Integer.TYPE)) .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2LongOpenHashMap::new, Long.TYPE)) -@@ -256,12 +316,7 @@ public class PaperConfigurations extends Configurations 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { + this.lastSentMovement = vec3d1; @@ -647,7 +647,7 @@ index 28e3b73507b988f7234cbf29c4024c88180d0aef..6239c171ca996f3f5c23060f728a6223 + long getChunkCoordinateKey(); // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 75c8125e20b70433fe9d143a3193d821043327c3..d6005f01057c9d14fe4a019df67967db71c908ef 100644 +index 75c8125e20b70433fe9d143a3193d821043327c3..80511433c184c6918c8d2e7cff6ca257e8fbf676 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java @@ -66,6 +66,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -662,12 +662,12 @@ index 75c8125e20b70433fe9d143a3193d821043327c3..d6005f01057c9d14fe4a019df67967db public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) { this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key -+ this.nearbyPlayersCoordinateKey = io.papermc.paper.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks ++ this.nearbyPlayersCoordinateKey = ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks this.upgradeData = upgradeData; this.levelHeightAccessor = heightLimitView; this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; 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 a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..87f781e94c9a99a7592cc44507fc7ab8d465c5b6 100644 +index a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..9cc1a79dd25c63af6986e721ceff5560cf56b7d1 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -74,6 +74,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -697,16 +697,21 @@ index a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..87f781e94c9a99a7592cc44507fc7ab8 } private class BoundTickingBlockEntity implements TickingBlockEntity { -@@ -1025,7 +1029,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1024,10 +1028,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + private final T blockEntity; private final BlockEntityTicker ticker; private boolean loggedInvalidBlockState; ++ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity - BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) { + BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) { // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity this.blockEntity = (T) tileentity; // CraftBukkit - decompile error this.ticker = blockentityticker; ++ this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity } -@@ -1095,5 +1099,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + + @Override +@@ -1095,5 +1101,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return "Level ticker for " + s + "@" + String.valueOf(this.getPos()); } diff --git a/patches/server/0009-Always-agree-EULA-on-development-mode.patch b/patches/server/0010-Always-agree-EULA-on-development-mode.patch similarity index 85% rename from patches/server/0009-Always-agree-EULA-on-development-mode.patch rename to patches/server/0010-Always-agree-EULA-on-development-mode.patch index f8a2e1b..5e58d09 100644 --- a/patches/server/0009-Always-agree-EULA-on-development-mode.patch +++ b/patches/server/0010-Always-agree-EULA-on-development-mode.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Always agree EULA on development mode diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index ac2f6591dc6130f1877703c804a1359f3262f803..639a0624f5e746b9a876d62c3215c7856931deea 100644 +index 6fa07e7b0dd8d9d9788d6325622a39270fc30117..d5e908be62f6207b42162c9644c13cbe3c2d3850 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -167,6 +167,7 @@ public class Main { +@@ -179,6 +179,7 @@ public class Main { // Spigot Start boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" ); diff --git a/patches/server/0010-Add-more-metrics.patch b/patches/server/0011-Add-more-metrics.patch similarity index 100% rename from patches/server/0010-Add-more-metrics.patch rename to patches/server/0011-Add-more-metrics.patch diff --git a/patches/server/0011-Optimize-default-configurations.patch b/patches/server/0012-Optimize-default-configurations.patch similarity index 97% rename from patches/server/0011-Optimize-default-configurations.patch rename to patches/server/0012-Optimize-default-configurations.patch index 34295ad..4eaa99a 100644 --- a/patches/server/0011-Optimize-default-configurations.patch +++ b/patches/server/0012-Optimize-default-configurations.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Optimize default configurations - YouHaveTrouble/minecraft-exploits-and-how-to-fix-them diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -index 8f1645573..8e35f7fbe 100644 +index 8f1645573780d12bf29d441d31eab1b76cd9e70f..8e35f7fbe3629ab05c16f52d72a3cd7343cf835f 100644 --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -64,7 +64,7 @@ public class PufferfishConfig { @@ -67,7 +67,7 @@ index 8f1645573..8e35f7fbe 100644 "These values define a entity's maximum lifespan. If an", "entity is in this list and it has survived for longer than", diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index a9dd0e521..d417b773d 100644 +index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d8e4b9f6c 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -172,7 +172,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -124,7 +124,7 @@ index a9dd0e521..d417b773d 100644 public boolean loadPermissionsYmlBeforePlugins = true; @Constraints.Min(4) diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index c867796f6..ecced2072 100644 +index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae8368bec410b 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -100,12 +100,32 @@ public class WorldConfiguration extends ConfigurationPart { @@ -328,10 +328,10 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357 } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 639a0624f..e4b42f745 100644 +index d5e908be62f6207b42162c9644c13cbe3c2d3850..efcf937e2163386edac24b347b25ac84d744f975 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -152,7 +152,7 @@ public class Main { +@@ -164,7 +164,7 @@ public class Main { File configFile = (File) optionset.valueOf("bukkit-settings"); YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); configuration.options().copyDefaults(true); @@ -341,7 +341,7 @@ index 639a0624f..e4b42f745 100644 File commandFile = (File) optionset.valueOf("commands-settings"); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 5971f99c0..ef0f1598f 100644 +index 5971f99c047139d911e7f53937a193a6b5683bbb..ef0f1598f67ac1d305f116ef3a38c92c1eb0ab25 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings { + PlazmaConfigurations.LOGGER.warn("Invalid custom sea level block: {}, defaulting to lava", this.seaBlock); + return net.minecraft.world.level.block.Blocks.LAVA; diff --git a/patches/server/0021-Configurable-entity-sensor-tick.patch b/patches/server/0022-Configurable-entity-sensor-tick.patch similarity index 100% rename from patches/server/0021-Configurable-entity-sensor-tick.patch rename to patches/server/0022-Configurable-entity-sensor-tick.patch diff --git a/patches/server/0022-Variable-entity-wakeup-duration.patch b/patches/server/0023-Variable-entity-wakeup-duration.patch similarity index 100% rename from patches/server/0022-Variable-entity-wakeup-duration.patch rename to patches/server/0023-Variable-entity-wakeup-duration.patch diff --git a/patches/server/0023-Optimise-state-lookup-more.patch b/patches/server/0024-Optimise-state-lookup-more.patch similarity index 100% rename from patches/server/0023-Optimise-state-lookup-more.patch rename to patches/server/0024-Optimise-state-lookup-more.patch diff --git a/patches/server/0024-Skip-event-if-no-listeners.patch b/patches/server/0025-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0024-Skip-event-if-no-listeners.patch rename to patches/server/0025-Skip-event-if-no-listeners.patch diff --git a/patches/server/0025-Add-entity-spawn-deadlock-timer.patch b/patches/server/0026-Add-entity-spawn-deadlock-timer.patch similarity index 100% rename from patches/server/0025-Add-entity-spawn-deadlock-timer.patch rename to patches/server/0026-Add-entity-spawn-deadlock-timer.patch diff --git a/patches/server/0026-Lithium-HashedList.patch b/patches/server/0027-Lithium-HashedList.patch similarity index 100% rename from patches/server/0026-Lithium-HashedList.patch rename to patches/server/0027-Lithium-HashedList.patch diff --git a/patches/server/0027-Improve-SwingTime-ticking.patch b/patches/server/0028-Improve-SwingTime-ticking.patch similarity index 100% rename from patches/server/0027-Improve-SwingTime-ticking.patch rename to patches/server/0028-Improve-SwingTime-ticking.patch diff --git a/patches/server/0028-Save-Json-list-asynchronously.patch b/patches/server/0029-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0028-Save-Json-list-asynchronously.patch rename to patches/server/0029-Save-Json-list-asynchronously.patch diff --git a/patches/server/0029-Add-more-MSPT.patch b/patches/server/0030-Add-more-MSPT.patch similarity index 98% rename from patches/server/0029-Add-more-MSPT.patch rename to patches/server/0030-Add-more-MSPT.patch index 0e9a5e3..546182c 100644 --- a/patches/server/0029-Add-more-MSPT.patch +++ b/patches/server/0030-Add-more-MSPT.patch @@ -94,7 +94,7 @@ index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678 ) ); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c921595420939847bf91dc0cbb07faf3d815b02f..565d601f16f054cc5aa7eb4040e1bd6586f62b7d 100644 +index 9c6d4f3f763a6827d1d0260c1ed8512302838bfc..3db4711c19d17856e9235bf4568c63d932f57d00 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -260,8 +260,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop this.storageSource.getIconFile().filter(Files::isRegularFile)).map(Path::toFile).orElse(null); + try ( + java.io.InputStream stream = (file != null) @@ -65,10 +65,10 @@ index 565d601f16f054cc5aa7eb4040e1bd6586f62b7d..6db6ba1adde3cd2d76055de12d780251 public Optional getWorldScreenshotFile() { diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java -index 3e0e67c089e269d0bccd4a0d2de5ac1ac515997e..2e75ca5d2b7d8f35814fe9a0814b19a9135d80cb 100644 +index 1fe9af0ffc91626c712847df94ea31e19bb3c8a0..f446d1a793514ab19a4428294540d16c2f160a77 100644 --- a/src/main/java/org/plazmamc/plazma/Options.java +++ b/src/main/java/org/plazmamc/plazma/Options.java -@@ -8,5 +8,6 @@ public interface Options { +@@ -9,5 +9,6 @@ public interface Options { boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE; boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE; boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE; diff --git a/patches/server/0033-Implement-FreedomChat.patch b/patches/server/0034-Implement-FreedomChat.patch similarity index 97% rename from patches/server/0033-Implement-FreedomChat.patch rename to patches/server/0034-Implement-FreedomChat.patch index fc08ab8..abe4281 100644 --- a/patches/server/0033-Implement-FreedomChat.patch +++ b/patches/server/0034-Implement-FreedomChat.patch @@ -52,7 +52,7 @@ index f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9..69ff5380eedb3e0b214324dec50bb5c0 player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData); diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583b8234621 100644 +index ee11fe3ec418fc2d82dab5fc1380c4a0d370666d..d781a7ba785789c9657c94fb0d164e532daccc96 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -29,6 +29,15 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -73,7 +73,7 @@ index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583 @Setting("world-generation") diff --git a/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java new file mode 100644 -index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c4744f5f1b0 +index 0000000000000000000000000000000000000000..49290983ef6b63bbacdef30f774ce683228e5755 --- /dev/null +++ b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java @@ -0,0 +1,103 @@ @@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c47 +@ChannelHandler.Sharable +public class FreedomChat extends MessageToByteEncoder> { + -+ private static final StreamCodec> CODEC = GameProtocols.CLIENTBOUND ++ private static final StreamCodec> CODEC = GameProtocols.CLIENTBOUND_TEMPLATE + .bind(RegistryFriendlyByteBuf.decorator(MinecraftServer.getServer().registryAccess())).codec(); + + @Override diff --git a/patches/server/0034-Add-some-missing-Pufferfish-configurations.patch b/patches/server/0035-Add-some-missing-Pufferfish-configurations.patch similarity index 100% rename from patches/server/0034-Add-some-missing-Pufferfish-configurations.patch rename to patches/server/0035-Add-some-missing-Pufferfish-configurations.patch diff --git a/patches/unapplied/api/0001-Remove-remaining-timings-implementations.patch b/patches/unapplied/api/0001-Remove-remaining-timings-implementations.patch new file mode 100644 index 0000000..cd008de --- /dev/null +++ b/patches/unapplied/api/0001-Remove-remaining-timings-implementations.patch @@ -0,0 +1,2192 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Wed, 15 May 2024 12:43:03 +0900 +Subject: [PATCH] Remove remaining timings implementations + + +diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java +index 36b8fe86335df851f9c85d6bb2a91368b4d945d1..0f27c3959806aa7a7e8968fdb3659df54bec92aa 100644 +--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java ++++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java +@@ -1,86 +1,4 @@ + package co.aikar.timings; + +-import static co.aikar.timings.TimingsManager.*; +- +-import org.bukkit.Bukkit; +-import org.jetbrains.annotations.NotNull; +- + @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; +- } +-} ++interface FullServerTickHandler {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java +index 81671cf40feeed2844ee8d92348d48062aaf2c46..086213790ee15fe22a7d19452cdb498c49a95c4d 100644 +--- a/src/main/java/co/aikar/timings/NullTimingHandler.java ++++ b/src/main/java/co/aikar/timings/NullTimingHandler.java +@@ -1,69 +1,4 @@ +-/* +- * 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(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() { +- +- } +-} ++interface NullTimingHandler {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java +index 6fbc64e0f214d0c8e5afcbe385e414a4e1fe1c72..4399d4ed4183ed9b91c2ea68fd0b07c4bf8a098f 100644 +--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java ++++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java +@@ -1,90 +1,4 @@ +-/* +- * 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(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 +- executor.execute(listener, event); +- //} // Purpur +- } +- +- @Override +- @NotNull +- public String toString() { +- return "TimedEventExecutor['" + this.executor.toString() + "']"; +- } +-} ++interface TimedEventExecutor {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java +index 1d866e980abc542bdfee1ce082cd9cdd7761e9f7..e6b4d724f2a4540fbd59c36a5fe9526ab214df68 100644 +--- a/src/main/java/co/aikar/timings/Timing.java ++++ b/src/main/java/co/aikar/timings/Timing.java +@@ -39,6 +39,7 @@ public interface Timing extends AutoCloseable { + * @return Timing + */ + @NotNull ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTiming(); + +@@ -47,6 +48,7 @@ public interface Timing extends AutoCloseable { + * + * Will automatically be called when this Timing is used with try-with-resources + */ ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTiming(); + +@@ -58,6 +60,7 @@ public interface Timing extends AutoCloseable { + * @return Timing + */ + @NotNull ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + Timing startTimingIfSync(); + +@@ -68,13 +71,14 @@ public interface Timing extends AutoCloseable { + * + * But only if we are on the primary thread. + */ ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + void stopTimingIfSync(); + + /** + * @deprecated Doesn't do anything - Removed + */ +- @Deprecated ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + void abort(); + +@@ -84,9 +88,11 @@ public interface Timing extends AutoCloseable { + * @return TimingHandler + */ + @Nullable +- TimingHandler getTimingHandler(); ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations ++ Object getTimingHandler(); // Thunderbolt - Remove remaining timings implementations + + @Override ++ @Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations + @io.papermc.paper.annotation.DoNotUse // Purpur + void close(); + } +diff --git a/src/main/java/co/aikar/timings/TimingData.java b/src/main/java/co/aikar/timings/TimingData.java +index a5d13a1e44edb861f45c83a9b4309fbf799d407d..596fc185ecd2e7552b6e8b06b0814fc5bc5416ed 100644 +--- a/src/main/java/co/aikar/timings/TimingData.java ++++ b/src/main/java/co/aikar/timings/TimingData.java +@@ -1,122 +1,4 @@ +-/* +- * 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; +- } +-} ++@Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations ++interface TimingData {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java +index 3b3bcfa6fa2dbcc7fef899cc7570da097437ab3a..c8872cc0f5ffd3036ac53358e3f2c37782685a5f 100644 +--- a/src/main/java/co/aikar/timings/TimingHandler.java ++++ b/src/main/java/co/aikar/timings/TimingHandler.java +@@ -1,226 +1,4 @@ +-/* +- * 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 " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " 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; +- } +-} ++@Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations ++interface TimingHandler {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java +index 02e88db63be2d5e31da6b65157ba7b971b1f10f3..7ddaad45f563796b442ac3f5a757e78d5cb4bb5b 100644 +--- a/src/main/java/co/aikar/timings/TimingHistory.java ++++ b/src/main/java/co/aikar/timings/TimingHistory.java +@@ -1,355 +1,4 @@ +-/* +- * 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.*; +- + @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(), +- new Function, JSONPair>() { +- @NotNull +- @Override +- public JSONPair apply(Map.Entry 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; +- } +- } +-} ++interface TimingHistory {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingHistoryEntry.java b/src/main/java/co/aikar/timings/TimingHistoryEntry.java +index 86d5ac6bd0d7d0003688761aceb3f3343575319f..96cb33a8b1282dd04fe00b69231c78d41b52d92b 100644 +--- a/src/main/java/co/aikar/timings/TimingHistoryEntry.java ++++ b/src/main/java/co/aikar/timings/TimingHistoryEntry.java +@@ -1,58 +1,4 @@ +-/* +- * 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; +- } +-} ++@Deprecated(forRemoval = true) // Thunderbolt - Remove remaining timings implementations ++interface TimingHistoryEntry {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java +index df142a89b8c43acb81eb383eac0ef048a1f49a6e..a921bd54d2e5346081e96ecf4da1553e2b23ac9c 100644 +--- a/src/main/java/co/aikar/timings/TimingIdentifier.java ++++ b/src/main/java/co/aikar/timings/TimingIdentifier.java +@@ -1,116 +1,4 @@ +-/* +- * 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; +- } +- } +-} ++@Deprecated(forRemoval = true) ++interface TimingIdentifier {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java +index 752d54830aa8baa1450bf72da03ae55ed30293c2..8bbd2bfb06a9ba5ad7a87f9b54e048773a79490a 100644 +--- a/src/main/java/co/aikar/timings/Timings.java ++++ b/src/main/java/co/aikar/timings/Timings.java +@@ -44,18 +44,8 @@ import org.jetbrains.annotations.Nullable; + * @deprecated Timings will likely be replaced with Spark in the future + */ + @Deprecated(forRemoval = true) +-@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 +55,9 @@ public final class Timings { + * @param name Name of Timing + * @return Handler + */ +- @NotNull ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + 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 org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -86,11 +72,9 @@ public final class Timings { + * @param groupHandler Parent handler to mirror .start/stop calls to + * @return Timing Handler + */ +- @NotNull ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations // Thunderbolt - Remove remaining timings implementations + 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 org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -104,9 +88,9 @@ public final class Timings { + * @param name Name of Timing + * @return Timing Handler + */ +- @NotNull ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name) { +- return ofStart(plugin, name, null); ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -121,11 +105,9 @@ public final class Timings { + * @param groupHandler Parent handler to mirror .start/stop calls to + * @return Timing Handler + */ +- @NotNull ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static Timing ofStart(@NotNull Plugin plugin, @NotNull String name, @Nullable Timing groupHandler) { +- Timing timing = of(plugin, name, groupHandler); +- //timing.startTiming(); // Purpur +- return timing; ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -133,8 +115,9 @@ public final class Timings { + * + * @return Enabled or not + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static boolean isTimingsEnabled() { +- return timingsEnabled; ++ return false; // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -144,42 +127,9 @@ public final class Timings { + * + * @param enabled Should timings be reported + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static void setTimingsEnabled(boolean enabled) { +- // Purpur start - we don't do that here... +- timingsEnabled = false; +- //warnAboutDeprecationOnEnable(); +- //reset(); +- // Purpur end +- } +- +- private static void warnAboutDeprecationOnEnable() { +- if (timingsEnabled && !warnedAboutDeprecationOnEnable) { +- Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(deprecationMessage())); +- warnedAboutDeprecationOnEnable = true; +- } +- } +- +- public static Component deprecationMessage() { +- return Component.text() +- .color(TextColor.color(0xf3ef91)) +- .append(Component.text("[!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future.")) +- .append(Component.newline()) +- .append( +- Component.text(" We recommend installing the spark profiler as a replacement: ") +- .append( +- Component.text() +- .content("https://spark.lucko.me/") +- .clickEvent(ClickEvent.openUrl("https://spark.lucko.me/"))) +- ) +- .append(Component.newline()) +- .append( +- Component.text(" For more information please visit: ") +- .append( +- Component.text() +- .content("https://github.com/PaperMC/Paper/issues/8948") +- .clickEvent(ClickEvent.openUrl("https://github.com/PaperMC/Paper/issues/8948"))) +- ) +- .build(); ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -189,8 +139,9 @@ public final class Timings { + * + * @return Enabled or not + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static boolean isVerboseTimingsEnabled() { +- return verboseEnabled; ++ return false; // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -201,9 +152,9 @@ public final class Timings { + * + * @param enabled Should high-frequency timings be reported + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static void setVerboseTimingsEnabled(boolean enabled) { +- verboseEnabled = enabled; +- TimingsManager.needsRecheckEnabled = true; ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -213,8 +164,9 @@ public final class Timings { + * + * @return Interval in ticks + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static int getHistoryInterval() { +- return historyInterval; ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -227,12 +179,8 @@ public final class Timings { + * + * @param interval Interval in ticks + */ +- 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); +- } ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations ++ public static void setHistoryInterval(int interval) {throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -242,8 +190,9 @@ public final class Timings { + * + * @return Duration in Ticks + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static int getHistoryLength() { +- return historyLength; ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -257,30 +206,17 @@ public final class Timings { + * + * @param length Duration in ticks + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + 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 org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** + * Resets all Timing Data + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static void reset() { +- TimingsManager.reset(); ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -289,11 +225,9 @@ 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 + */ ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations + public static void generateReport(@Nullable CommandSender sender) { +- if (sender == null) { +- sender = Bukkit.getConsoleSender(); +- } +- requestingReport.add(sender); ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -301,39 +235,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); +- } +- +- /* +- ================= +- Protected API: These are for internal use only in Bukkit/CraftBukkit +- These do not have isPrimaryThread() checks in the startTiming/stopTiming +- ================= +- */ +- @NotNull +- static TimingHandler ofSafe(@NotNull String name) { +- return ofSafe(null, name, null); +- } +- +- @NotNull +- static Timing ofSafe(@Nullable Plugin plugin, @NotNull String name) { +- Timing pluginHandler = null; +- if (plugin != null) { +- pluginHandler = ofSafe(plugin.getName(), "Combined Total", TimingsManager.PLUGIN_GROUP_HANDLER); +- } +- return ofSafe(plugin != null ? plugin.getName() : "Minecraft - Invalid Plugin", name, pluginHandler); ++ @Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Thunderbolt - Remove remaining timings implementations ++ public static void generateReport(@NotNull Object sender) { // Thunderbolt - Remove remaining timings implementations ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations + } + +- @NotNull +- static TimingHandler ofSafe(@NotNull String name, @Nullable Timing groupHandler) { +- return ofSafe(null, name, groupHandler); +- } +- +- @NotNull +- static TimingHandler ofSafe(@Nullable String groupName, @NotNull String name, @Nullable Timing groupHandler) { +- return TimingsManager.getHandler(groupName, name, groupHandler); +- } + } + +diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java +index 1abfcee0f6d632f4cd8d74b4994a90c9ea9d254c..1a439fda970eec02c9da65b327da4a21f1afa795 100644 +--- a/src/main/java/co/aikar/timings/TimingsCommand.java ++++ b/src/main/java/co/aikar/timings/TimingsCommand.java +@@ -40,12 +40,12 @@ import static net.kyori.adventure.text.Component.text; + @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; ++ // private long lastResetAttempt = 0; + + public TimingsCommand(@NotNull String name) { + super(name); + this.description = "Manages Spigot Timings data to see performance of the server."; +- this.usageMessage = "/timings";// "; // Purpur ++ this.usageMessage = "/timings "; // Purpur // Thunderbolt + this.setPermission("bukkit.command.timings"); + } + +@@ -54,61 +54,12 @@ public class TimingsCommand extends BukkitCommand { + if (!testPermission(sender)) { + return true; + } +- if (true) { +- 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")); +- return true; +- } +- if (args.length < 1) { +- sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); +- return true; +- } +- final String arg = args[0]; +- if ("on".equalsIgnoreCase(arg)) { +- Timings.setTimingsEnabled(true); +- sender.sendMessage(text("Enabled Timings & Reset")); +- return true; +- } else if ("off".equalsIgnoreCase(arg)) { +- Timings.setTimingsEnabled(false); +- sender.sendMessage(text("Disabled Timings")); +- return true; +- } +- +- if (!Timings.isTimingsEnabled()) { +- sender.sendMessage(text("Please enable timings by typing /timings on")); +- return true; +- } +- +- long now = System.currentTimeMillis(); +- if ("verbon".equalsIgnoreCase(arg)) { +- Timings.setVerboseTimingsEnabled(true); +- sender.sendMessage(text("Enabled Verbose Timings")); +- return true; +- } else if ("verboff".equalsIgnoreCase(arg)) { +- Timings.setVerboseTimingsEnabled(false); +- sender.sendMessage(text("Disabled Verbose Timings")); +- return true; +- } else if ("reset".equalsIgnoreCase(arg)) { +- if (now - lastResetAttempt < 30000) { +- TimingsManager.reset(); +- sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED)); +- } else { +- lastResetAttempt = now; +- sender.sendMessage(text("WARNING: Timings v2 should not be reset. If you are experiencing lag, please wait 3 minutes and then issue a report. The best timings will include 10+ minutes, with data before and after your lag period. If you really want to reset, run this command again within 30 seconds.", NamedTextColor.RED)); +- } +- } else if ( +- "paste".equalsIgnoreCase(arg) || +- "report".equalsIgnoreCase(arg) || +- "get".equalsIgnoreCase(arg) || +- "merged".equalsIgnoreCase(arg) || +- "separate".equalsIgnoreCase(arg) +- ) { +- Timings.generateReport(sender); +- } else { +- sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED)); +- } ++ // Thunderbolt start - Remove remaining timings implementations ++ 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")); ++ // Thunderbolt end - Remove remaining timings implementations + return true; + } + +@@ -119,9 +70,9 @@ public class TimingsCommand extends BukkitCommand { + Preconditions.checkNotNull(args, "Arguments cannot be null"); + Preconditions.checkNotNull(alias, "Alias cannot be null"); + +- if (false && args.length == 1) { // Purpur ++ if (args.length == 1) { // Purpur // Thunderbolt + return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, +- new ArrayList(TIMINGS_SUBCOMMANDS.size())); ++ new ArrayList<>(TIMINGS_SUBCOMMANDS.size())); // Thunderbolt + } + return ImmutableList.of(); + } +diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java +index 5e1558ca3ffeeaf2645fa003965474a442d650bf..9d6038dbaa13c5bfa3e0cea8f62544b97b7541d1 100644 +--- a/src/main/java/co/aikar/timings/TimingsManager.java ++++ b/src/main/java/co/aikar/timings/TimingsManager.java +@@ -1,192 +1,4 @@ +-/* +- * 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 likely be replaced with Spark 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; +- } +-} ++interface TimingsManager {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java +index 3af5b8ea795311582044c712de50d29412024b77..6c3c30f98a38b5f04118060b695ae3458607a226 100644 +--- a/src/main/java/co/aikar/timings/TimingsReportListener.java ++++ b/src/main/java/co/aikar/timings/TimingsReportListener.java +@@ -1,87 +1,4 @@ + 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(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()); +- } +- } +-} ++interface TimingsReportListener {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java +index 632c4961515f5052551f841cfa840e60bba7a257..44df4bbde43d23027bf5d637aa933dcad7edc26a 100644 +--- a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java ++++ b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java +@@ -1,53 +1,4 @@ +-/* +- * 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(); +- } +-} ++@Deprecated(forRemoval = true) ++interface UnsafeTimingHandler {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 0e9ccfee7a03d341e7c4d271f53b4ed168b404ef..d133ddba0355835412dd16d2bf1a8b4b4ed00545 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -40,7 +40,7 @@ public interface UnsafeValues { + net.kyori.adventure.text.Component resolveWithContext(net.kyori.adventure.text.Component component, org.bukkit.command.CommandSender context, org.bukkit.entity.Entity scoreboardSubject, boolean bypassPermissions) throws java.io.IOException; + // Paper end + +- void reportTimings(); // Paper ++ // void reportTimings(); // Paper // Thunderbolt - Remove remaining timings implementations + Material toLegacy(Material material); + + Material fromLegacy(Material material); +@@ -154,7 +154,7 @@ public interface UnsafeValues { + * Server name to report to timings v2 + * @return name + */ +- String getTimingsServerName(); ++ // String getTimingsServerName(); // Thunderbolt - Remove remaining timings implementations + + /** + * Called once by the version command on first use, then cached. +diff --git a/src/main/java/org/bukkit/command/FormattedCommandAlias.java b/src/main/java/org/bukkit/command/FormattedCommandAlias.java +index abe256e1e45ce28036da4aa1586715bc8a1a3414..cf055d721c4c66eba9479ad88f3b6a514bf9677d 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 // Thunderbolt - Remove remaining timings implementations + this.formatStrings = formatStrings; + } + +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index fdedac32544be6534288c8ba28abe7f5c4c56f3b..2e40b577333e251c90871ee4b534e85f6b226c73 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -70,7 +70,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 // Thunderbolt - Remove remaining timings implementations + label = label.toLowerCase(java.util.Locale.ENGLISH).trim(); + fallbackPrefix = fallbackPrefix.toLowerCase(java.util.Locale.ENGLISH).trim(); + boolean registered = register(label, command, false, fallbackPrefix); +@@ -165,11 +165,13 @@ public class SimpleCommandMap implements CommandMap { + parsedArgs = event.getArgs(); + // Purpur end + ++ /* // Thunderbolt - Remove remaining timings implementations + // 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 ++ */ // Thunderbolt - Remove remaining timings implementations + + try { + //try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources // Purpur +diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +index 5dc64d8c9aeae612fd31af0673f3530a9e777dfc..62242daa0bd7851479748cd62627f51cfe6bc6f1 100644 +--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java ++++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +@@ -60,7 +60,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; // Thunderbolt - Remove remaining timings implementations + + public SimplePluginManager(@NotNull Server instance, @NotNull SimpleCommandMap commandMap) { + server = instance; +@@ -723,7 +723,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 ++ // executor = new co.aikar.timings.TimedEventExecutor(executor, plugin, null, event); // Paper // Thunderbolt - Remove remaining timings implementations + if (false) { // Spigot - RL handles useTimings check now // Paper + getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); + } else { +@@ -958,8 +958,9 @@ public final class SimplePluginManager implements PluginManager { + + @Override + public boolean useTimings() { +- if (true) {return this.paperPluginManager.useTimings();} // Paper +- return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot ++ // if (true) {return this.paperPluginManager.useTimings();} // Paper ++ // return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot ++ return false; // Thunderbolt - Remove remaining timings implementations + } + + /** +@@ -968,7 +969,8 @@ public final class SimplePluginManager implements PluginManager { + * @param use True if per event timing code should be used + */ + public void useTimings(boolean use) { +- co.aikar.timings.Timings.setTimingsEnabled(use); // Paper ++ // co.aikar.timings.Timings.setTimingsEnabled(use); // Paper // Thunderbolt - Remove remaining timings implementations ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations // Thunderbolt - Remove remaining timings implementations + } + + // Paper start +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index 0c6ca7588fb3d6b6497ddf032fe75e5c6c9719e5..e413370a3e1634483f75464cae7e81e1d03f665e 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -43,7 +43,7 @@ import org.bukkit.plugin.TimedRegisteredListener; + 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 // Thunderbolt - Remove remaining timings implementations + import org.yaml.snakeyaml.error.YAMLException; + + /** +@@ -294,21 +294,21 @@ public final class JavaPluginLoader implements PluginLoader { + } + } + +- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper +- @Override +- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper +- try { +- if (!eventClass.isAssignableFrom(event.getClass())) { +- return; +- } +- method.invoke(listener, event); +- } catch (InvocationTargetException ex) { +- throw new EventException(ex.getCause()); +- } catch (Throwable t) { +- throw new EventException(t); ++ // Thunderbolt start - Remove remaining timings implementations ++ // Paper ++ EventExecutor executor = (listener1, event) -> { // Paper ++ try { ++ if (!eventClass.isAssignableFrom(event.getClass())) { ++ return; + } ++ method.invoke(listener1, event); ++ } catch (InvocationTargetException ex) { ++ throw new EventException(ex.getCause()); ++ } catch (Throwable t) { ++ throw new EventException(t); + } +- }, plugin, method, eventClass); // Paper ++ }; // Paper ++ // Thunderbolt end - Remove remaining timings implementations + if (false) { // Spigot - RL handles useTimings check now + eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } else { +diff --git a/src/main/java/org/plazmamc/thunderbolt/DeprecatedException.java b/src/main/java/org/plazmamc/thunderbolt/DeprecatedException.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d7c6e3b39b3a9977b07b9761c3d884ff68d56ee9 +--- /dev/null ++++ b/src/main/java/org/plazmamc/thunderbolt/DeprecatedException.java +@@ -0,0 +1,7 @@ ++package org.plazmamc.thunderbolt; ++ ++public class DeprecatedException extends RuntimeException { ++ public DeprecatedException(String message) { ++ super(message); ++ } ++} +diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java +index 9c2d605c50cbf9aefa56ec209df9f6cea1392e89..ba99e25371031042b14fc483aab2697e17fb79b7 100644 +--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java ++++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java +@@ -26,9 +26,9 @@ 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 co.aikar.timings.Timing; // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.Timings; // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.TimingsManager; // Thunderbolt - Remove remaining timings implementations + + import java.lang.reflect.Method; + import java.util.logging.Level; +@@ -43,9 +43,10 @@ import java.util.logging.Level; + */ + @Deprecated(forRemoval = true) + public final class CustomTimingsHandler { +- private final Timing handler; ++ // private final Timing handler; // Thunderbolt - Remove remaining timings implementations + + public CustomTimingsHandler(@NotNull String name) { ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); /* // Thunderbolt - Remove remaining timings implementations /* + Timing timing; + + new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace(); +@@ -59,9 +60,19 @@ public final class CustomTimingsHandler { + timing = Timings.NULL_HANDLER; + } + handler = timing; ++ */ // Thunderbolt - Remove remaining timings implementations + } + +- public void startTiming() { /*handler.startTiming();*/ } // Purpur +- public void stopTiming() { /*handler.stopTiming();*/ } // Purpur ++ // Thunderbolt start - Remove remaining timings implementations ++ public void startTiming() { ++ /*handler.startTiming();*/ // Purpur ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations ++ } ++ ++ public void stopTiming() { ++ /*handler.stopTiming();*/ // Purpur ++ throw new org.plazmamc.thunderbolt.DeprecatedException("Timings is deprecated and will be removed in the future. Use Spark instead."); // Thunderbolt - Remove remaining timings implementations ++ } ++ // Thunderbolt end - Remove remaining timings implementations + + } diff --git a/patches/unapplied/server/0001-Remove-remaining-timings-implementations.patch b/patches/unapplied/server/0001-Remove-remaining-timings-implementations.patch new file mode 100644 index 0000000..f820be2 --- /dev/null +++ b/patches/unapplied/server/0001-Remove-remaining-timings-implementations.patch @@ -0,0 +1,1264 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Wed, 15 May 2024 14:12:50 +0900 +Subject: [PATCH] Remove remaining timings implementations + + +diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java +index 4b467f1af93452d13829f756d55dee18b8889d40..0a35e272c913df99ac12e87383bb9c7351e9fdb7 100644 +--- a/src/main/java/co/aikar/timings/MinecraftTimings.java ++++ b/src/main/java/co/aikar/timings/MinecraftTimings.java +@@ -1,181 +1,4 @@ + package co.aikar.timings; + +-import com.google.common.collect.MapMaker; +-import io.papermc.paper.configuration.GlobalConfiguration; +-import net.minecraft.commands.functions.CommandFunction; +-import net.minecraft.network.protocol.Packet; +-import net.minecraft.world.level.block.Block; +-import net.minecraft.world.level.block.entity.BlockEntity; +-import org.bukkit.plugin.Plugin; +-import org.bukkit.scheduler.BukkitTask; +- +-import org.bukkit.craftbukkit.scheduler.CraftTask; +- +-import java.util.Map; +- +-// TODO: Re-implement missing timers + @Deprecated(forRemoval = true) +-public final class MinecraftTimings { +- +- public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep"); +- public static final Timing playerListTimer = Timings.ofSafe("Player List"); +- public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions"); +- public static final Timing connectionTimer = Timings.ofSafe("Connection Handler"); +- public static final Timing tickablesTimer = Timings.ofSafe("Tickables"); +- public static final Timing minecraftSchedulerTimer = Timings.ofSafe("Minecraft Scheduler"); +- public static final Timing bukkitSchedulerTimer = Timings.ofSafe("Bukkit Scheduler"); +- public static final Timing bukkitSchedulerPendingTimer = Timings.ofSafe("Bukkit Scheduler - Pending"); +- public static final Timing bukkitSchedulerFinishTimer = Timings.ofSafe("Bukkit Scheduler - Finishing"); +- public static final Timing chunkIOTickTimer = Timings.ofSafe("ChunkIOTick"); +- public static final Timing timeUpdateTimer = Timings.ofSafe("Time Update"); +- public static final Timing serverCommandTimer = Timings.ofSafe("Server Command"); +- public static final Timing savePlayers = Timings.ofSafe("Save Players"); +- +- public static final Timing tickEntityTimer = Timings.ofSafe("## tickEntity"); +- public static final Timing tickTileEntityTimer = Timings.ofSafe("## tickTileEntity"); +- public static final Timing packetProcessTimer = Timings.ofSafe("## Packet Processing"); +- public static final Timing scheduledBlocksTimer = Timings.ofSafe("## Scheduled Blocks"); +- public static final Timing structureGenerationTimer = Timings.ofSafe("Structure Generation"); +- +- public static final Timing processQueueTimer = Timings.ofSafe("processQueue"); +- public static final Timing processTasksTimer = Timings.ofSafe("processTasks"); +- +- public static final Timing playerCommandTimer = Timings.ofSafe("playerCommand"); +- +- public static final Timing entityActivationCheckTimer = Timings.ofSafe("entityActivationCheck"); +- +- public static final Timing antiXrayUpdateTimer = Timings.ofSafe("anti-xray - update"); +- public static final Timing antiXrayObfuscateTimer = Timings.ofSafe("anti-xray - obfuscate"); +- public static final Timing scoreboardScoreSearch = Timings.ofSafe("Scoreboard score search"); // Paper - add timings for scoreboard search +- public static final Timing distanceManagerTick = Timings.ofSafe("Distance Manager Tick"); // Paper - add timings for distance manager +- +- public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks"); +- +- private static final Map, String> taskNameCache = new MapMaker().weakKeys().makeMap(); +- +- private MinecraftTimings() {} +- +- public static Timing getInternalTaskName(String taskName) { +- return Timings.ofSafe(taskName); +- } +- +- /** +- * Gets a timer associated with a plugins tasks. +- * @param bukkitTask +- * @param period +- * @return +- */ +- public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) { +- if (!bukkitTask.isSync()) { +- return NullTimingHandler.NULL; +- } +- Plugin plugin; +- +- CraftTask craftTask = (CraftTask) bukkitTask; +- +- final Class taskClass = craftTask.getTaskClass(); +- if (bukkitTask.getOwner() != null) { +- plugin = bukkitTask.getOwner(); +- } else { +- plugin = TimingsManager.getPluginByClassloader(taskClass); +- } +- +- final String taskname = taskNameCache.computeIfAbsent(taskClass, clazz -> { +- try { +- String clsName = !clazz.isMemberClass() +- ? clazz.getName() +- : clazz.getCanonicalName(); +- if (clsName != null && clsName.contains("$Lambda$")) { +- clsName = clsName.replaceAll("(Lambda\\$.*?)/.*", "$1"); +- } +- return clsName != null ? clsName : "UnknownTask"; +- } catch (Throwable ex) { +- new Exception("Error occurred detecting class name", ex).printStackTrace(); +- return "MangledClassFile"; +- } +- }); +- +- StringBuilder name = new StringBuilder(64); +- name.append("Task: ").append(taskname); +- if (period > 0) { +- name.append(" (interval:").append(period).append(")"); +- } else { +- name.append(" (Single)"); +- } +- +- if (plugin == null) { +- return Timings.ofSafe(null, name.toString()); +- } +- +- return Timings.ofSafe(plugin, name.toString()); +- } +- +- /** +- * Get a named timer for the specified entity type to track type specific timings. +- * @param entityType +- * @return +- */ +- public static Timing getEntityTimings(String entityType, String type) { +- return Timings.ofSafe("Minecraft", "## tickEntity - " + entityType + " - " + type, tickEntityTimer); +- } +- +- public static Timing getBehaviorTimings(String type) { +- return Timings.ofSafe("## Behavior - " + type); +- } +- +- public static Timing getSensorTimings(String type, int rate) { +- return Timings.ofSafe("## Sensor - " + type + " (Default rate: " + rate + ")"); +- } +- +- /** +- * Get a named timer for the specified tile entity type to track type specific timings. +- * @param entity +- * @return +- */ +- public static Timing getTileEntityTimings(BlockEntity entity) { +- String entityType = entity.getClass().getName(); +- return Timings.ofSafe("Minecraft", "## tickTileEntity - " + entityType, tickTileEntityTimer); +- } +- public static Timing getCancelTasksTimer() { +- return Timings.ofSafe("Cancel Tasks"); +- } +- public static Timing getCancelTasksTimer(Plugin plugin) { +- return Timings.ofSafe(plugin, "Cancel Tasks"); +- } +- +- public static void stopServer() { +- TimingsManager.stopServer(); +- } +- +- public static Timing getBlockTiming(Block block) { +- return Timings.ofSafe("## Scheduled Block: " + block.toString(), scheduledBlocksTimer); +- } +-/* +- public static Timing getStructureTiming(StructureGenerator structureGenerator) { +- return Timings.ofSafe("Structure Generator - " + structureGenerator.getName(), structureGenerationTimer); +- }*/ +- +- public static Timing getPacketTiming(Packet packet) { +- return Timings.ofSafe("## Packet - " + packet.getClass().getName(), packetProcessTimer); +- } +- +- public static Timing getCommandFunctionTiming(CommandFunction function) { +- return Timings.ofSafe("Command Function - " + function.id()); +- } +- +- public static void processConfig(GlobalConfiguration.Timings config) { +- TimingsManager.url = config.url; +- if (!TimingsManager.url.endsWith("/")) { +- TimingsManager.url += "/"; +- } +- TimingsManager.privacy = config.serverNamePrivacy; +- if (!config.hiddenConfigEntries.contains("proxies.velocity.secret")) { +- config.hiddenConfigEntries.add("proxies.velocity.secret"); +- } +- TimingsManager.hiddenConfigs.addAll(config.hiddenConfigEntries); +- co.aikar.timings.Timings.setVerboseTimingsEnabled(config.verbose); +- co.aikar.timings.Timings.setTimingsEnabled(config.enabled); +- co.aikar.timings.Timings.setHistoryInterval(config.historyInterval * 20); +- co.aikar.timings.Timings.setHistoryLength(config.historyLength * 20); +- } +-} ++interface MinecraftTimings {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java +index b35a9f4c5f8960864c402ede8a51fb5ab9c4fcc0..89c4d2cffb0bd3173070f8f241f45bdfe40fcfeb 100644 +--- a/src/main/java/co/aikar/timings/TimingsExport.java ++++ b/src/main/java/co/aikar/timings/TimingsExport.java +@@ -1,389 +1,4 @@ +-/* +- * 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.collect.Sets; +-import io.papermc.paper.adventure.PaperAdventure; +-import net.kyori.adventure.text.event.ClickEvent; +-import net.kyori.adventure.text.format.NamedTextColor; +-import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +-import net.minecraft.server.MinecraftServer; +-import org.apache.commons.lang.StringUtils; +-import org.bukkit.Bukkit; +-import org.bukkit.Material; +-import org.bukkit.configuration.ConfigurationSection; +-import org.bukkit.configuration.MemorySection; +-import org.bukkit.entity.EntityType; +-import org.json.simple.JSONObject; +-import org.json.simple.JSONValue; +-import oshi.SystemInfo; +-import oshi.hardware.HardwareAbstractionLayer; +- +-import java.io.ByteArrayOutputStream; +-import java.io.IOException; +-import java.io.InputStream; +-import java.io.OutputStream; +-import java.lang.management.ManagementFactory; +-import java.lang.management.OperatingSystemMXBean; +-import java.lang.management.RuntimeMXBean; +-import java.net.HttpURLConnection; +-import java.net.InetAddress; +-import java.net.URL; +-import java.util.List; +-import java.util.Map; +-import java.util.Set; +-import java.util.logging.Level; +-import java.util.zip.GZIPOutputStream; +- +-import static co.aikar.timings.TimingsManager.HISTORY; +-import static co.aikar.util.JSONUtil.appendObjectData; +-import static co.aikar.util.JSONUtil.createObject; +-import static co.aikar.util.JSONUtil.pair; +-import static co.aikar.util.JSONUtil.toArray; +-import static co.aikar.util.JSONUtil.toArrayMapper; +-import static co.aikar.util.JSONUtil.toObjectMapper; +-import static net.kyori.adventure.text.Component.text; +- +-@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) + @Deprecated(forRemoval = true) +-public class TimingsExport extends Thread { +- +- private final TimingsReportListener listeners; +- private final Map out; +- private final TimingHistory[] history; +- private static long lastReport = 0; +- +- private TimingsExport(TimingsReportListener listeners, Map out, TimingHistory[] history) { +- super("Timings paste thread"); +- this.listeners = listeners; +- this.out = out; +- this.history = history; +- } +- +- /** +- * Checks if any pending reports are being requested, and builds one if needed. +- */ +- public static void reportTimings() { +- if (Timings.requestingReport.isEmpty()) { +- return; +- } +- TimingsReportListener listeners = new TimingsReportListener(Timings.requestingReport); +- listeners.addConsoleIfNeeded(); +- +- Timings.requestingReport.clear(); +- long now = System.currentTimeMillis(); +- final long lastReportDiff = now - lastReport; +- if (lastReportDiff < 60000) { +- listeners.sendMessage(text("Please wait at least 1 minute in between Timings reports. (" + (int)((60000 - lastReportDiff) / 1000) + " seconds)", NamedTextColor.RED)); +- listeners.done(); +- return; +- } +- final long lastStartDiff = now - TimingsManager.timingStart; +- if (lastStartDiff < 180000) { +- listeners.sendMessage(text("Please wait at least 3 minutes before generating a Timings report. Unlike Timings v1, v2 benefits from longer timings and is not as useful with short timings. (" + (int)((180000 - lastStartDiff) / 1000) + " seconds)", NamedTextColor.RED)); +- listeners.done(); +- return; +- } +- listeners.sendMessage(text("Preparing Timings Report...", NamedTextColor.GREEN)); +- lastReport = now; +- Map parent = createObject( +- // Get some basic system details about the server +- pair("version", Bukkit.getVersion()), +- pair("maxplayers", Bukkit.getMaxPlayers()), +- pair("start", TimingsManager.timingStart / 1000), +- pair("end", System.currentTimeMillis() / 1000), +- pair("online-mode", Bukkit.getServer().getOnlineMode()), +- pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000), +- pair("datapacks", toArrayMapper(MinecraftServer.getServer().getPackRepository().getSelectedPacks(), pack -> { +- return PlainTextComponentSerializer.plainText().serialize(PaperAdventure.asAdventure(pack.getChatLink(true))); +- })) +- ); +- if (!TimingsManager.privacy) { +- appendObjectData(parent, +- pair("server", Bukkit.getUnsafe().getTimingsServerName()), +- pair("motd", Bukkit.getServer().getMotd()), +- pair("icon", Bukkit.getServer().getServerIcon().getData()) +- ); +- } +- +- final Runtime runtime = Runtime.getRuntime(); +- RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); +- +- OperatingSystemMXBean osInfo = ManagementFactory.getOperatingSystemMXBean(); +- +- HardwareAbstractionLayer hardwareInfo = new SystemInfo().getHardware(); +- +- parent.put("system", createObject( +- pair("timingcost", getCost()), +- pair("loadavg", osInfo.getSystemLoadAverage()), +- pair("name", System.getProperty("os.name")), +- pair("version", System.getProperty("os.version")), +- pair("jvmversion", System.getProperty("java.version")), +- pair("jvmvendor", System.getProperty("java.vendor")), +- pair("jvmvendorversion", System.getProperty("java.vendor.version")), +- pair("arch", System.getProperty("os.arch")), +- pair("maxmem", runtime.maxMemory()), +- pair("memory", createObject( +- pair("heap", ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().toString()), +- pair("nonheap", ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().toString()), +- pair("finalizing", ManagementFactory.getMemoryMXBean().getObjectPendingFinalizationCount()) +- )), +- pair("cpu", runtime.availableProcessors()), +- pair("cpuname", hardwareInfo.getProcessor().getProcessorIdentifier().getName().trim()), +- pair("runtime", runtimeBean.getUptime()), +- pair("flags", StringUtils.join(runtimeBean.getInputArguments(), " ")), +- pair("gc", toObjectMapper(ManagementFactory.getGarbageCollectorMXBeans(), input -> pair(input.getName(), toArray(input.getCollectionCount(), input.getCollectionTime())))) +- ) +- ); +- +- parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getAllLevels(), world -> { +- if (world.getWorld().getName().equals("worldeditregentempworld")) return null; +- return pair(world.getWorld().getName(), createObject( +- pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { +- return pair(rule, world.getWorld().getGameRuleValue(rule)); +- })), +- pair("ticking-distance", world.getWorld().getSimulationDistance()), +- pair("no-ticking-distance", world.getWorld().getViewDistance()), +- pair("sending-distance", world.getWorld().getSendViewDistance()) +- )); +- })); +- +- Set tileEntityTypeSet = Sets.newHashSet(); +- Set entityTypeSet = Sets.newHashSet(); +- +- int size = HISTORY.size(); +- TimingHistory[] history = new TimingHistory[size + 1]; +- int i = 0; +- for (TimingHistory timingHistory : HISTORY) { +- tileEntityTypeSet.addAll(timingHistory.tileEntityTypeSet); +- entityTypeSet.addAll(timingHistory.entityTypeSet); +- history[i++] = timingHistory; +- } +- +- history[i] = new TimingHistory(); // Current snapshot +- tileEntityTypeSet.addAll(history[i].tileEntityTypeSet); +- entityTypeSet.addAll(history[i].entityTypeSet); +- +- +- Map handlers = createObject(); +- Map groupData; +- synchronized (TimingIdentifier.GROUP_MAP) { +- for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) { +- synchronized (group.handlers) { +- for (TimingHandler id : group.handlers) { +- +- if (!id.isTimed() && !id.isSpecial()) { +- continue; +- } +- +- String name = id.identifier.name; +- if (name.startsWith("##")) { +- name = name.substring(3); +- } +- handlers.put(id.id, toArray( +- group.id, +- name +- )); +- } +- } +- } +- +- groupData = toObjectMapper( +- TimingIdentifier.GROUP_MAP.values(), group -> pair(group.id, group.name)); +- } +- +- parent.put("idmap", createObject( +- pair("groups", groupData), +- pair("handlers", handlers), +- pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))), +- pair("tileentity", +- toObjectMapper(tileEntityTypeSet, input -> pair(input.ordinal(), input.name()))), +- pair("entity", +- toObjectMapper(entityTypeSet, input -> pair(input.ordinal(), input.name()))) +- )); +- +- // Information about loaded plugins +- +- parent.put("plugins", toObjectMapper(Bukkit.getPluginManager().getPlugins(), +- plugin -> pair(plugin.getName(), createObject( +- pair("version", plugin.getDescription().getVersion()), +- pair("description", String.valueOf(plugin.getDescription().getDescription()).trim()), +- pair("website", plugin.getDescription().getWebsite()), +- pair("authors", StringUtils.join(plugin.getDescription().getAuthors(), ", ")) +- )))); +- +- +- +- // Information on the users Config +- +- parent.put("config", createObject( +- pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), +- pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), +- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Pufferfish +- pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)) // Pufferfish +- )); +- +- new TimingsExport(listeners, parent, history).start(); +- } +- +- static long getCost() { +- // Benchmark the users System.nanotime() for cost basis +- int passes = 100; +- TimingHandler SAMPLER1 = Timings.ofSafe("Timings Sampler 1"); +- TimingHandler SAMPLER2 = Timings.ofSafe("Timings Sampler 2"); +- TimingHandler SAMPLER3 = Timings.ofSafe("Timings Sampler 3"); +- TimingHandler SAMPLER4 = Timings.ofSafe("Timings Sampler 4"); +- TimingHandler SAMPLER5 = Timings.ofSafe("Timings Sampler 5"); +- TimingHandler SAMPLER6 = Timings.ofSafe("Timings Sampler 6"); +- +- long start = System.nanoTime(); +- for (int i = 0; i < passes; i++) { +- SAMPLER1.startTiming(); +- SAMPLER2.startTiming(); +- SAMPLER3.startTiming(); +- SAMPLER3.stopTiming(); +- SAMPLER4.startTiming(); +- SAMPLER5.startTiming(); +- SAMPLER6.startTiming(); +- SAMPLER6.stopTiming(); +- SAMPLER5.stopTiming(); +- SAMPLER4.stopTiming(); +- SAMPLER2.stopTiming(); +- SAMPLER1.stopTiming(); +- } +- long timingsCost = (System.nanoTime() - start) / passes / 6; +- SAMPLER1.reset(true); +- SAMPLER2.reset(true); +- SAMPLER3.reset(true); +- SAMPLER4.reset(true); +- SAMPLER5.reset(true); +- SAMPLER6.reset(true); +- return timingsCost; +- } +- +- private static JSONObject mapAsJSON(ConfigurationSection config, String parentKey) { +- +- JSONObject object = new JSONObject(); +- for (String key : config.getKeys(false)) { +- String fullKey = (parentKey != null ? parentKey + "." + key : key); +- if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld") || key.equals("feature-seeds")) { +- continue; +- } +- final Object val = config.get(key); +- +- object.put(key, valAsJSON(val, fullKey)); +- } +- return object; +- } +- +- private static Object valAsJSON(Object val, final String parentKey) { +- if (!(val instanceof MemorySection)) { +- if (val instanceof List) { +- Iterable v = (Iterable) val; +- return toArrayMapper(v, input -> valAsJSON(input, parentKey)); +- } else { +- return String.valueOf(val); +- } +- } else { +- return mapAsJSON((ConfigurationSection) val, parentKey); +- } +- } +- +- @Override +- public void run() { +- out.put("data", toArrayMapper(history, TimingHistory::export)); +- +- +- String response = null; +- String timingsURL = null; +- try { +- HttpURLConnection con = (HttpURLConnection) new URL(TimingsManager.url + "post").openConnection(); +- con.setDoOutput(true); +- String hostName = "BrokenHost"; +- try { +- hostName = InetAddress.getLocalHost().getHostName(); +- } catch (Exception ignored) {} +- con.setRequestProperty("User-Agent", "Paper/" + Bukkit.getUnsafe().getTimingsServerName() + "/" + hostName); +- con.setRequestMethod("POST"); +- con.setInstanceFollowRedirects(false); +- +- OutputStream request = new GZIPOutputStream(con.getOutputStream()) {{ +- this.def.setLevel(7); +- }}; +- +- request.write(JSONValue.toJSONString(out).getBytes("UTF-8")); +- request.close(); +- +- response = getResponse(con); +- +- if (con.getResponseCode() != 302) { +- listeners.sendMessage(text( "Upload Error: " + con.getResponseCode() + ": " + con.getResponseMessage(), NamedTextColor.RED)); +- listeners.sendMessage(text("Check your logs for more information", NamedTextColor.RED)); +- if (response != null) { +- Bukkit.getLogger().log(Level.SEVERE, response); +- } +- return; +- } +- +- timingsURL = con.getHeaderField("Location"); +- listeners.sendMessage(text("View Timings Report: ", NamedTextColor.GREEN).append(text(timingsURL).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, timingsURL)))); +- +- if (response != null && !response.isEmpty()) { +- Bukkit.getLogger().log(Level.INFO, "Timing Response: " + response); +- } +- } catch (IOException ex) { +- listeners.sendMessage(text("Error uploading timings, check your logs for more information", NamedTextColor.RED)); +- if (response != null) { +- Bukkit.getLogger().log(Level.SEVERE, response); +- } +- Bukkit.getLogger().log(Level.SEVERE, "Could not paste timings", ex); +- } finally { +- this.listeners.done(timingsURL); +- } +- } +- +- private String getResponse(HttpURLConnection con) throws IOException { +- InputStream is = null; +- try { +- is = con.getInputStream(); +- ByteArrayOutputStream bos = new ByteArrayOutputStream(); +- +- byte[] b = new byte[1024]; +- int bytesRead; +- while ((bytesRead = is.read(b)) != -1) { +- bos.write(b, 0, bytesRead); +- } +- return bos.toString(); +- +- } catch (IOException ex) { +- listeners.sendMessage(text("Error uploading timings, check your logs for more information", NamedTextColor.RED)); +- Bukkit.getLogger().log(Level.WARNING, con.getResponseMessage(), ex); +- return null; +- } finally { +- if (is != null) { +- is.close(); +- } +- } +- } +-} ++interface TimingsExport {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +index 22687667ec69a954261e55e59261286ac1b8b8cd..94efe27854d929e79480cee8a2075115b0c4a31c 100644 +--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java ++++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java +@@ -1,140 +1,4 @@ + package co.aikar.timings; + +-import net.minecraft.server.level.ServerLevel; +-import net.minecraft.world.level.Level; +-import net.minecraft.world.level.storage.PrimaryLevelData; +- +-/** +- * Set of timers per world, to track world specific timings. +- */ +-// TODO: Re-implement missing timers + @Deprecated(forRemoval = true) +-public class WorldTimingsHandler { +- public final Timing mobSpawn; +- public final Timing doChunkUnload; +- public final Timing doPortalForcer; +- public final Timing scheduledBlocks; +- public final Timing scheduledBlocksCleanup; +- public final Timing scheduledBlocksTicking; +- public final Timing chunkTicks; +- public final Timing lightChunk; +- public final Timing chunkTicksBlocks; +- public final Timing doVillages; +- public final Timing doChunkMap; +- public final Timing doChunkMapUpdate; +- public final Timing doChunkMapToUpdate; +- public final Timing doChunkMapSortMissing; +- public final Timing doChunkMapSortSendToPlayers; +- public final Timing doChunkMapPlayersNeedingChunks; +- public final Timing doChunkMapPendingSendToPlayers; +- public final Timing doChunkMapUnloadChunks; +- public final Timing doChunkGC; +- public final Timing doSounds; +- public final Timing entityRemoval; +- public final Timing entityTick; +- public final Timing tileEntityTick; +- public final Timing tileEntityPending; +- public final Timing tracker1; +- public final Timing tracker2; +- public final Timing doTick; +- public final Timing tickEntities; +- public final Timing chunks; +- public final Timing newEntities; +- public final Timing raids; +- public final Timing chunkProviderTick; +- public final Timing broadcastChunkUpdates; +- public final Timing countNaturalMobs; +- +- public final Timing chunkLoad; +- public final Timing chunkLoadPopulate; +- public final Timing syncChunkLoad; +- public final Timing chunkLoadLevelTimer; +- public final Timing chunkIO; +- public final Timing chunkPostLoad; +- public final Timing worldSave; +- public final Timing worldSaveChunks; +- public final Timing worldSaveLevel; +- public final Timing chunkSaveData; +- +- +- public final Timing miscMobSpawning; +- +- public final Timing poiUnload; +- public final Timing chunkUnload; +- public final Timing poiSaveDataSerialization; +- public final Timing chunkSave; +- public final Timing chunkSaveDataSerialization; +- public final Timing chunkSaveIOWait; +- public final Timing chunkUnloadPrepareSave; +- public final Timing chunkUnloadPOISerialization; +- public final Timing chunkUnloadDataSave; +- +- public WorldTimingsHandler(Level server) { +- String name = ((PrimaryLevelData) server.getLevelData()).getLevelName() + " - "; +- +- mobSpawn = Timings.ofSafe(name + "mobSpawn"); +- doChunkUnload = Timings.ofSafe(name + "doChunkUnload"); +- scheduledBlocks = Timings.ofSafe(name + "Scheduled Blocks"); +- scheduledBlocksCleanup = Timings.ofSafe(name + "Scheduled Blocks - Cleanup"); +- scheduledBlocksTicking = Timings.ofSafe(name + "Scheduled Blocks - Ticking"); +- chunkTicks = Timings.ofSafe(name + "Chunk Ticks"); +- lightChunk = Timings.ofSafe(name + "Light Chunk"); +- chunkTicksBlocks = Timings.ofSafe(name + "Chunk Ticks - Blocks"); +- doVillages = Timings.ofSafe(name + "doVillages"); +- doChunkMap = Timings.ofSafe(name + "doChunkMap"); +- doChunkMapUpdate = Timings.ofSafe(name + "doChunkMap - Update"); +- doChunkMapToUpdate = Timings.ofSafe(name + "doChunkMap - To Update"); +- doChunkMapSortMissing = Timings.ofSafe(name + "doChunkMap - Sort Missing"); +- doChunkMapSortSendToPlayers = Timings.ofSafe(name + "doChunkMap - Sort Send To Players"); +- doChunkMapPlayersNeedingChunks = Timings.ofSafe(name + "doChunkMap - Players Needing Chunks"); +- doChunkMapPendingSendToPlayers = Timings.ofSafe(name + "doChunkMap - Pending Send To Players"); +- doChunkMapUnloadChunks = Timings.ofSafe(name + "doChunkMap - Unload Chunks"); +- doSounds = Timings.ofSafe(name + "doSounds"); +- doChunkGC = Timings.ofSafe(name + "doChunkGC"); +- doPortalForcer = Timings.ofSafe(name + "doPortalForcer"); +- entityTick = Timings.ofSafe(name + "entityTick"); +- entityRemoval = Timings.ofSafe(name + "entityRemoval"); +- tileEntityTick = Timings.ofSafe(name + "tileEntityTick"); +- tileEntityPending = Timings.ofSafe(name + "tileEntityPending"); +- +- chunkLoad = Timings.ofSafe(name + "Chunk Load"); +- chunkLoadPopulate = Timings.ofSafe(name + "Chunk Load - Populate"); +- syncChunkLoad = Timings.ofSafe(name + "Sync Chunk Load"); +- chunkLoadLevelTimer = Timings.ofSafe(name + "Chunk Load - Load Level"); +- chunkIO = Timings.ofSafe(name + "Chunk Load - DiskIO"); +- chunkPostLoad = Timings.ofSafe(name + "Chunk Load - Post Load"); +- worldSave = Timings.ofSafe(name + "World Save"); +- worldSaveLevel = Timings.ofSafe(name + "World Save - Level"); +- worldSaveChunks = Timings.ofSafe(name + "World Save - Chunks"); +- chunkSaveData = Timings.ofSafe(name + "Chunk Save - Data"); +- +- tracker1 = Timings.ofSafe(name + "tracker stage 1"); +- tracker2 = Timings.ofSafe(name + "tracker stage 2"); +- doTick = Timings.ofSafe(name + "doTick"); +- tickEntities = Timings.ofSafe(name + "tickEntities"); +- +- chunks = Timings.ofSafe(name + "Chunks"); +- newEntities = Timings.ofSafe(name + "New entity registration"); +- raids = Timings.ofSafe(name + "Raids"); +- chunkProviderTick = Timings.ofSafe(name + "Chunk provider tick"); +- broadcastChunkUpdates = Timings.ofSafe(name + "Broadcast chunk updates"); +- countNaturalMobs = Timings.ofSafe(name + "Count natural mobs"); +- +- +- miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc"); +- +- poiUnload = Timings.ofSafe(name + "Chunk unload - POI"); +- chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk"); +- poiSaveDataSerialization = Timings.ofSafe(name + "Chunk save - POI Data serialization"); +- chunkSave = Timings.ofSafe(name + "Chunk save - Chunk"); +- chunkSaveDataSerialization = Timings.ofSafe(name + "Chunk save - Chunk Data serialization"); +- chunkSaveIOWait = Timings.ofSafe(name + "Chunk save - Chunk IO Wait"); +- chunkUnloadPrepareSave = Timings.ofSafe(name + "Chunk unload - Async Save Prepare"); +- chunkUnloadPOISerialization = Timings.ofSafe(name + "Chunk unload - POI Data Serialization"); +- chunkUnloadDataSave = Timings.ofSafe(name + "Chunk unload - Data Serialization"); +- } +- +- public static Timing getTickList(ServerLevel worldserver, String timingsType) { +- return Timings.ofSafe(((PrimaryLevelData) worldserver.getLevelData()).getLevelName() + " - Scheduled " + timingsType); +- } +-} ++interface WorldTimingsHandler {} // Thunderbolt - Remove remaining timings implementations +diff --git a/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java b/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java +index 4ad189d52b27560424ddb311d0817a334637dc95..f7e64bcd8810f7f5782d5314ec16290dc30cb518 100644 +--- a/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java ++++ b/src/main/java/gg/pufferfish/pufferfish/compat/ServerConfigurations.java +@@ -1,6 +1,6 @@ + package gg.pufferfish.pufferfish.compat; + +-import co.aikar.timings.TimingsManager; ++// import co.aikar.timings.TimingsManager; // Thunderbolt - Remove remaining timings implementations + import com.google.common.io.Files; + import org.bukkit.configuration.InvalidConfigurationException; + import org.bukkit.configuration.file.YamlConfiguration; +@@ -37,7 +37,7 @@ public class ServerConfigurations { + + public static String getCleanCopy(String configName) throws IOException { + File file = new File(configName); +- List hiddenConfigs = TimingsManager.hiddenConfigs; ++ // List hiddenConfigs = TimingsManager.hiddenConfigs; // Thunderbolt - Remove remaining timings implementations + + switch (Files.getFileExtension(configName)) { + case "properties": { +@@ -45,9 +45,11 @@ public class ServerConfigurations { + try (FileInputStream inputStream = new FileInputStream(file)) { + properties.load(inputStream); + } ++ /* // Thunderbolt - Remove remaining timings implementations + for (String hiddenConfig : hiddenConfigs) { + properties.remove(hiddenConfig); + } ++ */ // Thunderbolt - Remove remaining timings implementations + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + properties.store(outputStream, ""); + return Arrays.stream(outputStream.toString() +@@ -63,11 +65,13 @@ public class ServerConfigurations { + throw new IOException(e); + } + configuration.options().header(null); ++ /* // Thunderbolt - Remove remaining timings implementations + for (String key : configuration.getKeys(true)) { + if (hiddenConfigs.contains(key)) { + configuration.set(key, null); + } + } ++ */ // Thunderbolt - Remove remaining timings implementations + return configuration.saveToString(); + } + default: +diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +index 86822868e47b269891a71fdc04371b1e28a2752e..723444f9ac1a61ee08d0e2425e338c529a63dc27 100644 +--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java ++++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +@@ -1,6 +1,6 @@ + package io.papermc.paper.configuration; + +-import co.aikar.timings.MinecraftTimings; ++// import co.aikar.timings.MinecraftTimings; // Thunderbolt - Remove remaining timings implementations + import com.mojang.logging.LogUtils; + import io.papermc.paper.configuration.constraint.Constraints; + import io.papermc.paper.configuration.type.number.IntOr; +@@ -93,6 +93,7 @@ public class GlobalConfiguration extends ConfigurationPart { + public boolean useDisplayNameInQuitMessage = false; + } + ++ /* // Thunderbolt - Remove remaining timings implementations + @Deprecated(forRemoval = true) + public Timings timings; + +@@ -124,6 +125,7 @@ public class GlobalConfiguration extends ConfigurationPart { + MinecraftTimings.processConfig(this); + } + } ++ */ // Thunderbolt - Remove remaining timings implementations + + public Proxies proxies; + +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 23594fb7eb4b2f33146592866608c2858ef23937..db405389e7b3ec6136cb68161d437940d242ff13 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; // Thunderbolt - Remove remaining timings implementations + import com.destroystokyo.paper.event.server.ServerExceptionEvent; + import com.destroystokyo.paper.exception.ServerEventException; + import com.google.common.collect.Sets; +@@ -96,7 +96,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); // Thunderbolt - Remove remaining timings implementations + this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); + } + +@@ -183,7 +183,7 @@ class PaperEventManager { + } + } + +- EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); ++ EventExecutor executor = EventExecutor.create(method, eventClass); // Thunderbolt - Remove remaining timings implementations + eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } + 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..844e340c331c6dd12eaaac247f871b042ceb6c25 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java +@@ -232,7 +232,7 @@ public class PaperPluginManagerImpl implements PluginManager, DependencyContext + + @Override + public boolean useTimings() { +- return co.aikar.timings.Timings.isTimingsEnabled(); ++ return false; // Thunderbolt - Remove remaining timings implementations + } + + @Override +diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +index 8c134a642ccaf3530022f2e675a858d726e1dda4..2cc6668b64c5e8ae3c39a934efae95933e1c83db 100644 +--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +@@ -50,7 +50,7 @@ public class PacketUtils { + try { // Paper - detailed watchdog information + if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players + if (listener.shouldHandleMessage(packet)) { +- co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings ++ // co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings // Thunderbolt - Remove remaining timings implementations + try { // Paper - timings // Purpur + packet.handle(listener); + } catch (Exception exception) { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index cffcbc5db9593f69748d1c2d5a5687fa31f9ada5..75171854b6f1d056262b78d9028e68f755254e10 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -3,7 +3,7 @@ package net.minecraft.server; + import com.google.common.base.Preconditions; + import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +-import co.aikar.timings.Timings; ++// import co.aikar.timings.Timings; // Thunderbolt - Remove remaining timings implementations + import com.destroystokyo.paper.event.server.PaperServerListPingEvent; + import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; +@@ -190,7 +190,7 @@ import org.bukkit.craftbukkit.CraftRegistry; + import org.bukkit.event.server.ServerLoadEvent; + // CraftBukkit end + +-import co.aikar.timings.MinecraftTimings; // Paper ++// import co.aikar.timings.MinecraftTimings; // Paper // Thunderbolt - Remove remaining timings implementations + + public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { + +@@ -984,7 +984,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop waitable = new Waitable<>() { +@@ -858,9 +859,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + co.aikar.timings.Timings.generateReport(new co.aikar.timings.TimingsReportListener(sender, waitable)); + } else { + // Paper end ++ */ // Thunderbolt - Remove remaining timings implementations + ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper); + this.server.dispatchServerCommand(event.getSender(), serverCommand); +- } // Paper ++ // } // Paper // Thunderbolt - Remove remaining timings implementations + }); + // Paper start + if (waitableArray[0] != null) { +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 873ef80c02b4c6494529a6327faf82902a0181da..9afadf28d33275d3e9f35fdcc6cf679d6b117457 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1,7 +1,7 @@ + package net.minecraft.server.level; + + import com.google.common.annotations.VisibleForTesting; +-import co.aikar.timings.TimingHistory; // Paper ++// import co.aikar.timings.TimingHistory; // Paper // Thunderbolt - Remove remaining timings implementations + import com.google.common.collect.Lists; + import com.mojang.datafixers.DataFixer; + import com.mojang.datafixers.util.Pair; +@@ -1497,9 +1497,9 @@ public class ServerLevel extends Level implements WorldGenLevel { + currentlyTickingEntity.lazySet(entity); + } + // Paper end - log detailed entity tick information +- ++TimingHistory.entityTicks; // Paper - timings ++ //++TimingHistory.entityTicks; // Paper - timings // Thunderbolt - Remove remaining timings implementations + // Spigot start +- co.aikar.timings.Timing timer; // Paper ++ //co.aikar.timings.Timing timer; // Paper // Thunderbolt - Remove remaining timings implementations + /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below + entity.tickCount++; + timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings +@@ -1522,7 +1522,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + });*/ // Purpur + //gameprofilerfiller.incrementCounter("tickNonPassenger"); // Purpur + if (isActive) { // Paper - EAR 2 +- TimingHistory.activatedEntityTicks++; ++ // TimingHistory.activatedEntityTicks++; // Thunderbolt - Remove remaining timings implementations + entity.tick(); + entity.postTick(); // CraftBukkit + } else { entity.inactiveTick(); } // Paper - EAR 2 +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index fdfe8f5bc5ad0e5f5ded41d87756a5866d041df1..9e519813080e76b43ad68f1a67b0dd0610062b68 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1,6 +1,6 @@ + package net.minecraft.server.players; + +-import co.aikar.timings.MinecraftTimings; ++// import co.aikar.timings.MinecraftTimings; // Thunderbolt - Remove remaining timings implementations + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java +index 32a1b5a1d01fd4dc603a76fde259f3a0d4749fad..824855365586538ad78dfe379df53e89cd2c60f5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityType.java ++++ b/src/main/java/net/minecraft/world/entity/EntityType.java +@@ -356,10 +356,12 @@ public class EntityType implements FeatureElement, EntityTypeT + this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); + } + public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures, String id) { ++ /* // Thunderbolt - Remove remaining timings implementations + this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); + this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); + this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); + this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); ++ */ // Thunderbolt - Remove remaining timings implementations + // Paper end + this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); + this.factory = factory; +@@ -730,10 +732,12 @@ public class EntityType implements FeatureElement, EntityTypeT + } + + // Paper start - timings ++ /* // Thunderbolt - Remove remaining timings implementations + public final co.aikar.timings.Timing tickTimer; + public final co.aikar.timings.Timing inactiveTickTimer; + public final co.aikar.timings.Timing passengerTickTimer; + public final co.aikar.timings.Timing passengerInactiveTickTimer; ++ */ // Thunderbolt - Remove remaining timings implementations + // Paper end + public boolean trackDeltas() { + return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS; +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +index 612a14806ec63b0dcf31814396282f4b7f4a527c..b72936610ae125d1d972608364c79c85703f987e 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +@@ -16,7 +16,7 @@ public abstract class Behavior implements BehaviorContro + private final int maxDuration; + // Paper start - configurable behavior tick rate and timings + private final String configKey; +- private final co.aikar.timings.Timing timing; ++ // private final co.aikar.timings.Timing timing; // Thunderbolt - Remove remaining timings implementations + // Paper end - configurable behavior tick rate and timings + + public Behavior(Map, MemoryStatus> requiredMemoryState) { +@@ -38,7 +38,7 @@ public abstract class Behavior implements BehaviorContro + key = key.substring(lastSeparator + 1); + } + this.configKey = key.toLowerCase(java.util.Locale.ROOT); +- this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey); ++ // this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey); // Thunderbolt - Remove remaining timings implementations + // Paper end - configurable behavior tick rate and timings + } + +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +index 703006eb5df8099c4f51cdb4e41f95cacfbe43a6..a17f85cd0f52fba5d1ca64b20350310102377304 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +@@ -28,7 +28,7 @@ public abstract class Sensor { + private long timeToTick; + // Paper start - configurable sensor tick rate and timings + private final String configKey; +- private final co.aikar.timings.Timing timing; ++ // private final co.aikar.timings.Timing timing; // Thunderbolt - Remove remaining timings implementations + // Paper end + + public Sensor(int senseInterval) { +@@ -39,7 +39,7 @@ public abstract class Sensor { + key = key.substring(lastSeparator + 1); + } + this.configKey = key.toLowerCase(java.util.Locale.ROOT); +- this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); ++ // this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); // Thunderbolt - Remove remaining timings implementations + // Paper end + this.scanRate = senseInterval; + this.timeToTick = (long)RANDOM.nextInt(senseInterval); +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 77ebd33eca98832e34866e7b522a263673fa25f8..37f80a6e2e0891464c99367700be70ed4618069b 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -183,7 +183,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur +- public final co.aikar.timings.WorldTimingsHandler timings; // Paper ++ // public final co.aikar.timings.WorldTimingsHandler timings; // Paper // Thunderbolt - Remove remaining timings implementations + public static BlockPos lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; +@@ -364,7 +364,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} + }); + // CraftBukkit end +- this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings ++ // this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings // Thunderbolt - Remove remaining timings implementations + this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray +@@ -1387,7 +1387,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + //this.timings.tileEntityTick.stopTiming(); // Spigot // Purpur + this.tickingBlockEntities = false; +- co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper ++ // co.aikar.timings.TimingHistory.tileEntityTicks += this.blockEntityTickers.size(); // Paper // Thunderbolt - Remove remaining timings implementations + //gameprofilerfiller.pop(); // Purpur + this.spigotConfig.currentPrimedTnt = 0; // Spigot + } +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 5ae3decf100d21f7d4a471c155eaf5e00e996580..5ed1cbeea5946888ef564a06b9a9d5a1379ca2da 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -107,6 +107,7 @@ public class Block extends BlockBehaviour implements ItemLike { + this != Blocks.STRUCTURE_BLOCK && + this != Blocks.JIGSAW; + } ++ /* // Thunderbolt - Remove remaining timings implementations + public co.aikar.timings.Timing timing; + public co.aikar.timings.Timing getTiming() { + if (timing == null) { +@@ -114,6 +115,7 @@ public class Block extends BlockBehaviour implements ItemLike { + } + return timing; + } ++ */ // Thunderbolt - Remove remaining timings implementations + // Paper end + @Nullable + private String descriptionId; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +index 8dc1436fe78759cee5247cc28e8a18999e738a1b..ace886913b43252c5216b716e1a6b42a652fd411 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +@@ -33,14 +33,14 @@ import org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry; + import org.bukkit.inventory.InventoryHolder; + // CraftBukkit end + +-import org.spigotmc.CustomTimingsHandler; // Spigot +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper ++// import org.spigotmc.CustomTimingsHandler; // Spigot // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.MinecraftTimings; // Paper // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.Timing; // Paper // Thunderbolt - Remove remaining timings implementations + + public abstract class BlockEntity { + static boolean ignoreTileUpdates; // Paper - Perf: Optimize Hoppers + +- public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper ++ // public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper // Thunderbolt - Remove remaining timings implementations + // CraftBukkit start - data containers + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); + public CraftPersistentDataContainer persistentDataContainer; +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index 58123df202b28de77a9e733e062ee4f201d4d305..709f49e83a3bd71de446f60a7b4f98ad3421c773 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -376,8 +376,8 @@ public class Main { + tryPreloadClass("org.jline.terminal.impl.MouseSupport"); + tryPreloadClass("org.jline.terminal.impl.MouseSupport$1"); + tryPreloadClass("org.jline.terminal.Terminal$MouseTracking"); +- tryPreloadClass("co.aikar.timings.TimingHistory"); +- tryPreloadClass("co.aikar.timings.TimingHistory$MinuteReport"); ++ // tryPreloadClass("co.aikar.timings.TimingHistory"); // Thunderbolt - Remove remaining timings implementations ++ // tryPreloadClass("co.aikar.timings.TimingHistory$MinuteReport"); // Thunderbolt - Remove remaining timings implementations + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext"); + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$11"); + tryPreloadClass("io.netty.channel.AbstractChannelHandlerContext$12"); +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +index e3af3ba8f34626e54cdd931601fd3ec40618a061..b08ef35521fd570a577b578f079587d11983229f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -1,6 +1,6 @@ + package org.bukkit.craftbukkit.scheduler; + +-import co.aikar.timings.MinecraftTimings; // Paper ++// import co.aikar.timings.MinecraftTimings; // Paper // Thunderbolt - Remove remaining timings implementations + import com.google.common.base.Preconditions; + import com.google.common.util.concurrent.ThreadFactoryBuilder; + import java.util.ArrayList; +@@ -304,7 +304,7 @@ public class CraftScheduler implements BukkitScheduler { + } + return false; + } +- }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}; // Paper ++ })/*{{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer();}}*/; // Paper // Thunderbolt - Remove remaining timings implementations + this.handle(task, 0L); + for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { + if (taskPending == task) { +@@ -344,7 +344,7 @@ public class CraftScheduler implements BukkitScheduler { + } + } + } +- }){{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer(plugin);}}; // Paper ++ })/*{{this.timings=co.aikar.timings.MinecraftTimings.getCancelTasksTimer(plugin);}}*/; // Paper // Thunderbolt - Remove remaining timings implementations + this.handle(task, 0L); + for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { + if (taskPending == task) { +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +index 5835dc236b3f5291a804f7fb14a12eb466d4e0ba..878d8800f35c49a04a1632381e64137fbe619937 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +@@ -2,14 +2,14 @@ package org.bukkit.craftbukkit.scheduler; + + import java.util.function.Consumer; + +-import co.aikar.timings.NullTimingHandler; ++// import co.aikar.timings.NullTimingHandler; // Thunderbolt - Remove remaining timings implementations + import org.bukkit.Bukkit; + import org.bukkit.plugin.Plugin; + import org.bukkit.scheduler.BukkitTask; + +-import org.spigotmc.CustomTimingsHandler; // Spigot +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper ++// import org.spigotmc.CustomTimingsHandler; // Spigot // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.MinecraftTimings; // Paper // Thunderbolt - Remove remaining timings implementations ++// import co.aikar.timings.Timing; // Paper // Thunderbolt - Remove remaining timings implementations + + public class CraftTask implements BukkitTask, Runnable { // Spigot + +@@ -31,7 +31,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + private long nextRun; + public final Runnable rTask; // Paper + public final Consumer cTask; // Paper +- public Timing timings; // Paper ++ // public Timing timings; // Paper // Thunderbolt - Remove remaining timings implementations + private final Plugin plugin; + private final int id; + private final long createdAt = System.nanoTime(); +@@ -55,7 +55,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + this.id = id; + this.period = CraftTask.NO_REPEATING; + this.taskName = taskName; +- this.timings = MinecraftTimings.getInternalTaskName(taskName); ++ // this.timings = MinecraftTimings.getInternalTaskName(taskName); // Thunderbolt - Remove remaining timings implementations + } + // Paper end + +@@ -76,7 +76,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + } + this.id = id; + this.period = period; +- timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper ++ // timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper // Thunderbolt - Remove remaining timings implementations + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index 6f24422beb7d3db6dbed0efcba2935f542519827..f6f991d2018ffca3ca49c61a6cc942c6b00e150b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -215,6 +215,7 @@ public final class CraftMagicNumbers implements UnsafeValues { + return ENTITY_TYPES_ENTITY_TYPE.get(entityTypes); + } + // Paper end ++ /* // Thunderbolt - Remove remaining timings implementations + // ======================================================================== + // Paper start + @Override +@@ -222,6 +223,7 @@ public final class CraftMagicNumbers implements UnsafeValues { + co.aikar.timings.TimingsExport.reportTimings(); + } + // Paper end ++ */ // Thunderbolt - Remove remaining timings implementations + + public static byte toLegacyData(BlockState data) { + return CraftLegacy.toLegacyData(data); +@@ -495,10 +497,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + return new CraftDamageSourceBuilder(damageType); + } + // Paper start ++ /* // Thunderbolt - Remove remaining timings implementations + @Override + public String getTimingsServerName() { + return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; + } ++ */ // Thunderbolt - Remove remaining timings implementations + + @Override + public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 583647f6c9ca0fb092f30c97693bd548f692dfd3..a46f90860b5d3565bae429b6d5a60edf90a4299f 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -35,7 +35,7 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity; + import net.minecraft.world.entity.projectile.ThrowableProjectile; + import net.minecraft.world.entity.projectile.ThrownTrident; + import net.minecraft.world.entity.raid.Raider; +-import co.aikar.timings.MinecraftTimings; ++// import co.aikar.timings.MinecraftTimings; // Thunderbolt - Remove remaining timings implementations + import net.minecraft.world.entity.schedule.Activity; + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.AABB;