Skip to content

Commit 812e4b8

Browse files
committed
Add abillity to remove markers from the marker list while keeping them on the map
1 parent 2a3cc1c commit 812e4b8

File tree

1 file changed

+33
-1
lines changed
  • src/main/java/de/bluecolored/bluemap/api/markers

1 file changed

+33
-1
lines changed

src/main/java/de/bluecolored/bluemap/api/markers/Marker.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ public abstract class Marker {
4545
private String label;
4646
private Vector3d position;
4747
private int sorting;
48+
private boolean listed;
4849

4950
public Marker(String type, String label, Vector3d position) {
5051
this.type = Objects.requireNonNull(type, "type cannot be null");
5152
this.label = Objects.requireNonNull(label, "label cannot be null");
5253
this.position = Objects.requireNonNull(position, "position cannot be null");
5354
this.sorting = 0;
55+
this.listed = true;
5456
}
5557

5658
/**
@@ -114,7 +116,7 @@ public void setPosition(double x, double y, double z) {
114116
* A lower value makes the marker sorted first (in lists and menus), a higher value makes it sorted later.<br>
115117
* If multiple markers have the same sorting-value, their order will be arbitrary.<br>
116118
* This value defaults to 0.
117-
* @return This markers sorting-value
119+
* @return this markers sorting-value
118120
*/
119121
public int getSorting() {
120122
return sorting;
@@ -131,6 +133,24 @@ public void setSorting(int sorting) {
131133
this.sorting = sorting;
132134
}
133135

136+
/**
137+
* This value defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
138+
* displayed on the map) or not (false).
139+
* @return whether the marker will be listed or not
140+
*/
141+
public boolean isListed() {
142+
return listed;
143+
}
144+
145+
/**
146+
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
147+
* displayed on the map) or not (false).
148+
* @param listed whether the marker will be listed or not
149+
*/
150+
public void setListed(boolean listed) {
151+
this.listed = listed;
152+
}
153+
134154
@Override
135155
public boolean equals(Object o) {
136156
if (this == o) return true;
@@ -156,6 +176,7 @@ public static abstract class Builder<T extends Marker, B extends Marker.Builder<
156176
String label;
157177
Vector3d position;
158178
Integer sorting;
179+
Boolean listed;
159180

160181
/**
161182
* Sets the label of the {@link Marker}.
@@ -201,6 +222,16 @@ public B sorting(Integer sorting) {
201222
return self();
202223
}
203224

225+
/**
226+
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
227+
* displayed on the map) or not (false).
228+
* @param listed whether the marker will be listed or not
229+
*/
230+
public B listed(Boolean listed) {
231+
this.listed = listed;
232+
return self();
233+
}
234+
204235
/**
205236
* Creates a new {@link Marker} with the current builder-settings
206237
* @return The new {@link Marker}-instance
@@ -211,6 +242,7 @@ T build(T marker) {
211242
if (label != null) marker.setLabel(label);
212243
if (position != null) marker.setPosition(position);
213244
if (sorting != null) marker.setSorting(sorting);
245+
if (listed != null) marker.setListed(listed);
214246
return marker;
215247
}
216248

0 commit comments

Comments
 (0)