You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix CommandAPI loading on old versions (tested 1.19)
This was a similar issue to what was brought up here: #594 (comment). It seems that having `NMS_1_21_R1::new` as a method reference still loads the `NMS_1_21_R1` class enough that Java gets mad. On 1.19, trying to load the CommandAPI gives `java.lang.VerifyError: Bad type on operand stack - Type 'net/minecraft/commands/CommandBuildContext' (current frame, stack[1]) is not assignable to 'net/minecraft/core/HolderLookup$a'` with the stacktrace going through that line.
Moving all references to the `NMS_1_21_R1` class into the if statements allowed loading on 1.19 as expected. That does mean the slight inconvenience of having to specify and update the latest NMS object in two place.
Copy file name to clipboardExpand all lines: commandapi-platforms/commandapi-bukkit/commandapi-bukkit-vh/src/main/java/dev/jorel/commandapi/CommandAPIVersionHandler.java
+2-5Lines changed: 2 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,6 @@
24
24
importdev.jorel.commandapi.nms.*;
25
25
importorg.bukkit.Bukkit;
26
26
27
-
importjava.util.function.Supplier;
28
-
29
27
/**
30
28
* This file handles the NMS version to be loaded. The CommandAPIVersionHandler
31
29
* file within the commandapi-core module is NOT used at compile time. Instead,
@@ -52,9 +50,8 @@ public interface CommandAPIVersionHandler {
52
50
*/
53
51
staticLoadContextgetPlatform() {
54
52
StringlatestMajorVersion = "21"; // Change this for Minecraft's major update
0 commit comments