From 6b57d5f2601c7fce513a05930b96e88173542dd8 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Mon, 13 Nov 2017 11:15:04 +0100 Subject: [PATCH] Expose information about the built-in arguments (bounds or type) --- build.gradle | 2 +- .../com/mojang/brigadier/arguments/FloatArgumentType.java | 8 ++++++++ .../mojang/brigadier/arguments/IntegerArgumentType.java | 8 ++++++++ .../mojang/brigadier/arguments/StringArgumentType.java | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 66e77866..97b9fb08 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ import groovy.io.FileType apply plugin: 'java-library' apply plugin: 'maven' -version = '0.1.8' +version = '0.1.9' group = 'com.mojang' task wrapper(type: Wrapper) { diff --git a/src/main/java/com/mojang/brigadier/arguments/FloatArgumentType.java b/src/main/java/com/mojang/brigadier/arguments/FloatArgumentType.java index b7291db2..f3db9665 100644 --- a/src/main/java/com/mojang/brigadier/arguments/FloatArgumentType.java +++ b/src/main/java/com/mojang/brigadier/arguments/FloatArgumentType.java @@ -34,6 +34,14 @@ public static float getFloat(final CommandContext context, final String name) return context.getArgument(name, Float.class); } + public float getMinimum() { + return minimum; + } + + public float getMaximum() { + return maximum; + } + @Override public Float parse(final StringReader reader, final CommandContextBuilder contextBuilder) throws CommandSyntaxException { final int start = reader.getCursor(); diff --git a/src/main/java/com/mojang/brigadier/arguments/IntegerArgumentType.java b/src/main/java/com/mojang/brigadier/arguments/IntegerArgumentType.java index ccc41e75..fc2b6815 100644 --- a/src/main/java/com/mojang/brigadier/arguments/IntegerArgumentType.java +++ b/src/main/java/com/mojang/brigadier/arguments/IntegerArgumentType.java @@ -34,6 +34,14 @@ public static int getInteger(final CommandContext context, final String name) return context.getArgument(name, int.class); } + public int getMinimum() { + return minimum; + } + + public int getMaximum() { + return maximum; + } + @Override public Integer parse(final StringReader reader, final CommandContextBuilder contextBuilder) throws CommandSyntaxException { final int start = reader.getCursor(); diff --git a/src/main/java/com/mojang/brigadier/arguments/StringArgumentType.java b/src/main/java/com/mojang/brigadier/arguments/StringArgumentType.java index fe427a5e..e8082d1d 100644 --- a/src/main/java/com/mojang/brigadier/arguments/StringArgumentType.java +++ b/src/main/java/com/mojang/brigadier/arguments/StringArgumentType.java @@ -29,6 +29,10 @@ public static String getString(final CommandContext context, final String nam return context.getArgument(name, String.class); } + public StringType getType() { + return type; + } + @Override public String parse(final StringReader reader, final CommandContextBuilder contextBuilder) throws CommandSyntaxException { if (type == StringType.GREEDY_PHRASE) {