mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-29 14:06:32 +01:00
Push API version and properly implement equals and hashCode for MarkerSet and Marker
This commit is contained in:
parent
9614e33b13
commit
be1e5a7d95
@ -1 +1 @@
|
|||||||
Subproject commit 17cbf15f84815205b52a7aa07f4060b4235cf45a
|
Subproject commit ea8d237925e4efb1e1fb17d9ec622ea9aa80b43c
|
@ -24,16 +24,16 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.common.api.marker;
|
package de.bluecolored.bluemap.common.api.marker;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3d;
|
import com.flowpowered.math.vector.Vector3d;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.api.BlueMapAPI;
|
import de.bluecolored.bluemap.api.BlueMapAPI;
|
||||||
import de.bluecolored.bluemap.api.BlueMapMap;
|
import de.bluecolored.bluemap.api.BlueMapMap;
|
||||||
import de.bluecolored.bluemap.api.marker.Marker;
|
import de.bluecolored.bluemap.api.marker.Marker;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public abstract class MarkerImpl implements Marker {
|
public abstract class MarkerImpl implements Marker {
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
@ -206,4 +206,17 @@ private static void writePos(ConfigurationNode node, Vector3d pos) {
|
|||||||
node.getNode("z").setValue(Math.round(pos.getZ() * 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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,17 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package de.bluecolored.bluemap.common.api.marker;
|
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.flowpowered.math.vector.Vector3d;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import de.bluecolored.bluemap.api.BlueMapAPI;
|
import de.bluecolored.bluemap.api.BlueMapAPI;
|
||||||
import de.bluecolored.bluemap.api.BlueMapMap;
|
import de.bluecolored.bluemap.api.BlueMapMap;
|
||||||
import de.bluecolored.bluemap.api.marker.Marker;
|
import de.bluecolored.bluemap.api.marker.Marker;
|
||||||
@ -43,6 +34,9 @@
|
|||||||
import de.bluecolored.bluemap.core.logger.Logger;
|
import de.bluecolored.bluemap.core.logger.Logger;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class MarkerSetImpl implements MarkerSet {
|
public class MarkerSetImpl implements MarkerSet {
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
@ -217,4 +211,17 @@ public synchronized void save(ConfigurationNode node) {
|
|||||||
this.hasUnsavedChanges = false;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user