diff --git a/src/main/java/com/mojang/brigadier/StringReader.java b/src/main/java/com/mojang/brigadier/StringReader.java index c1465df..da5c378 100644 --- a/src/main/java/com/mojang/brigadier/StringReader.java +++ b/src/main/java/com/mojang/brigadier/StringReader.java @@ -233,7 +233,7 @@ public class StringReader implements ImmutableStringReader { public boolean readBoolean() throws CommandSyntaxException { final int start = cursor; - final String value = readString(); + final String value = readUnquotedString(); if (value.isEmpty()) { throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.readerExpectedBool().createWithContext(this); } diff --git a/src/test/java/com/mojang/brigadier/StringReaderTest.java b/src/test/java/com/mojang/brigadier/StringReaderTest.java index 23e2c14..7c06ad9 100644 --- a/src/test/java/com/mojang/brigadier/StringReaderTest.java +++ b/src/test/java/com/mojang/brigadier/StringReaderTest.java @@ -585,4 +585,16 @@ public class StringReaderTest { assertThat(ex.getCursor(), is(0)); } } + + @Test + public void readBoolean_quoted() throws Exception { + final StringReader reader = new StringReader("\"true\""); + try { + reader.readBoolean(); + fail(); + } catch (final CommandSyntaxException ex) { + assertThat(ex.getType(), is(CommandSyntaxException.BUILT_IN_EXCEPTIONS.readerExpectedBool())); + assertThat(ex.getCursor(), is(0)); + } + } } \ No newline at end of file