bergerhealer / BKCommonLib

An extensive library used in bergerhealer's plugins
Other
181 stars 45 forks source link

BKCommonLib-1.19.3-v2-1501 causes issue with config file of other plugin #157

Closed nhanledev closed 1 year ago

nhanledev commented 1 year ago
BkCommonLib version: BKCommonLib-1.19.3-v2-1501
Spigot version: Paper 1.19.3 build 404

Problem or bug:

New version of BKCommonLib makes other plugin cannot load by throwing exception. In my case it is BetterTrident https://www.spigotmc.org/resources/bettertridents.92656/

Expected behaviour:

It should let BetterTrident load normally like in previous build.

Steps to reproduce:

Install Paper 1.19.3 build 404 Install MyWorlds MyWorlds-1.19.3-v3-213 Install BKCommonLib-1.19.3-v2-1501 Install BetterTridents-2.2.2

Exception throws:

[23:01:18 INFO]: [BKCommonLib] Enabling BKCommonLib v1.19.3-v2
[23:01:18 INFO]: [BKCommonLib] BKCommonLib is running on Paperspigot (git-Paper-404) : v1_19_R2 (Minecraft 1.19.3)
[23:01:18 WARN]: [ProtocolLib] Loaded class com.bergerkiller.mountiplex.reflection.util.fast.InvalidArgumentCountException from BKCommonLib v1.19.3-v2 which is not a depend or softdepend of this plugin.
[23:01:18 INFO]: [BKCommonLib.Network] Now using the ProtocolLib library to provide Packet Listener and Monitor support
[23:01:19 ERROR]: [BetterTridents] [Configuration] An error occured while loading plugin.yml resource for plugin BetterTridents:
org.yaml.snakeyaml.constructor.ConstructorException: could not determine a constructor for the tag !@UTF8
 in 'reader', line 11, column 5:
      - !@UTF8
        ^

        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructUndefined.construct(SafeConstructor.java:620) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:469) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:435) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlSeq.construct(SafeConstructor.java:577) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270) ~[snakeyaml-1.33.jar:?]
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253) ~[snakeyaml-1.33.jar:?]
        at org.bukkit.configuration.file.YamlConstructor.construct(YamlConstructor.java:27) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:117) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at com.bergerkiller.bukkit.common.internal.logic.PluginLoaderHandler.<init>(PluginLoaderHandler.java:24) ~[BKCommonLib-1.19.3-v2-1501.jar:?]
        at com.bergerkiller.bukkit.common.internal.logic.PluginLoaderHandlerSpigot.<init>(PluginLoaderHandlerSpigot.java:23) ~[BKCommonLib-1.19.3-v2-1501.jar:?]
        at com.bergerkiller.bukkit.common.internal.logic.PluginLoaderHandler.createFor(PluginLoaderHandler.java:137) ~[BKCommonLib-1.19.3-v2-1501.jar:?]
        at com.bergerkiller.bukkit.common.internal.logic.PluginLoaderHandler.isPluginFullyEnabled(PluginLoaderHandler.java:185) ~[BKCommonLib-1.19.3-v2-1501.jar:?]
        at com.bergerkiller.bukkit.common.PluginBase.onEnable(PluginBase.java:871) ~[BKCommonLib-1.19.3-v2-1501.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:371) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:544) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:580) ~[paper-1.19.3.jar:git-Paper-404]
        at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:493) ~[paper-1.19.3.jar:git-Paper-404]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:274) ~[paper-1.19.3.jar:git-Paper-404]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.19.3.jar:git-Paper-404]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-404]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[23:01:19 INFO]: [BKCommonLib] Having an error? *gasp* Don't forget to file a ticket on github!
[23:01:19 INFO]: [BKCommonLib] BKCommonLib version 1.19.3-v2 (build: 1501) enabled! (1.048s)
bergerkiller commented 1 year ago

Interesting, hadn't thought of that.

As part of the PluginBase API plugins are made known of other plugins that exist on the server and have enabled. It reads other plugins' plugin.yml to see if they use a preloader (like many of my plugins do) and if they do, whether the preloader also confirms the plugin enabled. I guess if a plugin's yaml is malformed like this, errors occur.

Thankfully nothing happens when an error occurs - the plugin's presence is simply not notified to other plugins. I'll rewrite this a little to silence errors like this / dont check plugin.yml unless the plugin's main class is the Preloader class.

bergerkiller commented 1 year ago

https://ci.mg-dev.eu/job/BKCommonLib/1502/ here ya go

nhanledev commented 1 year ago

https://ci.mg-dev.eu/job/BKCommonLib/1502/ here ya go

That was fast! That snapshot build fixes this issue, at least for me and BetterTrident! Thank you so much.