Fix duplicate waypoint issues and bad bed positions
This commit is contained in:
parent
18a9206058
commit
00b0266c43
@ -42,16 +42,12 @@ public final class LocationTrackingBehavior extends Behavior {
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockInteract(BlockInteractEvent event) {
|
public void onBlockInteract(BlockInteractEvent event) {
|
||||||
if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(event.getPos()) instanceof BlockBed) {
|
if (event.getType() == BlockInteractEvent.Type.USE && BlockStateInterface.getBlock(event.getPos()) instanceof BlockBed) {
|
||||||
createWaypointAtPlayer("bed", Waypoint.Tag.BED);
|
WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, event.getPos()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerDeath() {
|
public void onPlayerDeath() {
|
||||||
createWaypointAtPlayer("death", Waypoint.Tag.DEATH);
|
WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint("death", Waypoint.Tag.DEATH, playerFeet()));
|
||||||
}
|
|
||||||
|
|
||||||
private void createWaypointAtPlayer(String name, Waypoint.Tag tag) {
|
|
||||||
WorldProvider.INSTANCE.getCurrentWorld().waypoints.addWaypoint(new Waypoint(name, tag, playerFeet()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,12 @@ public class Waypoint {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Waypoint w = (Waypoint) o;
|
Waypoint w = (Waypoint) o;
|
||||||
return name.equals(w.name) && tag == w.tag && creationTimestamp == w.creationTimestamp && location.equals(w.location);
|
return name.equals(w.name) && tag == w.tag && location.equals(w.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return name.hashCode() + tag.hashCode() + (int) creationTimestamp + location.hashCode(); //lol
|
return name.hashCode() + tag.hashCode() + location.hashCode(); //lol
|
||||||
}
|
}
|
||||||
|
|
||||||
public long creationTimestamp() {
|
public long creationTimestamp() {
|
||||||
|
Loading…
Reference in New Issue
Block a user