This commit is contained in:
Lukas Rieger (Blue) 2024-05-20 21:24:31 +02:00
parent 8b179fb5e0
commit ec97711349
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
8 changed files with 34 additions and 23 deletions

View File

@ -85,12 +85,11 @@ tasks.javadoc {
options {
(this as? StandardJavadocDocletOptions)?.apply {
links(
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.oracle.com/en/java/javase/16/docs/api/",
"https://javadoc.io/doc/com.flowpowered/flow-math/1.0.3/",
"https://javadoc.io/doc/com.google.code.gson/gson/2.8.0/",
)
addStringOption("Xdoclint:none", "-quiet")
if (JavaVersion.current().isJava9Compatible)
addBooleanOption("html5", true)
}
}

View File

@ -35,6 +35,7 @@
/**
* A storage that is able to hold any "asset"-data for a map. For example images, icons, scripts or json-files.
*/
@SuppressWarnings("unused")
public interface AssetStorage {
/**

View File

@ -28,6 +28,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import de.bluecolored.bluemap.api.plugin.Plugin;
import org.jetbrains.annotations.ApiStatus;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -42,6 +43,7 @@
* An API to control the running instance of BlueMap.
* <p>This API is thread-save, so you <b>can</b> use it async, off the main-server-thread, to save performance!</p>
*/
@SuppressWarnings({"unused", "UnusedReturnValue"})
public abstract class BlueMapAPI {
@SuppressWarnings("unused")
@ -57,6 +59,7 @@ public abstract class BlueMapAPI {
gitHash = element.get("git-hash").getAsString();
} catch (Exception ex) {
System.err.println("Failed to load version from resources!");
//noinspection CallToPrintStackTrace
ex.printStackTrace();
}
}
@ -191,39 +194,33 @@ public static synchronized boolean unregisterListener(Consumer<BlueMapAPI> consu
* @return <code>true</code> if the instance has been registered, <code>false</code> if there already was an instance registered
* @throws ExecutionException if a listener threw an exception during the registration
*/
protected static synchronized boolean registerInstance(BlueMapAPI instance) throws ExecutionException {
@ApiStatus.Internal
protected static synchronized boolean registerInstance(BlueMapAPI instance) throws Exception {
if (BlueMapAPI.instance != null) return false;
BlueMapAPI.instance = instance;
List<Throwable> thrownExceptions = new ArrayList<>(0);
List<Exception> thrownExceptions = new ArrayList<>(0);
for (Consumer<BlueMapAPI> listener : BlueMapAPI.onEnableConsumers) {
try {
listener.accept(BlueMapAPI.instance);
} catch (Throwable ex) {
} catch (Exception ex) {
thrownExceptions.add(ex);
}
}
if (!thrownExceptions.isEmpty()) {
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
for (int i = 1; i < thrownExceptions.size(); i++) {
ex.addSuppressed(thrownExceptions.get(i));
}
throw ex;
}
return true;
return throwAsOne(thrownExceptions);
}
/**
* Used by BlueMap to unregister the API and call the listeners properly.
* @param instance the {@link BlueMapAPI} instance
* @return <code>true</code> if the instance was unregistered, <code>false</code> if there was no or an other instance registered
* @return <code>true</code> if the instance was unregistered, <code>false</code> if there was no or another instance registered
* @throws ExecutionException if a listener threw an exception during the un-registration
*/
protected static synchronized boolean unregisterInstance(BlueMapAPI instance) throws ExecutionException {
@ApiStatus.Internal
protected static synchronized boolean unregisterInstance(BlueMapAPI instance) throws Exception {
if (BlueMapAPI.instance != instance) return false;
List<Exception> thrownExceptions = new ArrayList<>(0);
@ -238,8 +235,12 @@ protected static synchronized boolean unregisterInstance(BlueMapAPI instance) th
BlueMapAPI.instance = null;
return throwAsOne(thrownExceptions);
}
private static boolean throwAsOne(List<Exception> thrownExceptions) throws Exception {
if (!thrownExceptions.isEmpty()) {
ExecutionException ex = new ExecutionException(thrownExceptions.get(0));
Exception ex = thrownExceptions.get(0);
for (int i = 1; i < thrownExceptions.size(); i++) {
ex.addSuppressed(thrownExceptions.get(i));
}

View File

@ -28,6 +28,7 @@
import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.math.vector.Vector3i;
import de.bluecolored.bluemap.api.markers.MarkerSet;
import org.jetbrains.annotations.ApiStatus;
import java.util.Map;
import java.util.function.Predicate;
@ -36,6 +37,7 @@
* This class represents a map that is rendered by BlueMap of a specific world ({@link BlueMapWorld}).
* Each map belongs to a map configured in BlueMap's configuration file (in the <code>maps: []</code> list).
*/
@SuppressWarnings("unused")
public interface BlueMapMap {
/**
@ -91,6 +93,7 @@ public interface BlueMapMap {
* <p>Any previously set filters will get overwritten with the new one. You can get the current filter using {@link #getTileFilter()} and combine them if you wish.</p>
* @param filter The filter that will be used from now on.
*/
@ApiStatus.Experimental
void setTileFilter(Predicate<Vector2i> filter);
/**
@ -109,6 +112,7 @@ public interface BlueMapMap {
/**
* Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -&gt; true</code>.
*/
@ApiStatus.Experimental
Predicate<Vector2i> getTileFilter();
/**

View File

@ -26,12 +26,12 @@
import com.flowpowered.math.vector.Vector2i;
import java.io.IOException;
import java.util.Collection;
/**
* The {@link RenderManager} is used to schedule tile-renders and process them on a number of different threads.
*/
@SuppressWarnings("unused")
public interface RenderManager {
/**
@ -66,9 +66,8 @@ default boolean scheduleMapUpdateTask(BlueMapMap map) {
* An update-task will be scheduled right after the purge, to get the map up-to-date again.
* @param map the map to be purged
* @return true if a new task has been scheduled, false if not (usually because there is already an update-task for this map scheduled)
* @throws IOException if an IOException occurs while trying to create the task.
*/
boolean scheduleMapPurgeTask(BlueMapMap map) throws IOException;
boolean scheduleMapPurgeTask(BlueMapMap map);
/**
* Getter for the current size of the render-queue.

View File

@ -24,6 +24,8 @@
*/
package de.bluecolored.bluemap.api;
import org.jetbrains.annotations.ApiStatus;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.file.Path;
@ -31,6 +33,7 @@
import java.util.UUID;
import java.util.function.Consumer;
@SuppressWarnings("unused")
public interface WebApp {
/**
@ -44,6 +47,7 @@ public interface WebApp {
* @param player the UUID of the player
* @param visible true if the player-marker should be visible, false if it should be hidden
*/
@ApiStatus.Experimental
void setPlayerVisibility(UUID player, boolean visible);
/**
@ -51,6 +55,7 @@ public interface WebApp {
* @see #setPlayerVisibility(UUID, boolean)
* @param player the UUID of the player
*/
@ApiStatus.Experimental
boolean getPlayerVisibility(UUID player);
/**

View File

@ -49,8 +49,9 @@ public final class MarkerGson {
.setLenient()
.create();
/* This class can not be instantiated. */
private MarkerGson() {}
private MarkerGson() {
throw new UnsupportedOperationException("Utility class");
}
public static GsonBuilder addAdapters(GsonBuilder builder) {
return builder

View File

@ -24,6 +24,7 @@
*/
package de.bluecolored.bluemap.api.plugin;
@SuppressWarnings("unused")
public interface Plugin {
/**