Skip to content

Commit

Permalink
Implements custom equals() function
Browse files Browse the repository at this point in the history
  • Loading branch information
lscgh committed Feb 6, 2024
1 parent 7f7e1fb commit 653f1d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mavenmcserver/src/main/java/mavenmcserver/game/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public FieldPoint offsetBy(int x, int y, int z) {
public String toString() {
return "fp(" + this.x + ", " + this.y + ", " + this.z + ")";
}

@Override
public boolean equals(Object obj) {
if(obj == null) return false;
if(!(obj instanceof FieldPoint)) return false;
FieldPoint point = (FieldPoint)obj;
return point.x == this.x && point.y == this.y && point.z == this.z;
}
}

/**
Expand Down

0 comments on commit 653f1d4

Please sign in to comment.