diff --git a/pom.xml b/pom.xml
index 71ed2b7..0a1bb26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
pl.minecon724
realweather
- 0.5.0
+ 0.5.0.1
17
diff --git a/src/main/java/pl/minecon724/realweather/RW.java b/src/main/java/pl/minecon724/realweather/RW.java
index 42e5b3d..0c19e40 100644
--- a/src/main/java/pl/minecon724/realweather/RW.java
+++ b/src/main/java/pl/minecon724/realweather/RW.java
@@ -22,7 +22,10 @@ public class RW extends JavaPlugin {
saveDefaultConfig();
config = getConfig();
- SubLogger.init(getLogger());
+ SubLogger.init(
+ getLogger(),
+ config.getBoolean("logging", false)
+ );
WorldMap.init(
config.getConfigurationSection("map")
diff --git a/src/main/java/pl/minecon724/realweather/SubLogger.java b/src/main/java/pl/minecon724/realweather/SubLogger.java
index 8076e3f..7c7887a 100644
--- a/src/main/java/pl/minecon724/realweather/SubLogger.java
+++ b/src/main/java/pl/minecon724/realweather/SubLogger.java
@@ -4,11 +4,13 @@ import java.util.logging.Level;
import java.util.logging.Logger;
public class SubLogger {
- private static Logger logger;
+ private static Logger LOGGER;
+ private static boolean ENABLED;
private String name;
- static void init(Logger loger) {
- logger = loger;
+ static void init(Logger logger, boolean enabled) {
+ LOGGER = logger;
+ ENABLED = enabled;
}
public SubLogger(String name) {
@@ -16,11 +18,13 @@ public class SubLogger {
}
public void log(Level level, String format, Object... args) {
+ if (!ENABLED) return;
+
Object[] combinedArgs = new Object[args.length + 1];
combinedArgs[0] = name;
System.arraycopy(args, 0, combinedArgs, 1, args.length);
- logger.log(level, String.format("[%s] " + format, combinedArgs));
+ LOGGER.log(level, String.format("[%s] " + format, combinedArgs));
}
public void info(String format, Object... args) {
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 243ab27..a121267 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -64,4 +64,4 @@ time:
# each player has time offset like timezones
# uses timezone as base, unless auto
# uses settings from map
- per_player: false
+ per_player: false
\ No newline at end of file