From 28286df81441c91b2964556988bf00f40a406c43 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Tue, 24 Sep 2024 18:40:35 +0200 Subject: [PATCH] Add getTwilightTimeProvider to providers by name And fix eclipse indentation --- .../eu/m724/wtapi/provider/Providers.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/m724/wtapi/provider/Providers.java b/src/main/java/eu/m724/wtapi/provider/Providers.java index 4e98afc..efc1823 100644 --- a/src/main/java/eu/m724/wtapi/provider/Providers.java +++ b/src/main/java/eu/m724/wtapi/provider/Providers.java @@ -3,6 +3,8 @@ package eu.m724.wtapi.provider; import eu.m724.wtapi.provider.exception.NoSuchProviderException; import eu.m724.wtapi.provider.thunder.ThunderProvider; import eu.m724.wtapi.provider.thunder.impl.blitzortung.BlitzortungProvider; +import eu.m724.wtapi.provider.twilight.ApproximateTwilightTimeProvider; +import eu.m724.wtapi.provider.twilight.TwilightTimeProvider; import eu.m724.wtapi.provider.weather.WeatherProvider; import eu.m724.wtapi.provider.weather.impl.openweathermap.OpenWeatherMapProvider; @@ -10,8 +12,8 @@ public class Providers { public static ThunderProvider getThunderProvider(String name, String apiKey) throws NoSuchProviderException { switch (name.toLowerCase()) { - case "blitzortung": - return new BlitzortungProvider(); + case "blitzortung": + return new BlitzortungProvider(); } throw new NoSuchProviderException(); @@ -19,11 +21,20 @@ public class Providers { public static WeatherProvider getWeatherProvider(String name, String apiKey) throws NoSuchProviderException { switch (name.toLowerCase()) { - case "openweathermap": - return new OpenWeatherMapProvider(apiKey); + case "openweathermap": + return new OpenWeatherMapProvider(apiKey); } throw new NoSuchProviderException(); } + + public static TwilightTimeProvider getTwilightTimeProvider(String name, String apiKey) throws NoSuchProviderException { + switch (name.toLowerCase()) { + case "approximate": + return new ApproximateTwilightTimeProvider(); + } + + throw new NoSuchProviderException(); + } }