mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 12:35:12 +01:00
Updated logging to mostly use java.util.logging.Logger
[SD-8645]
This commit is contained in:
parent
3d8a08508a
commit
03e2360a98
@ -1237,7 +1237,7 @@ public enum CompatibleSound {
|
||||
}
|
||||
}
|
||||
if (DEBUG && find == null) {
|
||||
System.out.println("Sound for " + name() + " Not found!");
|
||||
System.err.println("Sound for " + name() + " not found!");
|
||||
}
|
||||
sound = find;
|
||||
compatibilityMode = find == null;
|
||||
@ -1253,7 +1253,7 @@ public enum CompatibleSound {
|
||||
sound = Sound.valueOf(name());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("ERROR loading " + name());
|
||||
System.err.println("ERROR loading " + name());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1268,9 +1268,9 @@ public enum CompatibleSound {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("ERROR loading " + name());
|
||||
System.err.println("ERROR loading " + name());
|
||||
for (Version v : versions) {
|
||||
System.out.println(v.version + " - " + v.sound);
|
||||
System.err.println(v.version + " - " + v.sound);
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -1303,9 +1303,9 @@ public enum CompatibleSound {
|
||||
compatibilityMode = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("ERROR loading " + name() + " (" + minVersion);
|
||||
System.err.println("ERROR loading " + name() + " (" + minVersion);
|
||||
for (Version v : versions) {
|
||||
System.out.println(v.version + " - " + v.sound);
|
||||
System.err.println(v.version + " - " + v.sound);
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -39,10 +39,10 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class SongodaCore {
|
||||
|
||||
private final static String prefix = "[SongodaCore]";
|
||||
private final static Logger logger = Logger.getLogger("SongodaCore");
|
||||
|
||||
/**
|
||||
* Whenever we make a major change to the core GUI, updater,
|
||||
@ -197,7 +197,7 @@ public class SongodaCore {
|
||||
private ArrayList<BukkitTask> tasks = new ArrayList();
|
||||
|
||||
private void register(JavaPlugin plugin, int pluginID, String icon, String libraryVersion) {
|
||||
System.out.println(getPrefix() + "Hooked " + plugin.getName() + ".");
|
||||
logger.info(getPrefix() + "Hooked " + plugin.getName() + ".");
|
||||
PluginInfo info = new PluginInfo(plugin, pluginID, icon, libraryVersion);
|
||||
// don't forget to check for language pack updates ;)
|
||||
info.addModule(new LocaleModule());
|
||||
@ -240,9 +240,9 @@ public class SongodaCore {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
final String er = e.getMessage();
|
||||
System.out.println("Connection with Songoda servers failed: " + (er.contains("URL") ? er.substring(0, er.indexOf("URL") + 3) : er));
|
||||
logger.log(Level.FINE, "Connection with Songoda servers failed: " + (er.contains("URL") ? er.substring(0, er.indexOf("URL") + 3) : er));
|
||||
} catch (ParseException e) {
|
||||
System.out.println("Failed to parse json for " + plugin.getJavaPlugin().getName() + " update check");
|
||||
logger.log(Level.FINE, "Failed to parse json for " + plugin.getJavaPlugin().getName() + " update check");
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +263,11 @@ public class SongodaCore {
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return prefix + " ";
|
||||
return "[SongodaCore] ";
|
||||
}
|
||||
|
||||
public static Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
public static boolean isRegistered(String plugin) {
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.songoda.core.configuration;
|
||||
|
||||
import com.songoda.core.SongodaCore;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ConfigSetting {
|
||||
|
||||
@ -111,7 +113,7 @@ public class ConfigSetting {
|
||||
CompatibleMaterial mat = CompatibleMaterial.getMaterial(config.getString(key));
|
||||
|
||||
if (mat == null) {
|
||||
System.out.println(String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
|
||||
SongodaCore.getLogger().log(Level.WARNING, String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
|
||||
}
|
||||
|
||||
return mat != null ? mat : CompatibleMaterial.STONE;
|
||||
@ -124,7 +126,7 @@ public class ConfigSetting {
|
||||
CompatibleMaterial mat = val != null ? CompatibleMaterial.getMaterial(val) : null;
|
||||
|
||||
if (mat == null) {
|
||||
System.out.println(String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
|
||||
SongodaCore.getLogger().log(Level.WARNING, String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
|
||||
}
|
||||
|
||||
return mat != null ? mat : def;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.core.database;
|
||||
|
||||
import com.songoda.core.SongodaCore;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -16,7 +17,7 @@ public class MySQLConnector implements DatabaseConnector {
|
||||
public MySQLConnector(Plugin plugin, String hostname, int port, String database, String username, String password, boolean useSSL) {
|
||||
this.plugin = plugin;
|
||||
|
||||
System.out.println("connecting to " + hostname + " : " + port);
|
||||
plugin.getLogger().info("connecting to " + hostname + " : " + port);
|
||||
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=" + useSSL);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.songoda.core.utils;
|
||||
|
||||
import com.songoda.core.SongodaCore;
|
||||
import com.songoda.core.compatibility.ClassMapping;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import org.bukkit.Effect;
|
||||
@ -137,7 +138,6 @@ public class BlockUtilsModern {
|
||||
Object mblock = nmsBlockData_getBlock.invoke(craftBlock_getNMS.invoke(cblock));
|
||||
Object mpos = craftBlock_getPostition.invoke(cblock);
|
||||
|
||||
//System.out.println(mblock.getClass());
|
||||
// now for testing stuff
|
||||
if (clazzLeverBlock.isAssignableFrom(mblock.getClass())) {
|
||||
final Object mstate = craftBlockData_getState.invoke(block.getBlockData());
|
||||
@ -148,7 +148,7 @@ public class BlockUtilsModern {
|
||||
} else if (clazzPressurePlateBlock.isAssignableFrom(mblock.getClass())) {
|
||||
nmsPlate_updateNeighbours.invoke(mblock, mworld, mpos);
|
||||
} else {
|
||||
System.out.println("Unknown redstone: " + mblock.getClass().getName());
|
||||
SongodaCore.getLogger().warning("Unknown redstone: " + mblock.getClass().getName());
|
||||
}
|
||||
//
|
||||
// if(mblock instanceof net.minecraft.server.v1_15_R1.BlockLever) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.songoda.core.utils;
|
||||
|
||||
import com.songoda.core.SongodaCore;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
@ -23,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@ -152,7 +155,7 @@ public class ReflectionUtils {
|
||||
Class<?> loadedClazz = Class.forName(name.substring(0, name.lastIndexOf('.')).replace('/', '.'));
|
||||
packageClasses.add(loadedClazz);
|
||||
} catch (ClassNotFoundException e1) {
|
||||
System.err.println("class not found: " + e1.getMessage());
|
||||
SongodaCore.getLogger().log(Level.FINE, "class not found: " + e1.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,7 +182,7 @@ public class ReflectionUtils {
|
||||
|
||||
packageClasses.add(loadedClazz);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.err.println("class not found: " + e.getMessage());
|
||||
SongodaCore.getLogger().log(Level.FINE, "class not found: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return super.visitFile(file, attrs);
|
||||
|
Loading…
Reference in New Issue
Block a user