From e1849028412439fe41ea570b0e9acc0c43ccd939 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sun, 24 Apr 2022 16:13:32 +0000 Subject: [PATCH] break --- .../java/pl/minecon724/realweather/GetStateTask.java | 8 ++++---- src/main/java/pl/minecon724/realweather/RW.java | 6 +----- .../java/pl/minecon724/realweather/WeatherState.java | 2 ++ .../realweather/provider/OpenWeatherMapProvider.java | 12 ++++++++++++ src/main/resources/config.yml | 3 +-- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/pl/minecon724/realweather/GetStateTask.java b/src/main/java/pl/minecon724/realweather/GetStateTask.java index a33c2fe..a876275 100644 --- a/src/main/java/pl/minecon724/realweather/GetStateTask.java +++ b/src/main/java/pl/minecon724/realweather/GetStateTask.java @@ -44,10 +44,10 @@ public class GetStateTask extends BukkitRunnable { @Override public void run() { - logger.fine("Refreshing weather by " + source); + logger.info("Refreshing weather by " + source); if (source.equals("point")) { State state = provider.request_state(pointLatitude, pointLongitude); - logger.fine(String.format("Provider returned state %s %s", state.condition.name(), state.level.name())); + logger.info(String.format("Provider returned state %s %s (%s)", state.condition.name(), state.level.name(), state.simple.name())); for (String w : worlds) { World world = Bukkit.getWorld(w); if (world == null) continue; @@ -67,11 +67,11 @@ public class GetStateTask extends BukkitRunnable { location = client.city(playerIp).getLocation(); lat = location.getLatitude(); lon = location.getLongitude(); - logger.fine( String.format( + logger.info( String.format( "%s's location is %f, %f", p.getName(), lat, lon )); state = provider.request_state(lat, lon); - logger.fine( String.format( + logger.info( String.format( "Provider returned state %s %s for %s", state.condition.name(), state.level.name(), p.getName() )); p.setPlayerWeather(state.simple == ConditionSimple.CLEAR ? WeatherType.CLEAR : WeatherType.DOWNFALL); diff --git a/src/main/java/pl/minecon724/realweather/RW.java b/src/main/java/pl/minecon724/realweather/RW.java index 5772444..00af39f 100644 --- a/src/main/java/pl/minecon724/realweather/RW.java +++ b/src/main/java/pl/minecon724/realweather/RW.java @@ -1,6 +1,7 @@ package pl.minecon724.realweather; import java.util.List; +import java.util.logging.ConsoleHandler; import java.util.logging.Level; import com.maxmind.geoip2.WebServiceClient; @@ -28,11 +29,6 @@ public class RW extends JavaPlugin { ConfigurationSection providerSec = config.getConfigurationSection("provider"); ConfigurationSection settingsSec = config.getConfigurationSection("settings"); - if (settingsSec.getBoolean("debug")) { - this.getLogger().setLevel(Level.ALL); - this.getLogger().fine("Debug info will appear in the console"); - } - String source = weatherSec.getString("source"); ConfigurationSection point = weatherSec.getConfigurationSection("point"); ConfigurationSection player = weatherSec.getConfigurationSection("player"); diff --git a/src/main/java/pl/minecon724/realweather/WeatherState.java b/src/main/java/pl/minecon724/realweather/WeatherState.java index 2cb4924..bfd6128 100644 --- a/src/main/java/pl/minecon724/realweather/WeatherState.java +++ b/src/main/java/pl/minecon724/realweather/WeatherState.java @@ -36,10 +36,12 @@ public class WeatherState { switch (condition) { case THUNDER: this.simple = ConditionSimple.THUNDER; + break; case DRIZZLE: case RAIN: case SNOW: this.simple = ConditionSimple.RAIN; + break; case CLEAR: case CLOUDY: this.simple = ConditionSimple.CLEAR; diff --git a/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java b/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java index 3dd629f..d8cae5d 100644 --- a/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java +++ b/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java @@ -63,11 +63,13 @@ public class OpenWeatherMapProvider implements Provider { case 210: case 230: level = ConditionLevel.LIGHT; + break; case 201: case 211: case 221: case 231: level = ConditionLevel.MODERATE; + break; case 202: case 212: case 232: @@ -79,11 +81,13 @@ public class OpenWeatherMapProvider implements Provider { case 300: case 310: level = ConditionLevel.LIGHT; + break; case 301: case 311: case 313: case 321: level = ConditionLevel.MODERATE; + break; case 302: case 312: case 314: @@ -95,14 +99,17 @@ public class OpenWeatherMapProvider implements Provider { case 500: case 520: level = ConditionLevel.LIGHT; + break; case 501: case 511: case 521: case 531: level = ConditionLevel.MODERATE; + break; case 502: case 522: level = ConditionLevel.HEAVY; + break; case 503: case 504: level = ConditionLevel.EXTREME; @@ -115,12 +122,14 @@ public class OpenWeatherMapProvider implements Provider { case 615: case 620: level = ConditionLevel.LIGHT; + break; case 601: case 611: case 613: case 616: case 621: level = ConditionLevel.MODERATE; + break; case 602: case 622: level = ConditionLevel.HEAVY; @@ -130,10 +139,13 @@ public class OpenWeatherMapProvider implements Provider { switch (stateId) { case 801: level = ConditionLevel.LIGHT; + break; case 802: level = ConditionLevel.MODERATE; + break; case 803: level = ConditionLevel.HEAVY; + break; case 804: level = ConditionLevel.EXTREME; } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1575900..907d007 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -32,5 +32,4 @@ settings: timeBetweenRecheck: 600 # Advanced options - timeBeforeInitialRun: 0 - debug: true \ No newline at end of file + timeBeforeInitialRun: 0 \ No newline at end of file