CSneko / toNeko

喵喵喵~
https://modrinth.com/mod/tonekomod
GNU General Public License v3.0
35 stars 7 forks source link

[Bug] 无法加载插件 #43

Open d0j1a1701 opened 1 week ago

d0j1a1701 commented 1 week ago

ctLib 0.1.6 / toNeko 0.4.6 / Zulu17 JDK/ Purpur 1.16.5

[Server] [12:09:20 INFO]: ctLib插件已启动!
[Server] [12:09:20 ERROR]: Error occurred while enabling toNeko v0.4.6 (Is it up to date?)
[Server] java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map$Entry.getKey()" is null
[Server]        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:78) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.configuration.file.YamlConfiguration.convertMapsToSections(YamlConfiguration.java:82) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:72) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:160) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:128) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:188) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at com.crystalneko.toneko.ToNeko.loadLanguageFile(ToNeko.java:253) ~[?:?]
[Server]        at com.crystalneko.toneko.ToNeko.onEnable(ToNeko.java:58) ~[?:?]
[Server]        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:596) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:309) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1074) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:293) ~[patched_1.16.5.jar:git-Purpur-1171]
[Server]        at java.lang.Thread.run(Thread.java:840) [?:?]
[Server] [12:09:20 INFO]: [toNeko] Disabling toNeko v0.4.6
CSneko commented 6 days ago

已知晓,下一次更新会尝试解决.

暂时的解决方法: 检查plugins/toNeko/config.yml中的language并确保为zh_cn,然后检查plugins/toNeko/language/zh_cn.yml是否存在,不存在则将https://github.com/CSneko/toNeko/blob/Beta-V0.4.6/src/main/resources/language/zh_cn.yml 复制过去即可

d0j1a1701 commented 6 days ago

奇怪之处就在这里,那个文件明明就在那里。或许你可以把那个 getDataFolder() 改成向上面一样写死的 File("plugins/toNeko/language/...") 试试?

这个 getDataFolder() 我找了半天,发现是调用 Bukkit API 的 JavaPlugin.dataFolder,Google 了一下发现这玩意经常出现玄学问题。

CSneko commented 5 days ago

目前我正在尝试对其进行重构,也许重构后问题能够得到解决,不过这可能需要一定时间...?

看起来你似乎有一定基础,也许你可以尝试克隆0.4.6版本并手动修改和构建

d0j1a1701 commented 5 days ago

我的确有一点基础,但并不是 Spigot 开发的基础。README 上并没有关于如何构建 Spigot 版本的提示,直接 gradle build 得到的是 Fabric 版本,但我只需要 Spigot 版本,并且把重构版的 Action 直接搬过来没用。https://github.com/d0j1a1701/toNeko

CSneko commented 4 days ago

事实上gradle build出来的是插件与模组版本通用的,modrinth上的两个版本只是便于分发 (因为插件版本和模组版本的更新并不同步)

d0j1a1701 commented 4 days ago

好吧 不过我手头上没有带有 Fabric 开发环境的电脑,且不幸的是 Github Action 直接搬过来没法编译