Skip to content

Commit

Permalink
Use a reusable method for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
k1w1dev committed Apr 27, 2024
1 parent 7f61c97 commit 99628f1
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,24 @@ public void collisionResolve(FlamingAsteroid asteroid) {

@Override
public void collisionResolve(Meteoroid meteoroid) {
LOGGER.info(AppConstants.HITS + " {} is damaged!", meteoroid.getClass().getSimpleName(),
this.getClass().getSimpleName(), this.getClass().getSimpleName());
logHits(meteoroid);
setDamaged(true);
}

@Override
public void collisionResolve(SpaceStationMir mir) {
LOGGER.info(AppConstants.HITS + " {} is damaged!", mir.getClass().getSimpleName(),
this.getClass().getSimpleName(), this.getClass().getSimpleName());
logHits(mir);
setDamaged(true);
}

@Override
public void collisionResolve(SpaceStationIss iss) {
LOGGER.info(AppConstants.HITS, " {} is damaged!", iss.getClass().getSimpleName(),
this.getClass().getSimpleName(), this.getClass().getSimpleName());
logHits(iss);
setDamaged(true);
}
}

private void logHits(GameObject gameObject) {
LOGGER.info(AppConstants.HITS, " {} is damaged!", gameObject.getClass().getSimpleName(),
this.getClass().getSimpleName(), this.getClass().getSimpleName());
}
}

0 comments on commit 99628f1

Please sign in to comment.