Skip to content

Commit

Permalink
chore(PlayerModelEntity): remove indexOfHome method
Browse files Browse the repository at this point in the history
  • Loading branch information
aivruu authored Dec 28, 2024
1 parent a82a5c1 commit 36ca12e
Showing 1 changed file with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,6 @@ public PlayerModelEntity(final @NotNull String id, final @NotNull HomeModelEntit
return this.homes;
}

/**
* Returns a {@link HomeModelEntity} from the homes-array based on the provided home-id.
*
* @param home the home to search.
* @return The {@link HomeModelEntity} or {@code null} if not exists.
* @since 2.0.0
*/
@Nullable HomeModelEntity indexOfHome(final @NotNull String home) {
byte start = 0;
byte end = (byte) (this.homes.length - 1);

while (start <= end) {
final int mid = start + (end - start) >>> 1;
final int comparison = homes[mid].id().compareTo(home);
if (comparison == 0) {
return homes[mid];
} else if (comparison < 0) {
start = (byte) (mid + 1);
} else {
end = (byte) (mid - 1);
}
}
return null;
}

/**
* Sets a new {@link HomeModelEntity} array for this player.
*
Expand Down

0 comments on commit 36ca12e

Please sign in to comment.