Describe the bug
Creating RenderedMaps on legacy versions yields a NoSuchMethodError. This is because prior to 1.13.2, MapView#getId() returned a short instead of an int. Since the library is currently compiled against newer versions, it always looks for a getId() method that returns an int.
The obvious fix would be to compile the library against different spigot versions. But that is something I want to avoid from 2.0 on. As an alternative, reflection/MethodHandles that are initialised differently based on the Minecraft version could be used.
To Reproduce
Steps to reproduce the behavior:
Include version 2.0 of this library
Create a RenderedMap
Expected behavior
It should work without any issues.
Screenshots, Code & Stack Traces
java.lang.NoSuchMethodError: org.bukkit.map.MapView.getId()I
at com.github.johnnyjayjay.spigotmaps.RenderedMap.lambda$new$0(RenderedMap.java:32) ~[?:?]
at java.util.ArrayList.forEach(Unknown Source) ~[?:1.8.0_261]
at com.github.johnnyjayjay.spigotmaps.RenderedMap.<init>(RenderedMap.java:32) ~[?:?]
at com.github.johnnyjayjay.spigotmaps.RenderedMap.create(RenderedMap.java:54) ~[?:?]
at com.github.johnnyjayjay.spigotmaps.MapBuilder.build(MapBuilder.java:55) ~[?:?]
at me.d3lt3x.maps.main.Main.createImage(Main.java:61) ~[?:?]
at me.d3lt3x.maps.main.Main.onCommand(Main.java:36) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
... 16 more
Spigot Version:
1.8.8, but same for anything below 1.13.2.
Describe the bug Creating
RenderedMap
s on legacy versions yields aNoSuchMethodError
. This is because prior to 1.13.2,MapView#getId()
returned ashort
instead of anint
. Since the library is currently compiled against newer versions, it always looks for agetId()
method that returns anint
.The obvious fix would be to compile the library against different spigot versions. But that is something I want to avoid from 2.0 on. As an alternative, reflection/MethodHandles that are initialised differently based on the Minecraft version could be used.
To Reproduce Steps to reproduce the behavior:
RenderedMap
Expected behavior It should work without any issues.
Screenshots, Code & Stack Traces
Spigot Version: 1.8.8, but same for anything below 1.13.2.
Additional context /