If I am correct it should be like this. But that looks rather strange .
//Wrapper Class for sponge chatevents. (using multiple api's in 1 plugin)
public class SpongeChatMessage extends ChatMessage {
private PlayerChatEvent event;
public SpongeChatMessage(PlayerChatEvent event){
this.event = event;
}
@Override
public String getMessage() {
//hue not sure here :( ;-;
return (String) event.getMessage().getContent();
}
}
used it before. from testing (and memory), getContent() from a Message.Text object returns a String representative of a plain text version of the contained and possibly formatted text.
Using getContent() is usually not a good idea because it only returns the content of the Message object itself, but does not include the plain text content of the children messages.
Assuming we have a Message with content in this simplified form: [BLUE]Hello, [GREEN]Minecrell!
Colors can be only set separately on new message instances so we would have a Message object with color TextColors.BLUE, the content Hello, , as well as a child message with TextColors.GREEN and content Minecrell!:
Now if you would call getContent() on this message object it would return just Hello, instead of Hello, Minecrell! as expected. Texts.toPlain(text) in Text API 2 would return the correct result.
You should also keep in mind Message.Text is not the only message type, you would get an exception if the message instance would be a Message.Score for example. In these cases Texts.toPlain(text) might also return different results even when called with the same arguments because the Message.Score would be replaced with the actual score of the player instead of a simple plain text message.