GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.88k stars 269 forks source link

some plugins throw java.lang.ArrayIndexOutOfBoundsException when getting version #1082

Open mio-19 opened 4 years ago

mio-19 commented 4 years ago

for instance: SavageFactions log:

13:19:34 [INFO] Enabling Factions v1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9
13:19:34 [INFO] [Factions v1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9] ==== Setup ====
13:19:34 [SEVERE] Error occurred while enabling Factions v1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9 (Is it up to date?)
java.lang.ExceptionInInitializerError
    at com.massivecraft.factions.SavageFactions.onEnable(SavageFactions.java:120)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:320)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412)
    at net.glowstone.GlowServer.enablePlugins(GlowServer.java:1346)
    at net.glowstone.GlowServer.start(GlowServer.java:819)
    at net.glowstone.GlowServer.run(GlowServer.java:625)
    at net.glowstone.GlowServer.main(GlowServer.java:489)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
    at com.massivecraft.factions.util.Particles.ReflectionUtils$PackageType.getServerVersion(ReflectionUtils.java:404)
    at com.massivecraft.factions.util.Particles.ReflectionUtils$PackageType.<clinit>(ReflectionUtils.java:356)
    ... 8 more
13:19:34 [INFO] Disabling Factions v1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9
13:19:34 [INFO] [Factions v1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9] Disabled

ShopChest: (https://github.com/EpicEricEE/ShopChest/issues/301)

01:13:31 [INFO] Enabling ShopChest v1.13-SNAPSHOT
01:13:31 [WARNING] Server version not officially supported: glowstone!
01:13:31 [WARNING] Plugin may still work, but more errors are expected!
01:13:31 [SEVERE] Error occurred while enabling ShopChest v1.13-SNAPSHOT (Is it up to date?)
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
    at de.epiceric.shopchest.utils.Utils.getMajorVersion(Utils.java:617)
    at de.epiceric.shopchest.language.LanguageUtils.load(LanguageUtils.java:1002)
    at de.epiceric.shopchest.ShopChest.onEnable(ShopChest.java:186)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:320)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412)
    at net.glowstone.GlowServer.enablePlugins(GlowServer.java:1346)
    at net.glowstone.GlowServer.start(GlowServer.java:819)
    at net.glowstone.GlowServer.run(GlowServer.java:625)
    at net.glowstone.GlowServer.main(GlowServer.java:489)
01:13:31 [INFO] Disabling ShopChest v1.13-SNAPSHOT
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/87479217-some-plugins-throw-java-lang-arrayindexoutofboundsexception-when-getting-version?utm_campaign=plugin&utm_content=tracker%2F14691067&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F14691067&utm_medium=issues&utm_source=github).
mastercoms commented 4 years ago

Will have to investigate this further, we may have to change the version format to suit CraftBukkit compatibility.

A248 commented 4 years ago

This doesn't seem like an issue with Glowstone. From the SavageFactions source, it's clear it accesses craftbukkit packages to determine the version.

This is the line which generated the error: https://github.com/illyria-io/illyriaFactions/blob/00ccf6cd2b43b99829859243edabfe57bad3c2f5/src/main/java/com/massivecraft/factions/util/Particles/ReflectionUtils.java#L404