- Contributors:
- Fetchetch (github.com/Fetchetch) & Me
Nexian is a simple API for the coding "noobs" which allows them to do more things, with less code.NexianAPIAn API for the newcomers
Current APIs:
All of those APIs contain a internal Javadoc (I'm not sure if it will work or not) so you don't need a external Javadoc to use it.
- Chat
- Messaging
- Title
- Minimal CommandAPI
- Scoreboard
All of these spoilers below contains example code.
Now just a fair warning we are NOT using PlayerChatEvent since it is deprecated. We are using AsyncPlayerChatEvent.
For this snippet we are going to censor the words: these, are, censored, words.
To do this:
Then when you send a message (don't forget to register the listener!) you will get:Code (Text):@EventHandler
public void onChat(AsyncPlayerChatEvent e){
ChatAPI.CensoredChatMessage(e, new String[]{"these", "are", "censored", "words"}
//That will change that set of words to *'s for the length of the word.
}
Formatting chat? Got it.Code (Text):<yournamehere> ***** *** ******** ****
This is using the example, these are censored words.
That will give you:Code (Text):@EventHandler
public void onChat(AsyncPlayerChatEvent e){
ChatAPI.ChangeFormatOfMessage(e, e.getPlayer().getName() + " yells: " + e.getMessage())
}
If you just want to straight up change it:Code (Text):yournamehere yells: NexianAPI Test Message!
would give you:Code (Text):@EventHandler
public void onChat(AsyncPlayerChatEvent e){
ChatAPI.ChangeChatMessage(e, "lasdposifjislald")
}no matter what.Code (Text):<yournamehere> lasdposifjislald
Messaging ill do up later since its less important.
This you only need to declare once per title, then send it using the built in send function.
You might be wondering what that does.Code (Text):]@EventHandler
public void onChat(AsyncPlayerChatEvent e){
//This is a "new" used API.
//Your supposed to use it like: TitleAPI test = new TitleAPI(...)
TitleAPI test = new TitleAPI("{text:\"put anything in here, title\", color:\"color here (ex: dark_purple)\"}", "{text:\"anything in here, subtitle\", color:\"color here\"}", 10, 20, 30);
The backslashes are a java thing. It makes it so " after it doesn't end the string. Example: "that is a \"string\" that is using slashes"
The first string is the JSON text for the title's title. Look up on titles and you might know more.
Second one, same thing.
The 10 is a 1/2 a second. The game runs in ticks, which one is 1/20 of a second (correct me if I'm wrong). The 10 is in the fade in time, so 40 will take 2 seconds, 10 will take 1/2 a second.
The 20 is another tick thing, its the duration of how long before it fades out.
The 30 is also another tick thing (the last) and this is the fade out time.
Then we send it to the player:
and the title will show up on whoever chats.Code (Text):title.send(e.getPlayer())
}
I'd do more tutorials but I cant right now.