MegavexNetwork / scoreboard-library

Powerful packet-level scoreboard library for Paper/Spigot servers
https://megavex.net
MIT License
150 stars 13 forks source link

Loading version only SNAPSHOT? #41

Closed Ayouuuu closed 5 months ago

Ayouuuu commented 5 months ago

https://github.com/MegavexNetwork/scoreboard-library/blob/96595d0a41bea636c33da166f5461d78b4ab5d48/implementation/src/main/java/net/megavex/scoreboardlibrary/implementation/PacketAdapterLoader.java#L45-L63

I think instead of just loading the SNAPSHOT version, this won't work when using other non-SNAPSHOT, so we should check the server version like

switch(version)  {
      case "1.8.8":
        return tryLoadImplementationClass(V1_8_R3);
      case "1.17":
      case "1.17.1":
      case "1.18":
      case "1.18.1":
      case "1.18.2":
      case "1.19":
      case "1.19.1":
      case "1.19.2":
      case "1.19.3":
      case "1.19.4":
      case "1.20":
      case "1.20.1":
      case "1.20.2":
      case "1.20.3":
      case "1.20.4":
      case "1.20.5":
      case "1.20.6":
        return tryLoadImplementationClass(MODERN);
}
vytskalt commented 5 months ago

Is there any server software that returns a value without the SNAPSHOT?

Ayouuuu commented 5 months ago

Is there any server software that returns a value without the SNAPSHOT?

You are right, but when getBukkitVersion() return 1.17-R0.1-xxx-SNAPSHOT or 1.17-R0.1-SNAPSHOT-xxx, 1.17-R0.2-SNAPSHOT scoreboard-library will not work.

vytskalt commented 5 months ago

I guess everything after the first "-" could be cut out, but what software even returns values like that?

Ayouuuu commented 5 months ago

I guess everything after the first "-" could be cut out, but what software even returns values like that?

when someone change this or use a custom server with a changed version https://github.com/PaperMC/Paper/blob/master/gradle.properties#L2

vytskalt commented 5 months ago

should be fixed in cf8fa59c860c48343993758bf618c4d23c9d18d2