Document and information about an idea

Hi, my name is Lethgir and i’m server admin. I apologize for my english mistakes.

I wan’t to use to sponge to create my server with custom plugins and mods.
So, i look at the documentation about how to create a plugin. But I had a problem with it.
For example, is this page : https://docs.spongepowered.org/en/plugin/basics/commands.html, the GetHelp() and getShortDescription() functions return an Optional initialized before. But, with the Sponge API 2.0, the Interface CommandCallable doesn’t have this functions (see here : http://spongepowered.github.io/SpongeAPI/).
So it’s complicate to learn how to create a plugin if the documentation isn’t modified because even if I searched about that, I don’t find how to initialize an Optional with a String.

Next, i wan’t to create a plugin which can manage achievement. For example, like in Guild Wars 2, when you find a panorama you will earn XP or money. But, I wonder if there is a simple way to check if a player is in defined position or not without make a loop each 0,2 seconds.

Thanks you, Lethgir

The docs are partially outdated atm but the Docs team is trying to resolve this asap.
Sponge is are a little short on manpower :frowning:

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

2 Likes

Hi,

Thanks for your help !