diff --git a/src/main/java/pl/minecon724/realweather/GetStateTask.java b/src/main/java/pl/minecon724/realweather/GetStateTask.java index c628d66..049b3cf 100644 --- a/src/main/java/pl/minecon724/realweather/GetStateTask.java +++ b/src/main/java/pl/minecon724/realweather/GetStateTask.java @@ -1,6 +1,7 @@ package pl.minecon724.realweather; import java.util.List; +import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.World; @@ -15,25 +16,27 @@ public class GetStateTask extends BukkitRunnable { double pointLatitude; double pointLongitude; List worlds; + Logger logger; public GetStateTask( Provider provider, String source, double pointLatitude, double pointLongitude, - List worlds + List worlds, Logger logger ) { this.provider = provider; this.source = source; this.pointLatitude = pointLatitude; this.pointLongitude = pointLongitude; this.worlds = worlds; + this.logger = logger; } @Override public void run() { - Bukkit.getLogger().fine("Refreshing weather by " + source); + logger.fine("Refreshing weather by " + source); if (source.equals("point")) { State state = provider.request_state(pointLatitude, pointLongitude); - Bukkit.getLogger().fine(String.format("Provider returned state %s %s", state.condition.name(), state.level.name())); + logger.fine(String.format("Provider returned state %s %s", state.condition.name(), state.level.name())); for (String w : worlds) { World world = Bukkit.getWorld(w); if (world == null) continue; diff --git a/src/main/java/pl/minecon724/realweather/RW.java b/src/main/java/pl/minecon724/realweather/RW.java index 89b71e8..748bbb6 100644 --- a/src/main/java/pl/minecon724/realweather/RW.java +++ b/src/main/java/pl/minecon724/realweather/RW.java @@ -25,7 +25,7 @@ public class RW extends JavaPlugin { ConfigurationSection settingsSec = config.getConfigurationSection("settings"); if (settingsSec.getBoolean("debug")) { - Bukkit.getLogger().setLevel(Level.ALL); + this.getLogger().setLevel(Level.ALL); } String source = weatherSec.getString("source"); @@ -39,26 +39,26 @@ public class RW extends JavaPlugin { ConfigurationSection providerCfg = providerSec.getConfigurationSection(choice); if (providerCfg == null) { - Bukkit.getLogger().severe("Unknown provider: " + choice); - Bukkit.getLogger().info("The plugin will disable now"); + this.getLogger().severe("Unknown provider: " + choice); + this.getLogger().info("The plugin will disable now"); Bukkit.getPluginManager().disablePlugin(this); } Provider provider = null; if (choice.equals("openweathermap")) { - Bukkit.getLogger().info("Using OpenWeatherMap as the weather provider"); + this.getLogger().info("Using OpenWeatherMap as the weather provider"); provider = new OpenWeatherMapProvider( providerCfg.getString("apiKey") ); } provider.init(); new GetStateTask( - provider, source, pointLatitude, pointLongitude, worlds + provider, source, pointLatitude, pointLongitude, worlds, this.getLogger() ).runTaskTimerAsynchronously(this, settingsSec.getLong("timeBeforeInitialRun"), settingsSec.getLong("timeBetweenRecheck") ); long end = System.currentTimeMillis(); - Bukkit.getLogger().info( String.format( this.getName() + " enabled! (%s ms)", Long.toString( end-start ) ) ); + this.getLogger().info( String.format( this.getName() + " enabled! (%s ms)", Long.toString( end-start ) ) ); } } diff --git a/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java b/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java index 2678b10..3dd629f 100644 --- a/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java +++ b/src/main/java/pl/minecon724/realweather/provider/OpenWeatherMapProvider.java @@ -15,7 +15,7 @@ import pl.minecon724.realweather.WeatherState.*; public class OpenWeatherMapProvider implements Provider { URL endpoint; - + String apiKey; public OpenWeatherMapProvider(String apiKey) {