Suppress console noise

This commit is contained in:
NotAlexNoyle committed 2026-06-04 11:54:43 -04:00
1 parent f5208d35b0
commit b2720c449e
2 files changed
+27 -2

No files matched your search

@@ -22,6 +22,8 @@ package plugily.projects.buildbattle;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.TestOnly;
@@ -78,6 +80,7 @@ public class Main extends PluginMain {
public void onEnable() {
long start = System.currentTimeMillis();
installDebugNoiseFilter();
new LanguageMigrator(this);
MessageInitializer messageInitializer = new MessageInitializer(this);
super.onEnable();
@@ -99,6 +102,28 @@ public class Main extends PluginMain {
}
// Suppress shaded MiniGamesBox-Classic "[Debug] Loaded locale" startup spam
// logged at WARNING.
private void installDebugNoiseFilter() {
java.util.logging.Logger jul = java.util.logging.Logger.getLogger(getName());
Filter previous = jul.getFilter();
jul.setFilter(new Filter() {
@Override
public boolean isLoggable(LogRecord record) {
String msg = record.getMessage();
if (msg != null && msg.startsWith("[Debug] Loaded locale"))
return false;
return previous == null || previous.isLoggable(record);
}
});
}
public void initializePluginClasses() {
addFileName("themes");
@@ -69,11 +69,11 @@ public class HeadDatabaseManager {
} else if (status == DownloadStatus.SUCCESS) {
plugin.getDebugger().debug(Level.WARNING, "&aDownloaded heads " + name + " properly!");
plugin.getDebugger().debug(Level.INFO, "&aDownloaded heads " + name + " properly!");
} else if (status == DownloadStatus.LATEST) {
plugin.getDebugger().debug(Level.WARNING, "&aHeads " + name + " is latest! Awesome!");
plugin.getDebugger().debug(Level.INFO, "&aHeads " + name + " is latest! Awesome!");
}