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>
|
||||
<groupId>pl.minecon724</groupId>
|
||||
<artifactId>realweather</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>0.5.0.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue