Skip to content

Commit

Permalink
兼容性修改:在执行完扫描后恢复原来的上下文加载器 (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
DAYGoodTime authored Aug 5, 2024
1 parent f8fab41 commit f5ccece
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/xiaoace/kooksrv/KookSRV.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f5ccece

Please sign in to comment.