Luohuayu/CatServer

[1.18.2] LibertyBans插件无法加载

LiteCat0905 opened this issue · 1 comments

运行环境
Java 17
Minecraft版本(1.12.2/1.16.5/1.18.2):1.18.2
构建版本(从/version指令获取): This server is running CatServer version 1.18.2-ecf29bc1 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT, Forge version 40.2.14)
相关模组/插件:
LibertyBans (最新版本 V1.1.0)
描述这个BUG 无法加载插件 LibertyBans
(如果有报错请附上pastebin链接或上传日志文件)

[13:00:03] [Server thread/ERROR]: Error occurred while enabling LibertyBans v1.1.0-RC1 (Is it up to date?)
 java.lang.NoSuchMethodError: catserver.server.remapper.proxy.ProxyURLClassLoader: method 'void <init>(java.lang.String, java.net.URL[], java.lang.ClassLoader)' not found
        at space.arim.libertybans.bootstrap.AttachableClassLoader.<init>(AttachableClassLoader.java:37) ~[?:?]
        at space.arim.libertybans.bootstrap.LibertyBansLauncher.attemptLaunch(LibertyBansLauncher.java:192) ~[?:?]
        at space.arim.libertybans.env.spigot.plugin.SpigotPlugin.initialize(SpigotPlugin.java:99) ~[?:?]
        at space.arim.libertybans.env.spigot.plugin.SpigotPlugin.onEnable(SpigotPlugin.java:48) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[forge-1.18.2-40.2.14-universal.jar%2359!/:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[forge-1.18.2-40.2.14-universal.jar%2359!/:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[forge-1.18.2-40.2.14-universal.jar%2359!/:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:424) ~[forge-1.18.2-40.2.14-universal.jar%2359!/:1.18.2-ecf29bc1]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:350) ~[forge-1.18.2-40.2.14-universal.jar%2359!/:1.18.2-ecf29bc1]
        at net.minecraft.server.MinecraftServer.m_129815_(MinecraftServer.java:531) ~[server-1.18.2-20220404.173914-srg.jar%2354!/:?]
        at net.minecraft.server.MinecraftServer.m_130006_(MinecraftServer.java:404) ~[server-1.18.2-20220404.173914-srg.jar%2354!/:?]
        at net.minecraft.server.dedicated.DedicatedServer.m_7038_(DedicatedServer.java:240) ~[server-1.18.2-20220404.173914-srg.jar%2354!/:?]
        at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:945) ~[server-1.18.2-20220404.173914-srg.jar%2354!/:?]
        at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:344) ~[server-1.18.2-20220404.173914-srg.jar%2354!/:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]

导致的问题r

复现方法

  1. 把插件放在plugins
  2. 启动服务器
  3. 无法加载
    截图/视频
    (如果没有可以忽略)
A248 commented

To clarify, this happens because the ProxyURLClassLoader does not re-declare the URLClassLoader(String, URL[], ClassLoader) constructor. The String parameter is the name of the ClassLoader and can be ignored. This constructor was introduced in Java 9.

Solving this is very simple, and all you have to do is add the following code:

    public ProxyURLClassLoader(final String name, final URL[] urls, final ClassLoader parent) {
        super(urls, parent);
    }

    public ProxyURLClassLoader(final String name, final URL[] urls, final ClassLoader parent, final URLStreamHandlerFactory factory) {
        super(urls, parent, factory);
    }