diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
new file mode 100644
index 0000000..22bac33
--- /dev/null
+++ b/dependency-reduced-pom.xml
@@ -0,0 +1,55 @@
+
+
+ 4.0.0
+ pl.minecon724
+ realweather
+ 0.0.1
+
+
+
+ true
+ src/main/resources
+
+
+
+
+ maven-shade-plugin
+ 3.3.0
+
+
+ package
+
+ shade
+
+
+
+
+ true
+
+
+ org.json:json
+
+
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.18.2-R0.1-SNAPSHOT
+ provided
+
+
+
+ 17
+ 17
+
+
diff --git a/pom.xml b/pom.xml
index 2916862..61a6f5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,5 +37,28 @@
true
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.3.0
+
+
+ package
+
+ shade
+
+
+
+
+ true
+
+
+ org.json:json
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/pl/minecon724/realweather/GetStateTask.java b/src/main/java/pl/minecon724/realweather/GetStateTask.java
index e23b51d..c628d66 100644
--- a/src/main/java/pl/minecon724/realweather/GetStateTask.java
+++ b/src/main/java/pl/minecon724/realweather/GetStateTask.java
@@ -30,8 +30,10 @@ public class GetStateTask extends BukkitRunnable {
@Override
public void run() {
- if (source == "point") {
+ Bukkit.getLogger().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()));
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 836ffe8..89b71e8 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.Level;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
@@ -18,10 +19,15 @@ public class RW extends JavaPlugin {
saveDefaultConfig();
config = getConfig();
+
ConfigurationSection weatherSec = config.getConfigurationSection("weather");
ConfigurationSection providerSec = config.getConfigurationSection("provider");
ConfigurationSection settingsSec = config.getConfigurationSection("settings");
+ if (settingsSec.getBoolean("debug")) {
+ Bukkit.getLogger().setLevel(Level.ALL);
+ }
+
String source = weatherSec.getString("source");
ConfigurationSection point = weatherSec.getConfigurationSection("point");
@@ -38,8 +44,8 @@ public class RW extends JavaPlugin {
Bukkit.getPluginManager().disablePlugin(this);
}
- Provider provider;
- if (choice == "openweathermap") {
+ Provider provider = null;
+ if (choice.equals("openweathermap")) {
Bukkit.getLogger().info("Using OpenWeatherMap as the weather provider");
provider = new OpenWeatherMapProvider( providerCfg.getString("apiKey") );
}
@@ -53,6 +59,6 @@ public class RW extends JavaPlugin {
);
long end = System.currentTimeMillis();
- Bukkit.getLogger().info( String.format( this.getName() + "enabled! (%s ms)", Double.toString( Math.ceil(end-start) ) ) );
+ Bukkit.getLogger().info( String.format( this.getName() + " enabled! (%s ms)", Long.toString( end-start ) ) );
}
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 55069e2..6257f3e 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -6,7 +6,7 @@ weather:
- second_world
- third_world
# Point for a static location
- # Fake weather and player locations not implemented yet
+ # Weather by player's real location soon
source: point
point:
latitude: 41.84201
@@ -23,8 +23,11 @@ provider:
# More providers soon!
settings:
+ # Delay between rechecking weather
# 20 is one second
- timeBetweenRecheck: 1200
+ # Shouldn't affect performance
+ timeBetweenRecheck: 600
- # Advanced options here
- timeBeforeInitialRun: 0
\ No newline at end of file
+ # Advanced options
+ timeBeforeInitialRun: 0
+ debug: true
\ No newline at end of file