NexianAPI v1.01

An API for the newcomers.

  1. Monthkiller
    Contributors:
    Fetchetch (github.com/Fetchetch) & Me
    NexianAPI
    An API for the newcomers
    Nexian is a simple API for the coding "noobs" which allows them to do more things, with less code.

    Current APIs:
    • Chat
    • Messaging
    • Title
    • Minimal CommandAPI
    • Scoreboard
    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.

    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:
    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.
    }
    Then when you send a message (don't forget to register the listener!) you will get:

    Code (Text):
    <yournamehere> ***** *** ******** ****
    This is using the example, these are censored words.
    Formatting chat? Got it.
    Code (Text):
    @EventHandler
    public void onChat(AsyncPlayerChatEvent e){

      ChatAPI.ChangeFormatOfMessage(e, e.getPlayer().getName() + " yells: " + e.getMessage())

    }
    That will give you:
    Code (Text):
    yournamehere yells: NexianAPI Test Message!
    If you just want to straight up change it:
    Code (Text):
    @EventHandler
    public void onChat(AsyncPlayerChatEvent e){

    ChatAPI.ChangeChatMessage(e, "lasdposifjislald")

    }
    would give you:
    Code (Text):
    <yournamehere> lasdposifjislald
    no matter what.

    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.

    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);
    You might be wondering what that does.

    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:
    Code (Text):
    title.send(e.getPlayer())
    }
    and the title will show up on whoever chats.

    I'd do more tutorials but I cant right now.