How can I send Title, sub title to player in sponge 8.0?

I want an example code to send title to player in sponge 8.0

Please help me.

Something like

ServerPlayer player;
Title title = Title.title(Component.text("title"), Component.text("sub"));

1 Like

then How can I set stay, fadeIn, fadeOut ?

Duration fadeIn;
Duration stay;
Duration fadeOut;
Component title;
Component sub;
Title.Times titleTime = Title.Times.of(fadeIn, stay, fadeOut);
Title title = Title.title(title, sub, titleTime);
1 Like

Duration fadeIn = new Duration () <— How can I cast Duration ?

Duration is part of java, easiest way is to use the static methods

1 Like

Thank for you care!