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:
Minecon724 2024-01-20 12:17:20 +00:00
parent 1d864b74d0
commit 3abb437c5b
4 changed files with 14 additions and 7 deletions

View file

@ -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>

View file

@ -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")

View file

@ -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) {

View file

@ -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