dmulloy2 / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
983 stars 259 forks source link

Reload error with players online #2954

Open DavideBlade opened 1 month ago

DavideBlade commented 1 month ago

Describe the bug When reloading the server with at least one player online, the error below occurs when disabling ProtocolLib. After this occurs, the plugin and/or its dependencies don't work properly (even though there are no errors in the console). On the other hand, if there are no players, the plugin is reloaded normally and subsequently works properly. The bug has been reproduced with an empty server with no plugins (except ProtocolLib) and with some plugins that depend on ProtocolLib: in both cases the result is the same.

To Reproduce Steps to reproduce the behavior:

  1. Install ProtocolLib
  2. Log into the server
  3. Run the /reload command

Expected behavior Reload normally as it happens without any online player.

Version Info /protocol dump output

Stack trace

[17:20:35] [Server thread/INFO]: [ProtocolLib] Disabling ProtocolLib v5.2.0-SNAPSHOT-679
[17:20:35] [Server thread/ERROR]: Error occurred while disabling ProtocolLib v5.2.0-SNAPSHOT-679 (Is it up to date?)
com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
        at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[?:?]
        at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:315) ~[?:?]
        at com.comphenix.protocol.utility.ChatExtensions.createChatPackets(ChatExtensions.java:65) ~[?:?]
        at com.comphenix.protocol.utility.ChatExtensions.sendMessageSilently(ChatExtensions.java:163) ~[?:?]
        at com.comphenix.protocol.utility.ChatExtensions.broadcastMessageSilently(ChatExtensions.java:182) ~[?:?]
        at com.comphenix.protocol.CommandPacket.broadcastMessageSilently(CommandPacket.java:123) ~[?:?]
        at com.comphenix.protocol.ProtocolLib$2.publish(ProtocolLib.java:294) ~[?:?]
        at java.util.logging.Logger.log(Logger.java:980) ~[?:?]
        at org.bukkit.plugin.PluginLogger.log(PluginLogger.java:34) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at java.util.logging.Logger.doLog(Logger.java:1007) ~[?:?]
        at java.util.logging.Logger.log(Logger.java:1030) ~[?:?]
        at java.util.logging.Logger.severe(Logger.java:1777) ~[?:?]
        at com.comphenix.protocol.ProtocolLib.onDisable(ProtocolLib.java:564) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:268) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:367) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:501) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:493) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManager.java:544) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.reload(CraftServer.java:937) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at org.bukkit.Bukkit.reload(Bukkit.java:844) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.dispatchCommand(CraftServer.java:875) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.dispatchServerCommand(CraftServer.java:860) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at net.minecraft.server.dedicated.DedicatedServer.bk(DedicatedServer.java:412) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1242) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1054) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4019-Spigot-864e4ac-c8b4da8]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
DavideBlade commented 4 days ago

In v5.3.0-SNAPSHOT-722 the issue is solved.