dmulloy2 / ProtocolLib

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

Cannot change JAR filename #2912

Open SlimeDog opened 2 months ago

SlimeDog commented 2 months ago

Describe the bug Failure to load ProtocolLib on Paper 1.20.6 after changing JAR filename. No other plugins.

To Reproduce Steps to reproduce the behavior:

  1. Change JAR name to ProtocolLib-5.2.1-b689
  2. Install renamed ProtocolLib JAR
  3. Start server
  4. See error

Expected behavior Accept renamed JAR file

Screenshots

[10:26:52] [Server thread/INFO]: [ProtocolLib] Loading server plugin ProtocolLib v5.2.1-SNAPSHOT-689
[10:26:52] [Server thread/ERROR]:   [ProtocolLib] INTERNAL ERROR: Cannot load ProtocolLib.
  If this problem hasn't already been reported, please open a ticket
  at https://github.com/dmulloy2/ProtocolLib/issues with the following data:
  Stack Trace:
  java.lang.IllegalStateException: Detected a newer version of ProtocolLib (5.2.1-b689) in plugin folder than the current (5.2.1-SNAPSHOT). Disabling.
        at ProtocolLib-5.2.1-b689.jar//com.comphenix.protocol.ProtocolLib.checkConflictingVersions(ProtocolLib.java:460)
        at ProtocolLib-5.2.1-b689.jar//com.comphenix.protocol.ProtocolLib.onLoad(ProtocolLib.java:169)
        at io.papermc.paper.plugin.storage.ServerPluginProviderStorage.processProvided(ServerPluginProviderStorage.java:59)
        at io.papermc.paper.plugin.storage.ServerPluginProviderStorage.processProvided(ServerPluginProviderStorage.java:18)
        at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:39)
        at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:508)
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287)
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1140)
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:326)
        at java.base/java.lang.Thread.run(Thread.java:1570)
  Dump:
  Parameters:
    [NULL]
  Sender:
    com.comphenix.protocol.ProtocolLib@40b1eae[
      statistics=<null>
      packetTask=<null>
      tickCounter=0
      configExpectedMod=-1
      updater=<null>
      redirectHandler=<null>
      scheduler=com.comphenix.protocol.scheduler.DefaultScheduler@730b001e
      commandProtocol=<null>
      commandPacket=<null>
      commandFilter=<null>
      packetLogging=<null>
      skipDisable=true
      isEnabled=false
      loader=io.papermc.paper.plugin.manager.DummyBukkitPluginLoader@2117fd7d
      server=CraftServer{serverName=Paper,serverVersion=git-Paper-49,minecraftVersion=1.20.6}
      file=plugins/.paper-remapped/ProtocolLib-5.2.1-b689.jar
      description=org.bukkit.plugin.PluginDescriptionFile@58d10ce2
      pluginMeta=org.bukkit.plugin.PluginDescriptionFile@58d10ce2
      dataFolder=plugins/ProtocolLib
      classLoader=PluginClassLoader{plugin=ProtocolLib v5.2.1-SNAPSHOT-689, pluginEnabled=false, url=plugins/.paper-remapped/ProtocolLib-5.2.1-b689.jar}
      naggable=true
      newConfig=YamlConfiguration[path='', root='YamlConfiguration']
      configFile=plugins/ProtocolLib/config.yml
      logger=com.destroystokyo.paper.utils.PaperPluginLogger@7d0bd4ad
      lifecycleEventManager=io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEventManager@44d3f334
      allowsLifecycleRegistration=true
    ]
  Version:
    ProtocolLib v5.2.1-SNAPSHOT-689
  Java Version:
    22.0.1
  Server:
    git-Paper-49 (MC: 1.20.6)

Version Info Provide your ProtocolLib install info with /protocol dump through pastebin.

> version ProtocolLib
[10:30:07 INFO]: ProtocolLib version 5.2.1-SNAPSHOT-689
[10:30:07 INFO]: Provides read/write access to the Minecraft protocol.
[10:30:07 INFO]: Authors: dmulloy2 and comphenix

(protocol dump produces a stack trace)

Additional context

Athar42 commented 2 months ago

Funny, just tested it on my server and working.

You are sure you didn't have this plugin twice inside the plugin folder (and any subfolder) ?

SlimeDog commented 2 months ago

Funny, just tested it on my server and working.

You are sure you didn't have this plugin twice inside the plugin folder (and any subfolder) ?

There was only one ProtocoLib JAR, but I had renamed it to ProtocolLib-5.2.1-b689. Renaming had not previously been a problem, with ProtocolLib or any other plugin. I reverted to ProtocolLib-5.2.1-SNAPSHOT-689.jar, and I'm happy to report that it works now.

I don't understand why ProtocolLib (unlike any other plugin, or ProtocolLib itself, previously) complains about JAR renaming.

Athar42 commented 2 months ago

Yeah, I can confirm this behavior (although I use the one on Jenkins, which is simply named "ProtocolLib.jar"). I, as usual, I rename it "ProtocolLib-bXXX.jar", it state that it can't load the "bXXX" plugin, but ProtocolLib is still loading fine in my case.

Jeppa commented 2 months ago

I renamed it to ProtocolLib(B689).jar -> no complains ... strange..

Athar42 commented 2 months ago

Try with a dash "-", maybe that's just a little bug :D (Tested on Paper)

Jeppa commented 2 months ago

Try with a dash "-", maybe that's just a little bug :D (Tested on Paper)

Yes, "ProtocolLib_(B689).jar" -> no issue ProtocolLib-(B689).jar -> has that issue (using Paper, while Spigot is OK)

SlimeDog commented 2 months ago

I have encountered this issue only with the current ProtocolLib, of the 160+ plugins I test. For consistency, I modify the JAR filenames of at least half of them -- any filename that contains -SNAPSHOT or -DEV or similar; add b before the build number for those that don't do so; and add the build number for those that don't do so, even though they are development builds.

dmulloy2 commented 2 months ago

yeah so there's some checks on startup where it tries to parse the minecraft version of the file name if it contains a -. immediate fix is to remove that and just name it ProtocolLib.jar. i'll look into removing/fixing that behavior. it's been in for a few years and i don't remember the context of why we added it anymore

SlimeDog commented 2 months ago

Since the check produces an incorrect version assessment and plugin disable, fixing it seems advisable.

DICEALPHAHU commented 2 months ago

The current PluginRemapper behavior is too intrusive #10649 I do not know Paper it is for what purpose, set such a folder.