bukkit/paper: Fix Holder#value reflection in obf environment

This commit is contained in:
Jason Penilla 2022-06-09 21:37:15 -07:00 committed by Jason
parent 1fe1b4a0d3
commit 52e6a53175
2 changed files with 6 additions and 2 deletions

View file

@ -233,7 +233,11 @@ public final class ItemStackArgument<C> extends CommandArgument<C, ProtoItemStac
private static final Class<?> HOLDER_CLASS = CraftBukkitReflection.findMCClass("core.Holder");
private static final @Nullable Method VALUE_METHOD = HOLDER_CLASS == null
? null
: CraftBukkitReflection.needMethod(HOLDER_CLASS, "value");
: CraftBukkitReflection.firstNonNullOrThrow(
() -> "Couldn't find Holder#value",
CraftBukkitReflection.findMethod(HOLDER_CLASS, "value"),
CraftBukkitReflection.findMethod(HOLDER_CLASS, "a")
);
private final ArgumentParser<C, ProtoItemStack> parser;

View file

@ -55,7 +55,7 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
@NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
super(required, name, new MaterialParser<>(), defaultValue, Material.class, suggestionsProvider);
super(required, name, new MaterialParser<>(), defaultValue, Material.class, suggestionsProvider, defaultDescription);
}
/**