Skip to content

Commit 301eb12

Browse files
committed
Handle Paper 26.2 shift in NMS->CraftItemStack.
Now also looks for the asCraftMirror method which does the same thing.
1 parent 4e18e65 commit 301eb12

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

cloud-bukkit/src/main/java/org/incendo/cloud/bukkit/parser/ItemStackParser.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,11 @@ private static final class ModernParser<C> implements ArgumentParser.FutureArgum
161161
CraftBukkitReflection.findMethod(ITEM_INPUT_CLASS, "createItemStack", int.class, boolean.class),
162162
CraftBukkitReflection.findMethod(ITEM_INPUT_CLASS, "createItemStack", int.class)
163163
);
164-
private static final Method AS_BUKKIT_COPY_METHOD = CraftBukkitReflection
165-
.needMethod(CRAFT_ITEM_STACK_CLASS, "asBukkitCopy", NMS_ITEM_STACK_CLASS);
164+
private static final Method AS_BUKKIT_COPY_METHOD = CraftBukkitReflection.firstNonNullOrThrow(
165+
() -> "Couldn't find asBukkitCopy or asCraftMirror method on CraftItemStack",
166+
CraftBukkitReflection.findMethod(CRAFT_ITEM_STACK_CLASS, "asBukkitCopy", NMS_ITEM_STACK_CLASS),
167+
CraftBukkitReflection.findMethod(CRAFT_ITEM_STACK_CLASS, "asCraftMirror", NMS_ITEM_STACK_CLASS)
168+
);
166169
private static final Field ITEM_FIELD = CraftBukkitReflection.firstNonNullOrThrow(
167170
() -> "Couldn't find item field on ItemInput",
168171
CraftBukkitReflection.findField(ITEM_INPUT_CLASS, "b"),

0 commit comments

Comments
 (0)