refactor: replace switch with enhanced switch

This commit is contained in:
Breno A.
2024-06-09 09:25:14 -03:00
Unverified
parent 7db8b6f0c7
commit c9b42a6dfb
2 changed files with 25 additions and 37 deletions
@@ -40,24 +40,12 @@ public class HandlerSetPlayerBirthdayReq extends PacketHandler {
private boolean isValidBirthday(int month, int day) {
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return day > 0 & day <= 31;
case 4:
case 6:
case 9:
case 11:
return day > 0 && day <= 30;
case 2:
return day > 0 & day <= 29;
}
return switch (month) {
case 1, 3, 5, 7, 8, 10, 12 -> day > 0 & day <= 31;
case 4, 6, 9, 11 -> day > 0 && day <= 30;
case 2 -> day > 0 & day <= 29;
default -> false;
};
return false;
}
}