Push API version and properly implement equals and hashCode for MarkerSet and Marker

This commit is contained in:
Blue (Lukas Rieger) 2021-02-04 01:22:40 +01:00
parent 9614e33b13
commit be1e5a7d95
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800
3 changed files with 34 additions and 14 deletions

@ -1 +1 @@
Subproject commit 17cbf15f84815205b52a7aa07f4060b4235cf45a
Subproject commit ea8d237925e4efb1e1fb17d9ec622ea9aa80b43c

View File

@ -24,16 +24,16 @@
*/
package de.bluecolored.bluemap.common.api.marker;
import java.util.Optional;
import com.flowpowered.math.vector.Vector3d;
import com.google.common.base.Preconditions;
import de.bluecolored.bluemap.api.BlueMapAPI;
import de.bluecolored.bluemap.api.BlueMapMap;
import de.bluecolored.bluemap.api.marker.Marker;
import ninja.leaping.configurate.ConfigurationNode;
import java.util.Objects;
import java.util.Optional;
public abstract class MarkerImpl implements Marker {
private final String id;
@ -205,5 +205,18 @@ public abstract class MarkerImpl implements Marker {
node.getNode("y").setValue(Math.round(pos.getY() * 1000d) / 1000d);
node.getNode("z").setValue(Math.round(pos.getZ() * 1000d) / 1000d);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MarkerImpl marker = (MarkerImpl) o;
return id.equals(marker.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
}

View File

@ -24,17 +24,8 @@
*/
package de.bluecolored.bluemap.common.api.marker;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.flowpowered.math.vector.Vector3d;
import com.google.common.collect.Sets;
import de.bluecolored.bluemap.api.BlueMapAPI;
import de.bluecolored.bluemap.api.BlueMapMap;
import de.bluecolored.bluemap.api.marker.Marker;
@ -43,6 +34,9 @@ import de.bluecolored.bluemap.api.marker.Shape;
import de.bluecolored.bluemap.core.logger.Logger;
import ninja.leaping.configurate.ConfigurationNode;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class MarkerSetImpl implements MarkerSet {
private final String id;
@ -217,4 +211,17 @@ public class MarkerSetImpl implements MarkerSet {
this.hasUnsavedChanges = false;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MarkerSetImpl markerSet = (MarkerSetImpl) o;
return id.equals(markerSet.id);
}
@Override
public int hashCode() {
return id.hashCode();
}
}