Closed Hxncusik closed 2 months ago
First off, I like this idea and this can actually be grouped with a discussion that took place on the CommandAPI discord server about two weeks ago where the general gist was to use argument instances to safe-cast arguments. I also planned working on it eventually so thanks for your suggestion as I believe Brigadier does this like this too, I will definitely consider this when coming up with a potential solution.
Thank you for your reply, I'm very pleased to hear that. I will look forward to implementing the new features.
Implemented in version 9.4.0.
Description
Record#get(String var1, Class<? extends U> var2) For example: String item = entry.get("item", String.class); double chance = entry.get("chance", Double.class); double range = entry.get("range", Double.class);
Expected code
new CommandAPICommand("test").withPermission("*") .withArguments(new FloatArgument("chance"), new FloatArgument("range")) .executesPlayer((player, args) -> { float chance = args.get("chance", float.class); float range = args.get("range", float.class); });
Extra details
No response