From 655016c92e7ab636318af463d8a18711810eaff9 Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sat, 6 Jul 2024 22:24:56 -0400 Subject: [PATCH] fix(Grasscutter.java): Exclude compiled protos package from being scanned by reflections --- src/main/java/emu/grasscutter/Grasscutter.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/Grasscutter.java b/src/main/java/emu/grasscutter/Grasscutter.java index 8c3248dd7..0c64a3d4b 100644 --- a/src/main/java/emu/grasscutter/Grasscutter.java +++ b/src/main/java/emu/grasscutter/Grasscutter.java @@ -29,13 +29,15 @@ import lombok.*; import org.jline.reader.*; import org.jline.terminal.*; import org.reflections.Reflections; +import org.reflections.util.ConfigurationBuilder; +import org.reflections.util.FilterBuilder; import org.slf4j.LoggerFactory; public final class Grasscutter { public static final File configFile = new File("./config.json"); - public static final Reflections reflector = new Reflections("emu.grasscutter"); @Getter private static final Logger logger = (Logger) LoggerFactory.getLogger(Grasscutter.class); + public static final Reflections reflector; @Getter public static ConfigContainer config; @Getter @Setter private static Language language; @@ -75,6 +77,15 @@ public final class Grasscutter { var mongoLogger = (Logger) LoggerFactory.getLogger("org.mongodb.driver"); mongoLogger.setLevel(Level.OFF); + // Configure the reflector. + reflector = new Reflections( + new ConfigurationBuilder() + .forPackage("emu.grasscutter") + .filterInputsBy(new FilterBuilder() + .includePackage("emu.grasscutter") + .excludePackage("emu.grasscutter.net.proto")) + ); + // Load server configuration. Grasscutter.loadConfig(); // Attempt to update configuration.