Add methods to register script and style files

This commit is contained in:
Lukas Rieger (Blue) 2022-12-03 23:16:01 +01:00
parent f063dc7fc2
commit 99e43dd19b
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -31,6 +31,7 @@
import java.nio.file.Path;
import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;
public interface WebApp {
@ -55,6 +56,42 @@ public interface WebApp {
*/
boolean getPlayerVisibility(UUID player);
/**
* Registers a css-style so the webapp loads it.<br>
* This method should only be used inside the {@link Consumer} that got registered to {@link BlueMapAPI#onEnable(Consumer)}.<br>
* Invoking this method at any other time is not supported.<br>
* Style-registrations are <b>not persistent</b>, register your style each time bluemap enables!
* <p>
* Example:
* <pre>
* BlueMapAPI.onEnable(api -> {
* api.getWebApp().registerStyle("js/my-custom-style.css");
* });
* </pre>
* </p>
* @param url The (relative) URL that links to the style.css file. The {@link #getWebRoot()}-method can be used to
* create the custom file in the correct location and make it available to the web-app.
*/
void registerStyle(String url);
/**
* Registers a js-script so the webapp loads it.<br>
* This method should only be used inside the {@link Consumer} that got registered to {@link BlueMapAPI#onEnable(Consumer)}.<br>
* Invoking this method at any other time is not supported.<br>
* Script-registrations are <b>not persistent</b>, register your script each time bluemap enables!
* <p>
* Example:
* <pre>
* BlueMapAPI.onEnable(api -> {
* api.getWebApp().registerScript("js/my-custom-script.js");
* });
* </pre>
* </p>
* @param url The (relative) URL that links to the script.js file. The {@link #getWebRoot()}-method can be used to
* create the custom file in the correct location and make it available to the web-app.
*/
void registerScript(String url);
/**
* @deprecated You should use the {@link #getWebRoot()} method to create the image-files you need, or store map/marker
* specific images in the map's storage (See: {@link BlueMapMap#getAssetStorage()})!