Skip to content

Commit

Permalink
delay first tick tasks until plugins finished loading
Browse files Browse the repository at this point in the history
closes #296

(cherry picked from commit f426ef9)
  • Loading branch information
deirn committed Nov 12, 2024
1 parent 94ea211 commit 31add16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/mcp/mobius/waila/Waila.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import mcp.mobius.waila.config.PluginConfig;
import mcp.mobius.waila.config.WailaConfig;
import mcp.mobius.waila.gui.hud.theme.ThemeDefinition;
import mcp.mobius.waila.plugin.PluginLoader;
import mcp.mobius.waila.plugin.PluginSide;
import mcp.mobius.waila.registry.RegistryFilter;
import mcp.mobius.waila.service.ICommonService;
Expand Down Expand Up @@ -69,7 +70,7 @@ public static ResourceLocation id(String path) {
}

static void onAnyTick() {
if (!firstTicked) {
if (!firstTicked && PluginLoader.INSTANCE.initialized) {
firstTicked = true;
JsonConfig.reloadAllInstances();
PluginConfig.write();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mcp/mobius/waila/plugin/PluginLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public abstract class PluginLoader {
);

private boolean gathered = false;
public volatile boolean initialized = false;

public static void reloadServerPlugins(MinecraftServer server) {
PluginInfo.saveToggleConfig();
Expand Down Expand Up @@ -197,6 +198,7 @@ public final void loadPlugins() {
PluginConfig.reload();

JsonConfig.reloadAllInstances();
initialized = true;
}

private void initialize(PluginInfo info) {
Expand Down

0 comments on commit 31add16

Please sign in to comment.