From f5972317bd7b2c946d6414a8eef8a884b96f2ae3 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 1 Oct 2023 23:16:54 +0200 Subject: [PATCH] Migrate 'EntityUtil#capNumeral' to an enhanced switch --- .../com/plotsquared/core/util/EntityUtil.java | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java index db2a3fc90..eaf297f0c 100644 --- a/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/EntityUtil.java @@ -42,27 +42,14 @@ public class EntityUtil { } private static int capNumeral(final @NonNull String flagName) { - int i; - switch (flagName) { - case "mob-cap": - i = CAP_MOB; - break; - case "hostile-cap": - i = CAP_MONSTER; - 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; - } + int i = switch (flagName) { + case "mob-cap" -> CAP_MOB; + case "hostile-cap" -> CAP_MONSTER; + case "animal-cap" -> CAP_ANIMAL; + case "vehicle-cap" -> CAP_VEHICLE; + case "misc-cap" -> CAP_MISC; + default -> CAP_ENTITY; + }; return i; }