release 0.5.0.1
fixed oopsie namely disabled logging by default it can be enabled by adding "logging: true" to body of config.yml
This commit is contained in:
parent
1d864b74d0
commit
3abb437c5b
4 changed files with 14 additions and 7 deletions
2
pom.xml
2
pom.xml
|
@ -2,7 +2,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pl.minecon724</groupId>
|
<groupId>pl.minecon724</groupId>
|
||||||
<artifactId>realweather</artifactId>
|
<artifactId>realweather</artifactId>
|
||||||
<version>0.5.0</version>
|
<version>0.5.0.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
|
|
@ -22,7 +22,10 @@ public class RW extends JavaPlugin {
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
config = getConfig();
|
config = getConfig();
|
||||||
|
|
||||||
SubLogger.init(getLogger());
|
SubLogger.init(
|
||||||
|
getLogger(),
|
||||||
|
config.getBoolean("logging", false)
|
||||||
|
);
|
||||||
|
|
||||||
WorldMap.init(
|
WorldMap.init(
|
||||||
config.getConfigurationSection("map")
|
config.getConfigurationSection("map")
|
||||||
|
|
|
@ -4,11 +4,13 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class SubLogger {
|
public class SubLogger {
|
||||||
private static Logger logger;
|
private static Logger LOGGER;
|
||||||
|
private static boolean ENABLED;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
static void init(Logger loger) {
|
static void init(Logger logger, boolean enabled) {
|
||||||
logger = loger;
|
LOGGER = logger;
|
||||||
|
ENABLED = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubLogger(String name) {
|
public SubLogger(String name) {
|
||||||
|
@ -16,11 +18,13 @@ public class SubLogger {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void log(Level level, String format, Object... args) {
|
public void log(Level level, String format, Object... args) {
|
||||||
|
if (!ENABLED) return;
|
||||||
|
|
||||||
Object[] combinedArgs = new Object[args.length + 1];
|
Object[] combinedArgs = new Object[args.length + 1];
|
||||||
combinedArgs[0] = name;
|
combinedArgs[0] = name;
|
||||||
System.arraycopy(args, 0, combinedArgs, 1, args.length);
|
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) {
|
public void info(String format, Object... args) {
|
||||||
|
|
|
@ -64,4 +64,4 @@ time:
|
||||||
# each player has time offset like timezones
|
# each player has time offset like timezones
|
||||||
# uses timezone as base, unless auto
|
# uses timezone as base, unless auto
|
||||||
# uses settings from map
|
# uses settings from map
|
||||||
per_player: false
|
per_player: false
|
Loading…
Reference in a new issue