mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2025-01-29 19:21:33 +01:00
Add abillity to remove markers from the marker list while keeping them on the map
This commit is contained in:
parent
2a3cc1c270
commit
812e4b8fce
@ -45,12 +45,14 @@ public abstract class Marker {
|
||||
private String label;
|
||||
private Vector3d position;
|
||||
private int sorting;
|
||||
private boolean listed;
|
||||
|
||||
public Marker(String type, String label, Vector3d position) {
|
||||
this.type = Objects.requireNonNull(type, "type cannot be null");
|
||||
this.label = Objects.requireNonNull(label, "label cannot be null");
|
||||
this.position = Objects.requireNonNull(position, "position cannot be null");
|
||||
this.sorting = 0;
|
||||
this.listed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,7 +116,7 @@ public void setPosition(double x, double y, double z) {
|
||||
* A lower value makes the marker sorted first (in lists and menus), a higher value makes it sorted later.<br>
|
||||
* If multiple markers have the same sorting-value, their order will be arbitrary.<br>
|
||||
* This value defaults to 0.
|
||||
* @return This markers sorting-value
|
||||
* @return this markers sorting-value
|
||||
*/
|
||||
public int getSorting() {
|
||||
return sorting;
|
||||
@ -131,6 +133,24 @@ public void setSorting(int sorting) {
|
||||
this.sorting = sorting;
|
||||
}
|
||||
|
||||
/**
|
||||
* This value defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
|
||||
* displayed on the map) or not (false).
|
||||
* @return whether the marker will be listed or not
|
||||
*/
|
||||
public boolean isListed() {
|
||||
return listed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
|
||||
* displayed on the map) or not (false).
|
||||
* @param listed whether the marker will be listed or not
|
||||
*/
|
||||
public void setListed(boolean listed) {
|
||||
this.listed = listed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
@ -156,6 +176,7 @@ public static abstract class Builder<T extends Marker, B extends Marker.Builder<
|
||||
String label;
|
||||
Vector3d position;
|
||||
Integer sorting;
|
||||
Boolean listed;
|
||||
|
||||
/**
|
||||
* Sets the label of the {@link Marker}.
|
||||
@ -201,6 +222,16 @@ public B sorting(Integer sorting) {
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
|
||||
* displayed on the map) or not (false).
|
||||
* @param listed whether the marker will be listed or not
|
||||
*/
|
||||
public B listed(Boolean listed) {
|
||||
this.listed = listed;
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Marker} with the current builder-settings
|
||||
* @return The new {@link Marker}-instance
|
||||
@ -211,6 +242,7 @@ T build(T marker) {
|
||||
if (label != null) marker.setLabel(label);
|
||||
if (position != null) marker.setPosition(position);
|
||||
if (sorting != null) marker.setSorting(sorting);
|
||||
if (listed != null) marker.setListed(listed);
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user