refactoring: issue#2376 (#2491)

Changed all the switch expression according to the JAVA 17.
This commit is contained in:
akshatarora0013
2023-04-01 20:18:38 +05:30
committed by GitHub
parent fc7e672419
commit 9d6ae392b8
23 changed files with 614 additions and 730 deletions
@@ -21,18 +21,18 @@ public class PlayerInputComponent implements InputComponent {
@Override
public void update(GameObject gameObject, int e) {
switch (e) {
case KeyEvent.KEY_LOCATION_LEFT:
case KeyEvent.KEY_LOCATION_LEFT -> {
gameObject.updateVelocity(-WALK_ACCELERATION);
LOGGER.info(gameObject.getName() + " has moved left.");
break;
case KeyEvent.KEY_LOCATION_RIGHT:
}
case KeyEvent.KEY_LOCATION_RIGHT -> {
gameObject.updateVelocity(WALK_ACCELERATION);
LOGGER.info(gameObject.getName() + " has moved right.");
break;
default:
}
default -> {
LOGGER.info(gameObject.getName() + "'s velocity is unchanged due to the invalid input");
gameObject.updateVelocity(0);
break; // incorrect input
} // incorrect input
}
}
}