CarmJos / UserPrefix

一个简单、高效且实时更新的用户前缀插件,基于Spigot、LuckPerms实现。
https://carmjos.github.io/UserPrefix
GNU General Public License v3.0
36 stars 10 forks source link

[Bug] UserPrefix 在 NachoSpigot (1.8.8) 中无法正常加载 #19

Closed Yurinann closed 2 years ago

Yurinann commented 2 years ago

问题简述

UserPrefix 在 NachoSpigot (1.8.8) 中无法正常加载,使用 Java 17 驱动

问题来源

问题截图/问题报错

[22:00:17 INFO]: [UserPrefix] 加载配置文件...

[22:00:17 ERROR]: Could not call method 'public static org.bukkit.inventory.ItemStack cc.carm.plugin.userprefix.wrapper.ItemStackWrapper.deserialize(java.util.Map)' of class cc.carm.plugin.userprefix.wrapper.ItemStackWrapper for deserialization
java.lang.NoSuchMethodError: 'int org.bukkit.UnsafeValues.getDataVersion()'
        at cc.carm.plugin.userprefix.wrapper.ItemStackWrapper.<clinit>(ItemStackWrapper.java:18) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeViaMethod(ConfigurationSerialization.java:77) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserialize(ConfigurationSerialization.java:117) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:195) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:35) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:369) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at cc.carm.plugin.userprefix.util.ConfigurationUtil.bang(ConfigurationUtil.java:28) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.configuration.file.FileConfig.initFile(FileConfig.java:38) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.configuration.file.FileConfig.<init>(FileConfig.java:27) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.manager.ConfigManager.initConfig(ConfigManager.java:25) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.Main.onEnable(Main.java:48) [UserPrefix-2.4.3.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:393) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:392) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:351) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:403) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:367) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:329) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:295) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at java.lang.Thread.run(Thread.java:833) [?:?]
[22:00:17 ERROR]: Could not call method 'public static org.bukkit.inventory.ItemStack cc.carm.plugin.userprefix.wrapper.ItemStackWrapper.deserialize(java.util.Map)' of class cc.carm.plugin.userprefix.wrapper.ItemStackWrapper for deserialization
java.lang.NoClassDefFoundError: Could not initialize class cc.carm.plugin.userprefix.wrapper.ItemStackWrapper
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeViaMethod(ConfigurationSerialization.java:77) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserialize(ConfigurationSerialization.java:117) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:195) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:35) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:489) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:26) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:369) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:55) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at cc.carm.plugin.userprefix.util.ConfigurationUtil.bang(ConfigurationUtil.java:28) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.configuration.file.FileConfig.initFile(FileConfig.java:38) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.configuration.file.FileConfig.<init>(FileConfig.java:27) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.manager.ConfigManager.initConfig(ConfigManager.java:25) [UserPrefix-2.4.3.jar:?]
        at cc.carm.plugin.userprefix.Main.onEnable(Main.java:48) [UserPrefix-2.4.3.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:393) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:392) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:351) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:403) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:367) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:329) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:295) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [NachoSpigot.jar:git-NachoSpigot-"adae067"]
        at java.lang.Thread.run(Thread.java:833) [?:?]

操作环境

This server is running NachoSpigot version git-NachoSpigot-"adae067" (MC: 1.8.8) (Implementing API version 1.8.8-R0.2-SNAPSHOT) You are 1 version(s) behind Download the new version at: https://nacho.sculas.xyz

其他补充

https://github.com/CobbleSword/NachoSpigot

CarmJos commented 2 years ago

即将提供额外的物品配置方法,或有望解决此类问题。

CarmJos commented 2 years ago

link #15

CarmJos commented 2 years ago

您好,在最新的提交 969844dae94fd1ac86c1b455de3f30039be04d99 中,我对配置文件、插件接口等内容做出大量更新。

在使用本次提交的版本前,请您先备份当前配置文件,并重新生成全部配置。

更新内容

鉴于 ItemStack 原生配置使用困难且易错,本次提交中不再使用原生配置,而是使用来自 MineConfiguration 项目中 ItemConfig 的配置去加载。这使得配置量大大减轻,也满足了绝大部分人的使用需求。修改后的配置如下所示:

item
  using:
    type: DIAMOND
    name: "&b&lPro &b会员前缀"
    lore:
      - "&7Pro会员专属称号"
      - ""
      - "&f尊贵的Pro会员专属称号。"
      - "&f您将获得多种特权与更好的游戏体验。"
      - ""
      - "&a✔ 您正在使用该前缀"
    enchants:
      PROTECTION_ENVIRONMENTAL: 1 #加一个附魔这样看上去就像是选中了的
    flags:
      - HIDE_ENCHANTS # 隐藏附魔显示

于此同时,针对可能存在的配置上的失误,在本次提交中也对各种情况提供了不同的提示,方便使用者确定问题。

...
[UserPrefix] UserPrefix 3.0.0 开始启动...
[UserPrefix] 加载插件配置...
[UserPrefix] 加载前缀配置...
[UserPrefix] [ERROR] 在加载前缀 /home/container/plugins/UserPrefix/prefixes/example-prefix.yml 时出错,请检查配置!
[UserPrefix] [ERROR] Error occurred when loading prefix #/home/container/plugins/UserPrefix/prefixes/example-prefix.yml !
java.lang.Exception: Invalid material name: INK_SACK
...

补充

由于本次更新的范围较大,并大量采用了本人开发的其他高级类库,因此从本版本开始插件的大小可能不在“轻量”。但整体运行的效率较之前版本会有提升,代码也变得更加简介易懂。

由于采用了内嵌在代码中的配置库,因此自本版本开始需要额外维护本插件的英文版本介绍与配置(config.yml、messages.yml)。如果您有空闲时间,十分欢迎您贡献您的一份力,为UserPrefix提供相关翻译。

CarmJos commented 2 years ago

拜托您下载 actions@2518327579 的构件帮助测试,您也可以直接 点击这里 下载对应构件。

CarmJos commented 2 years ago

@Yurinann

CarmJos commented 2 years ago

您好,新的提交中修改了配置路径,请下载 https://github.com/CarmJos/UserPrefix/runs/6948608103 对应构件,谢谢。

CarmJos commented 2 years ago

您好,我看到您有做反应,请问新构件有任何异常吗? @Yurinann

Yurinann commented 2 years ago

抱歉迟来已久的回复,近两天刚刚考完试,在搭建完环境后即时进行测试,截至目前并未发现任何问题,如有问题会再次提交,感谢您的帮助。

测试环境: 1.19 Paper

CarmJos commented 2 years ago

好的,稍后我会进行发版,感谢您的帮助!

由于本次更新的范围较大,并大量采用了本人开发的其他高级类库,因此从本版本开始插件的大小可能不在“轻量”。但整体运行的效率较之前版本会有提升,代码也变得更加简介易懂。

由于采用了内嵌在代码中的配置库,因此自本版本开始需要额外维护本插件的英文版本介绍与配置(config.yml、messages.yml)。如果您有空闲时间,十分欢迎您贡献您的一份力,为UserPrefix提供相关翻译。