Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported the SCHEDULAR Fix to 1.20 #58

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/src/main/java/software/bluelib/BlueLibConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ private BlueLibConstants() {
public static final Logger LOGGER = Logger.getLogger(BlueLibConstants.MOD_NAME);

/**
* A {@code public static final} {@link ScheduledExecutorService} used to schedule tasks, such as printing messages after a delay.
* A {@code public static} {@link ScheduledExecutorService} used to schedule tasks, such as printing messages after a delay.
* <p>
* This executor runs tasks on a single thread to ensure delayed tasks run in a separate thread from the main thread.
* </p>
*
* @since 1.0.0
*/
public static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);
public static ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);

/**
* A {@code public static final} {@link String} representing the Mod ID for the {@code BlueLib} mod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -50,6 +51,7 @@ public class ReloadHandler extends ReloadEventHandler {
* @since 1.0.0
*/
public static void onServerStart(MinecraftServer pServer) {
BlueLibConstants.SCHEDULER = new ScheduledThreadPoolExecutor(1);
server = pServer;
ReloadHandler.LoadEntityVariants(server);
BaseLogger.log(BaseLogLevel.INFO, "Entity variants loaded.", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -53,6 +54,7 @@ public class ReloadHandler extends ReloadEventHandler {
*/
@SubscribeEvent
public static void onServerStart(ServerStartingEvent pEvent) {
BlueLibConstants.SCHEDULER = new ScheduledThreadPoolExecutor(1);
server = pEvent.getServer();
ReloadHandler.LoadEntityVariants(server);
BaseLogger.log(BaseLogLevel.INFO, "Entity variants loaded.", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -56,6 +57,7 @@ public class ReloadHandler extends ReloadEventHandler {
*/
@SubscribeEvent
public static void onServerStart(ServerStartingEvent pEvent) {
BlueLibConstants.SCHEDULER = new ScheduledThreadPoolExecutor(1);
server = pEvent.getServer();
ReloadHandler.LoadEntityVariants(server);
BaseLogger.log(BaseLogLevel.INFO, "Entity variants loaded.", true);
Expand Down
Loading