diff --git a/src/main/java/com/xiaoace/kooksrv/KookSRV.java b/src/main/java/com/xiaoace/kooksrv/KookSRV.java index f686b8c..89f26ae 100644 --- a/src/main/java/com/xiaoace/kooksrv/KookSRV.java +++ b/src/main/java/com/xiaoace/kooksrv/KookSRV.java @@ -23,9 +23,11 @@ public class KookSRV extends JavaPlugin { static { //重新设置类加载器以至于可以扫描到 webp support 类 - ImageIO.scanForPlugins(); + ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(KookSRV.class.getClassLoader()); ImageIO.scanForPlugins(); + //扫描完恢复上下文loader + Thread.currentThread().setContextClassLoader(ctxLoader); } @Getter