Skip to content

Commit c93ad7d

Browse files
committed
Try registering the onEnable earlier
To prevent the window of registering scripts&styles from closing before it's done on some computers. This doesn't happen on my own server, but it was a reported problem on some other people's setups...
1 parent d91e33e commit c93ad7d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/main/java/com/technicjelle/bluemapofflineplayermarkers/BlueMapOfflinePlayerMarkers.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@ public final class BlueMapOfflinePlayerMarkers extends JavaPlugin implements Lis
2929
private PaperConfig config;
3030
private UpdateChecker updateChecker;
3131

32+
@Override
33+
public void onLoad() {
34+
getLogger().info("BlueMap Offline Player Markers plugin (on)loading...");
35+
BlueMapAPI.onEnable(api -> {
36+
getLogger().info("BlueMap is enabled! Copying resources to BlueMap webapp and registering them...");
37+
try {
38+
BMUtils.copyJarResourceToBlueMap(api, getClassLoader(), "style.css", "bmopm.css", false);
39+
BMUtils.copyJarResourceToBlueMap(api, getClassLoader(), "script.js", "bmopm.js", false);
40+
} catch (IOException e) {
41+
Singletons.getLogger().log(Level.SEVERE, "Failed to copy resources to BlueMap webapp!", e);
42+
}
43+
44+
});
45+
}
46+
3247
@Override
3348
public void onEnable() {
3449
new Metrics(this, 16425);
@@ -49,18 +64,11 @@ public void onEnable() {
4964
}
5065

5166
final Consumer<BlueMapAPI> onEnableListener = api -> {
52-
Singletons.getLogger().info("API Ready! BlueMap Offline Player Markers plugin enabled!");
67+
getLogger().info("API Ready! BlueMap Offline Player Markers plugin enabled!");
5368
updateChecker.logUpdateMessage(Singletons.getLogger());
5469

5570
config.loadFromPlugin(this);
5671

57-
try {
58-
BMUtils.copyJarResourceToBlueMap(api, getClassLoader(), "style.css", "bmopm.css", false);
59-
BMUtils.copyJarResourceToBlueMap(api, getClassLoader(), "script.js", "bmopm.js", false);
60-
} catch (IOException e) {
61-
Singletons.getLogger().log(Level.SEVERE, "Failed to copy resources to BlueMap webapp!", e);
62-
}
63-
6472
//create marker handler and add all offline players in a separate thread, so the server doesn't hang up while it's going
6573
//with a delay, so any potential BlueMap SkinProviders have time to load
6674
Bukkit.getScheduler().runTaskLaterAsynchronously(this, FileMarkerLoader::loadOfflineMarkers, 20 * 5);

0 commit comments

Comments
 (0)