diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java index ef3515ec..3ebf1a62 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java @@ -101,8 +101,20 @@ public static boolean isRiddenOnUse(Entity entity) { * @return true if the type is a vehicle type */ public static boolean isVehicle(EntityType type) { - return type == EntityType.BOAT - || isMinecart(type); + return isBoat(type) || isMinecart(type); + } + + /** + * Test whether the given entity type is a Boat type. + * + * @param type the type + * @return true if the type is a Boat type + */ + public static boolean isBoat(EntityType type) { + return switch(type) { + case BOAT, CHEST_BOAT -> true; + default -> false; + }; } /** @@ -112,13 +124,11 @@ public static boolean isVehicle(EntityType type) { * @return true if the type is a Minecart type */ public static boolean isMinecart(EntityType type) { - return type == EntityType.MINECART - || type == EntityType.MINECART_CHEST - || type == EntityType.MINECART_COMMAND - || type == EntityType.MINECART_FURNACE - || type == EntityType.MINECART_HOPPER - || type == EntityType.MINECART_MOB_SPAWNER - || type == EntityType.MINECART_TNT; + return switch(type) { + case MINECART, MINECART_CHEST, MINECART_COMMAND, MINECART_FURNACE, + MINECART_HOPPER, MINECART_MOB_SPAWNER, MINECART_TNT -> true; + default -> false; + }; } /**