Skip to content

Commit

Permalink
chore(bluemap/chat): register assets on load
Browse files Browse the repository at this point in the history
  • Loading branch information
Chicken committed May 4, 2024
1 parent 398f5a2 commit 6280977
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ public void forEachSession(SessionOperator op) {
}
}

@Override
public void onLoad() {
BlueMapAPI.onEnable(api -> {
try {
api.getWebApp().registerScript("assets/bluemap-chat.js");
api.getWebApp().registerStyle("assets/bluemap-chat.css");
copyResource("bluemap-chat.js");
copyResource("bluemap-chat.css");
copyResource("minecraft.otf");
} catch (IOException ex) {
getLogger().severe("Couldn't move chat resources to BlueMap!");
ex.printStackTrace();
}
});
}

@Override
public void onEnable() {
pingSchedule = scheduler.scheduleAtFixedRate(new Runnable() {
Expand Down Expand Up @@ -130,17 +146,6 @@ public void run() {

this.http.start();
getLogger().info("Webserver bound to " + this.http.getAddress());

try {
copyResource("bluemap-chat.js");
copyResource("bluemap-chat.css");
copyResource("minecraft.otf");
api.getWebApp().registerScript("assets/bluemap-chat.js");
api.getWebApp().registerStyle("assets/bluemap-chat.css");
} catch (IOException ex) {
getLogger().severe("Couldn't move chat resources to BlueMap!");
ex.printStackTrace();
}
});
BlueMapAPI.onDisable(api -> {
if (this.http != null) this.http.close();
Expand Down

0 comments on commit 6280977

Please sign in to comment.