Add BauSystem.fixLogging
Dieser Commit ist enthalten in:
Ursprung
4bbb8a7abd
Commit
0b12d669f9
@ -24,9 +24,15 @@ import de.steamwar.bausystem.linkage.LinkageUtils;
|
||||
import de.steamwar.bausystem.region.loader.PrototypeLoader;
|
||||
import de.steamwar.bausystem.region.loader.RegionLoader;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@Getter
|
||||
@ -36,6 +42,9 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// LOGGER
|
||||
fixLogging();
|
||||
|
||||
instance = this;
|
||||
SWUtils.setBausystem(instance);
|
||||
|
||||
@ -51,4 +60,25 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
RegionLoader.save();
|
||||
}
|
||||
|
||||
private void fixLogging() {
|
||||
System.setErr(new PrintStream(new OutputStream() {
|
||||
private StringBuilder current = new StringBuilder();
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
if (b == '\n') {
|
||||
String logging = current.toString();
|
||||
if (logging.contains("SLF4J")) {
|
||||
Bukkit.getLogger().info(logging);
|
||||
} else {
|
||||
Bukkit.getLogger().warning(logging);
|
||||
}
|
||||
current = new StringBuilder();
|
||||
} else {
|
||||
current.append((char) b);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
@ -79,9 +79,6 @@ allprojects {
|
||||
|
||||
dependencies {
|
||||
implementation project(":BauSystem_Main")
|
||||
|
||||
// implementation 'org.slf4j:slf4j-log4j12:2.0.0-alpha1'
|
||||
// implementation 'org.slf4j:slf4j-nop:2.0.0-alpha1'
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren