From dc685b8fe491dc6b2bda02c4a6e5f92393133499 Mon Sep 17 00:00:00 2001 From: zml Date: Sun, 22 Dec 2024 15:29:48 -0800 Subject: [PATCH] chore(common): a bit of tidying --- .../platform/modcommon/impl/AdventureCommon.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mod-shared/src/main/java/net/kyori/adventure/platform/modcommon/impl/AdventureCommon.java b/mod-shared/src/main/java/net/kyori/adventure/platform/modcommon/impl/AdventureCommon.java index 0b4e6ea9..7bc06acb 100644 --- a/mod-shared/src/main/java/net/kyori/adventure/platform/modcommon/impl/AdventureCommon.java +++ b/mod-shared/src/main/java/net/kyori/adventure/platform/modcommon/impl/AdventureCommon.java @@ -23,7 +23,6 @@ */ package net.kyori.adventure.platform.modcommon.impl; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.mojang.logging.LogUtils; import java.util.List; import java.util.Locale; @@ -68,11 +67,13 @@ public final class AdventureCommon { static { // Daemon thread executor for scheduled tasks - SCHEDULER = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder() - .setNameFormat("adventure-platform-mod-scheduler-%d") - .setDaemon(true) - .setUncaughtExceptionHandler((thread, ex) -> LOGGER.error("An uncaught exception occurred in scheduler thread '{}':", thread.getName(), ex)) - .build()); + SCHEDULER = Executors.newSingleThreadScheduledExecutor( + Thread.ofPlatform() + .name("adventure-platform-mod-scheduler", 0) + .uncaughtExceptionHandler((thread, ex) -> LOGGER.error("An uncaught exception occurred in scheduler thread '{}':", thread.getName(), ex)) + .daemon() + .factory() + ); final var platformHooks = discoverHooks(); HOOKS = platformHooks; FLATTENER = createFlattener(platformHooks);