Skip to content

Commit 99e43dd

Browse files
committed
Add methods to register script and style files
1 parent f063dc7 commit 99e43dd

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/main/java/de/bluecolored/bluemap/api/WebApp.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.nio.file.Path;
3232
import java.util.Map;
3333
import java.util.UUID;
34+
import java.util.function.Consumer;
3435

3536
public interface WebApp {
3637

@@ -55,6 +56,42 @@ public interface WebApp {
5556
*/
5657
boolean getPlayerVisibility(UUID player);
5758

59+
/**
60+
* Registers a css-style so the webapp loads it.<br>
61+
* This method should only be used inside the {@link Consumer} that got registered to {@link BlueMapAPI#onEnable(Consumer)}.<br>
62+
* Invoking this method at any other time is not supported.<br>
63+
* Style-registrations are <b>not persistent</b>, register your style each time bluemap enables!
64+
* <p>
65+
* Example:
66+
* <pre>
67+
* BlueMapAPI.onEnable(api -> {
68+
* api.getWebApp().registerStyle("js/my-custom-style.css");
69+
* });
70+
* </pre>
71+
* </p>
72+
* @param url The (relative) URL that links to the style.css file. The {@link #getWebRoot()}-method can be used to
73+
* create the custom file in the correct location and make it available to the web-app.
74+
*/
75+
void registerStyle(String url);
76+
77+
/**
78+
* Registers a js-script so the webapp loads it.<br>
79+
* This method should only be used inside the {@link Consumer} that got registered to {@link BlueMapAPI#onEnable(Consumer)}.<br>
80+
* Invoking this method at any other time is not supported.<br>
81+
* Script-registrations are <b>not persistent</b>, register your script each time bluemap enables!
82+
* <p>
83+
* Example:
84+
* <pre>
85+
* BlueMapAPI.onEnable(api -> {
86+
* api.getWebApp().registerScript("js/my-custom-script.js");
87+
* });
88+
* </pre>
89+
* </p>
90+
* @param url The (relative) URL that links to the script.js file. The {@link #getWebRoot()}-method can be used to
91+
* create the custom file in the correct location and make it available to the web-app.
92+
*/
93+
void registerScript(String url);
94+
5895
/**
5996
* @deprecated You should use the {@link #getWebRoot()} method to create the image-files you need, or store map/marker
6097
* specific images in the map's storage (See: {@link BlueMapMap#getAssetStorage()})!

0 commit comments

Comments
 (0)