To answer your questions:
The Optional<String>
was replaced with Optional<Text>
.
To create a new Optional<Text>
:
Text t = Texts.of("Hello World", TextColors.RED);
Optional<Text> ot = Optional.of(t);
Or in one line:
Optional<Text> ot = Optional.of(Texts.of("Hello World", TextColors.RED));
If you ever need a string optional:
Optional<String> os = Optional.of("Hello World");
I would recommend you to use the new commands API. It works without Optionals and parses your arguments. I made a little example: How to use Optional<Text> - #5 by boformer