Migrate 'EntityUtil#capNumeral' to an enhanced switch

This commit is contained in:
Alexander Brandes 2023-10-01 23:16:54 +02:00
parent a3bc3968a5
commit f5972317bd
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -42,27 +42,14 @@ public class EntityUtil {
} }
private static int capNumeral(final @NonNull String flagName) { private static int capNumeral(final @NonNull String flagName) {
int i; int i = switch (flagName) {
switch (flagName) { case "mob-cap" -> CAP_MOB;
case "mob-cap": case "hostile-cap" -> CAP_MONSTER;
i = CAP_MOB; case "animal-cap" -> CAP_ANIMAL;
break; case "vehicle-cap" -> CAP_VEHICLE;
case "hostile-cap": case "misc-cap" -> CAP_MISC;
i = CAP_MONSTER; default -> CAP_ENTITY;
break; };
case "animal-cap":
i = CAP_ANIMAL;
break;
case "vehicle-cap":
i = CAP_VEHICLE;
break;
case "misc-cap":
i = CAP_MISC;
break;
case "entity-cap":
default:
i = CAP_ENTITY;
}
return i; return i;
} }