File tree Expand file tree Collapse file tree 5 files changed +89
-1
lines changed
src/main/java/de/bluecolored/bluemap/api Expand file tree Collapse file tree 5 files changed +89
-1
lines changed Original file line number Diff line number Diff line change 11import java.io.IOException
2+ import java.util.concurrent.TimeoutException
23
34plugins {
45 java
@@ -12,7 +13,11 @@ fun String.runCommand(): String = ProcessBuilder(split("\\s(?=(?:[^'\"`]*(['\"`]
1213 .redirectOutput(ProcessBuilder .Redirect .PIPE )
1314 .redirectError(ProcessBuilder .Redirect .PIPE )
1415 .start()
15- .apply { waitFor(60 , TimeUnit .SECONDS ) }
16+ .apply {
17+ if (! waitFor(10 , TimeUnit .SECONDS )) {
18+ throw TimeoutException (" Failed to execute command: '" + this @runCommand + " '" )
19+ }
20+ }
1621 .run {
1722 val error = errorStream.bufferedReader().readText().trim()
1823 if (error.isNotEmpty()) {
Original file line number Diff line number Diff line change 2828import com .google .gson .JsonElement ;
2929import com .google .gson .JsonObject ;
3030import de .bluecolored .bluemap .api .debug .DebugDump ;
31+ import de .bluecolored .bluemap .api .plugin .Plugin ;
3132
3233import java .io .InputStream ;
3334import java .io .InputStreamReader ;
@@ -87,6 +88,13 @@ public abstract class BlueMapAPI {
8788 @ DebugDump
8889 public abstract WebApp getWebApp ();
8990
91+ /**
92+ * Getter for the {@link Plugin}
93+ * @return the {@link Plugin}
94+ */
95+ @ DebugDump
96+ public abstract Plugin getPlugin ();
97+
9098 /**
9199 * Getter for all {@link BlueMapMap}s loaded by BlueMap.
92100 * @return an unmodifiable collection of all loaded {@link BlueMapMap}s
Original file line number Diff line number Diff line change 1+ package de .bluecolored .bluemap .api .plugin ;
2+
3+ import java .awt .image .BufferedImage ;
4+ import java .util .UUID ;
5+ import java .util .function .BiFunction ;
6+
7+ @ FunctionalInterface
8+ public interface PlayerIconFactory extends BiFunction <UUID , BufferedImage , BufferedImage > {
9+
10+ /**
11+ * Takes a players UUID and skin-image and creates an icon
12+ * @param playerUuid the players UUID
13+ * @param playerSkin the input image
14+ * @return a <b>new</b> {@link BufferedImage} generated based on the input image
15+ */
16+ BufferedImage apply (UUID playerUuid , BufferedImage playerSkin );
17+
18+ }
Original file line number Diff line number Diff line change 1+ package de .bluecolored .bluemap .api .plugin ;
2+
3+ import de .bluecolored .bluemap .api .debug .DebugDump ;
4+
5+ public interface Plugin {
6+
7+ /**
8+ * Get the {@link SkinProvider} that bluemap is using to fetch player-skins
9+ * @return the {@link SkinProvider} instance bluemap is using
10+ */
11+ @ DebugDump
12+ SkinProvider getSkinProvider ();
13+
14+ /**
15+ * Sets the {@link SkinProvider} that bluemap will use to fetch new player-skins.
16+ * @param skinProvider The new {@link SkinProvider} bluemap should use
17+ */
18+ void setSkinProvider (SkinProvider skinProvider );
19+
20+ /**
21+ * Get the {@link PlayerIconFactory} that bluemap is using to convert a player-skin into the icon-image that is used
22+ * for the Player-Markers
23+ * @return The {@link PlayerIconFactory} bluemap uses to convert skins into player-marker icons
24+ */
25+ @ DebugDump
26+ PlayerIconFactory getPlayerMarkerIconFactory ();
27+
28+ /**
29+ * Set the {@link PlayerIconFactory} that bluemap will use to convert a player-skin into the icon-image that is used
30+ * for the Player-Markers
31+ * @param playerMarkerIconFactory The {@link PlayerIconFactory} bluemap uses to convert skins into player-marker icons
32+ */
33+ void setPlayerMarkerIconFactory (PlayerIconFactory playerMarkerIconFactory );
34+
35+ }
Original file line number Diff line number Diff line change 1+ package de .bluecolored .bluemap .api .plugin ;
2+
3+ import java .awt .image .BufferedImage ;
4+ import java .io .IOException ;
5+ import java .util .Optional ;
6+ import java .util .UUID ;
7+
8+ /**
9+ * A skin-provider capable of loading minecraft player-skins for a given UUID
10+ */
11+ @ FunctionalInterface
12+ public interface SkinProvider {
13+
14+ /**
15+ * Attempts to load a minecraft-skin from this skin-provider.
16+ * @return an {@link Optional} containing a {@link BufferedImage} with the skin-image or an empty Optional if there is no
17+ * skin for this UUID
18+ * @throws IOException if something went wrong trying to load the skin
19+ */
20+ Optional <BufferedImage > load (UUID playerUUID ) throws IOException ;
21+
22+ }
You can’t perform that action at this time.
0 commit comments