Skip to content

Commit 0635995

Browse files
committed
More API v2 changes :)
1 parent 6e9415e commit 0635995

20 files changed

+569
-7
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ repositories {
2121

2222
dependencies {
2323
api ("com.flowpowered:flow-math:1.0.3")
24-
implementation ("com.google.code.gson:gson:2.8.0")
24+
api ("com.google.code.gson:gson:2.8.0")
25+
2526
compileOnly ("org.jetbrains:annotations:23.0.0")
2627
}
2728

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package de.bluecolored.bluemap.api;
2626

27+
import de.bluecolored.bluemap.api.debug.DebugDump;
28+
2729
import java.io.IOException;
2830
import java.io.InputStream;
2931
import java.net.URL;
@@ -72,24 +74,28 @@ public abstract class BlueMapAPI {
7274
* Getter for the {@link RenderManager}.
7375
* @return the {@link RenderManager}
7476
*/
77+
@DebugDump
7578
public abstract RenderManager getRenderManager();
7679

7780
/**
7881
* Getter for the {@link WebApp}.
7982
* @return the {@link WebApp}
8083
*/
84+
@DebugDump
8185
public abstract WebApp getWebApp();
8286

8387
/**
8488
* Getter for all {@link BlueMapMap}s loaded by BlueMap.
8589
* @return an unmodifiable collection of all loaded {@link BlueMapMap}s
8690
*/
91+
@DebugDump
8792
public abstract Collection<BlueMapMap> getMaps();
8893

8994
/**
9095
* Getter for all {@link BlueMapWorld}s loaded by BlueMap.
9196
* @return an unmodifiable collection of all loaded {@link BlueMapWorld}s
9297
*/
98+
@DebugDump
9399
public abstract Collection<BlueMapWorld> getWorlds();
94100

95101
/**
@@ -122,12 +128,14 @@ public abstract class BlueMapAPI {
122128
* Getter for the installed BlueMap version
123129
* @return the version-string
124130
*/
131+
@DebugDump
125132
public abstract String getBlueMapVersion();
126133

127134
/**
128135
* Getter for the installed BlueMapAPI version
129136
* @return the version-string
130137
*/
138+
@DebugDump
131139
public String getAPIVersion() {
132140
return VERSION;
133141
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.flowpowered.math.vector.Vector2i;
2828
import com.flowpowered.math.vector.Vector3d;
2929
import com.flowpowered.math.vector.Vector3i;
30+
import de.bluecolored.bluemap.api.debug.DebugDump;
3031
import de.bluecolored.bluemap.api.marker.MarkerSet;
3132

3233
import java.util.Map;
@@ -42,38 +43,44 @@ public interface BlueMapMap {
4243
* Returns this maps id, this is equal to the id configured in bluemap's config for this map.
4344
* @return the id of this map
4445
*/
46+
@DebugDump
4547
String getId();
4648

4749
/**
4850
* Returns this maps display-name, this is equal to the name configured in bluemap's config for this map.
4951
* @return the name of this map
5052
*/
53+
@DebugDump
5154
String getName();
5255

5356
/**
5457
* Getter for the {@link BlueMapWorld} of this map.
5558
* @return the {@link BlueMapWorld} of this map
5659
*/
60+
@DebugDump
5761
BlueMapWorld getWorld();
5862

5963
/**
6064
* Getter for a (modifiable) {@link Map} of {@link MarkerSet}s with the key being the {@link MarkerSet}'s id.
6165
* Changing this map will change the {@link MarkerSet}s and markers displayed on the web-app for this map.
6266
* @return a {@link Map} of {@link MarkerSet}s.
6367
*/
68+
@DebugDump
6469
Map<String, MarkerSet> getMarkerSets();
6570

6671
/**
6772
* Getter for the size of all tiles on this map in blocks.
6873
* @return the tile-size in blocks
6974
*/
75+
@DebugDump
7076
Vector2i getTileSize();
7177

7278
/**
7379
* Getter for the offset of the tile-grid on this map.<br>
7480
* E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner.
7581
* @return the tile-offset in blocks
7682
*/
83+
@DebugDump
7784
Vector2i getTileOffset();
7885

7986
/**

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package de.bluecolored.bluemap.api;
2626

27+
import de.bluecolored.bluemap.api.debug.DebugDump;
28+
2729
import java.nio.file.Path;
2830
import java.util.Collection;
2931

@@ -36,18 +38,21 @@ public interface BlueMapWorld {
3638
* Getter for the id of this world.
3739
* @return the id of this world
3840
*/
41+
@DebugDump
3942
String getId();
4043

4144
/**
4245
* Getter for the {@link Path} of this world's save-files (folder). This matches the folder configured in bluemap's config for this map ( <code>world:</code> ).
4346
* @return the save-folder of this world.
4447
*/
48+
@DebugDump
4549
Path getSaveFolder();
4650

4751
/**
4852
* Getter for all {@link BlueMapMap}s for this world
4953
* @return an unmodifiable {@link Collection} of all {@link BlueMapMap}s for this world
5054
*/
55+
@DebugDump
5156
Collection<BlueMapMap> getMaps();
5257

5358
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
package de.bluecolored.bluemap.api;
2626

2727
import com.flowpowered.math.vector.Vector2i;
28+
import de.bluecolored.bluemap.api.debug.DebugDump;
2829

2930
import java.io.IOException;
3031
import java.util.Collection;
@@ -74,18 +75,21 @@ default boolean scheduleMapUpdateTask(BlueMapMap map) {
7475
* Getter for the current size of the render-queue.
7576
* @return the current size of the render-queue
7677
*/
78+
@DebugDump
7779
int renderQueueSize();
7880

7981
/**
8082
* Getter for the current count of render threads.
8183
* @return the count of render threads
8284
*/
85+
@DebugDump
8386
int renderThreadCount();
8487

8588
/**
8689
* Whether this {@link RenderManager} is currently running or stopped.
8790
* @return <code>true</code> if this renderer is running
8891
*/
92+
@DebugDump
8993
boolean isRunning();
9094

9195
/**

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
1+
/*
2+
* This file is part of BlueMap, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
125
package de.bluecolored.bluemap.api;
226

27+
import de.bluecolored.bluemap.api.debug.DebugDump;
328
import de.bluecolored.bluemap.api.marker.Marker;
429
import de.bluecolored.bluemap.api.marker.POIMarker;
530
import com.flowpowered.math.vector.Vector2i;
@@ -16,6 +41,7 @@ public interface WebApp {
1641
* Getter for the configured web-root folder
1742
* @return The {@link Path} of the web-root folder
1843
*/
44+
@DebugDump
1945
Path getWebRoot();
2046

2147
/**
@@ -50,6 +76,7 @@ public interface WebApp {
5076
* </ul>
5177
* @throws IOException If an {@link IOException} is thrown while reading the images
5278
*/
79+
@DebugDump
5380
Map<String, String> availableImages() throws IOException;
5481

5582
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This file is part of BlueMap, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) Blue (Lukas Rieger) <https://bluecolored.de>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package de.bluecolored.bluemap.api.debug;
26+
27+
import java.lang.annotation.ElementType;
28+
import java.lang.annotation.Retention;
29+
import java.lang.annotation.RetentionPolicy;
30+
import java.lang.annotation.Target;
31+
32+
/**
33+
* Marks a class, field or method to be included in detail in a possible state-dump.
34+
* E.g. triggered by <code>/bluemap debug dump</code>
35+
*/
36+
@Retention(RetentionPolicy.RUNTIME)
37+
@Target({
38+
ElementType.METHOD,
39+
ElementType.FIELD,
40+
ElementType.TYPE
41+
})
42+
public @interface DebugDump {
43+
44+
String value() default "";
45+
46+
}

src/main/java/de/bluecolored/bluemap/api/marker/DistanceRangedMarker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
package de.bluecolored.bluemap.api.marker;
2626

2727
import com.flowpowered.math.vector.Vector3d;
28+
import de.bluecolored.bluemap.api.debug.DebugDump;
2829

30+
@DebugDump
2931
public abstract class DistanceRangedMarker extends Marker {
3032

3133
private double minDistance, maxDistance;

src/main/java/de/bluecolored/bluemap/api/marker/ExtrudeMarker.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@
2626

2727
import com.flowpowered.math.vector.Vector2d;
2828
import com.flowpowered.math.vector.Vector3d;
29+
import de.bluecolored.bluemap.api.debug.DebugDump;
2930
import de.bluecolored.bluemap.api.math.Color;
31+
import de.bluecolored.bluemap.api.math.Shape;
3032

3133
import java.util.Objects;
3234

35+
@DebugDump
3336
public class ExtrudeMarker extends ObjectMarker {
37+
private static final Shape DEFAULT_SHAPE = Shape.createRect(0, 0, 1, 1);
3438

3539
private Shape shape;
3640
private float shapeMinY, shapeMaxY;
@@ -39,6 +43,14 @@ public class ExtrudeMarker extends ObjectMarker {
3943
private Color lineColor = new Color(255, 0, 0, 1f);
4044
private Color fillColor = new Color(200, 0, 0, 0.3f);
4145

46+
/**
47+
* Empty constructor for deserialization.
48+
*/
49+
@SuppressWarnings("unused")
50+
private ExtrudeMarker() {
51+
this("", DEFAULT_SHAPE, 0, 0);
52+
}
53+
4254
/**
4355
* Creates a new {@link ExtrudeMarker}.
4456
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>

src/main/java/de/bluecolored/bluemap/api/marker/HtmlMarker.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,27 @@
2727

2828
import com.flowpowered.math.vector.Vector2i;
2929
import com.flowpowered.math.vector.Vector3d;
30+
import de.bluecolored.bluemap.api.debug.DebugDump;
3031

3132
import java.util.Objects;
3233

3334
/**
3435
* A marker that is a html-element placed somewhere on the map.
3536
*/
37+
@DebugDump
3638
public class HtmlMarker extends DistanceRangedMarker {
3739

3840
private Vector2i anchor;
3941
private String html;
4042

43+
/**
44+
* Empty constructor for deserialization.
45+
*/
46+
@SuppressWarnings("unused")
47+
private HtmlMarker() {
48+
this("", Vector3d.ZERO, "");
49+
}
50+
4151
/**
4252
* Creates a new {@link HtmlMarker}.
4353
*

0 commit comments

Comments
 (0)