Skip to content

Commit

Permalink
SlimefunItemStack can't be casted to ItemStack anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Intybyte committed Nov 12, 2024
1 parent f4c0864 commit 861d303
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.Arrays;
import java.util.stream.Stream;

import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.provider.Arguments;
Expand Down Expand Up @@ -31,7 +33,8 @@ private ItemStack getAsItemStack(String fieldName) {
Field field;
try {
field = clazz.getField(fieldName);
return (ItemStack) field.get(null);
SlimefunItemStack slimefunItem = (SlimefunItemStack) field.get(null);
return slimefunItem.item();
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new IllegalArgumentException("Could not find field SlimefunItems." + fieldName);
}
Expand Down

0 comments on commit 861d303

Please sign in to comment.