PlayerType implements WordType<Player> { @Override public Player parse(StringReader reader) throws CommandSyntaxException { var name = reader.readUnquotedString(); var player = Bukkit.getPlayerExact(name); if (player == null) { throw EXCEPTION.createWithContext(reader, name); } return player; } PlayerType(); @Override Player parse(StringReader reader); @Override CompletableFuture<Suggestions> listSuggestions(S source, CommandContext<S> context, SuggestionsBuilder builder); @Override List<String> getExamples();  }
@Test void parse() throws CommandSyntaxException { assertNotNull(type.parse(new StringReader("Pante"))); }
@Test void parse_throws_exception() throws CommandSyntaxException { assertEquals( "Unknown player: invalid", assertThrows(CommandSyntaxException.class, () -> type.parse(new StringReader("invalid"))).getRawMessage().toString() ); }