Skip to content

Create custom Nitime with API

Player Nguyên edited this page May 8, 2017 · 3 revisions

Nitime API

Hi! This is a API page of Nitime plugin. First of all, thanks for using Nitime, we'll make more and more than update to give a best API. If you don't know about class of API, you can try to read this class.

Setting up

Okay. Let's start with setup. First, make sure Nitime it had on server, you can add this code into onEnable() of your plugin.

if (Bukkit.getServer().getPluginManager().getPlugin("Nitime") != null) {
    Bukkit.getLogger().severe("Your server isn't install Nitime! Please install at https://www.spigotmc.org/resources/nitime.40611/");
    Bukkit.getPluginManager().disablePlugin(thisPlugin());
}

A completely code it

public void onEnable()
{
    if (Bukkit.getServer().getPluginManager().getPlugin("Nitime") != null) {
        Bukkit.getLogger().severe("Your server isn't install Nitime! Please install at https://www.spigotmc.org/resources/nitime.40611/");
        Bukkit.getPluginManager().disablePlugin(thisPlugin());
    }
}

In plugin.yml file, add this softdepend: [Nitime] after the main: or some else in this file.

Example plugin.yml:

name: myPlugin
version: stringOfVersion
main: abc.xyz.main
softdepend: [Nitime]

How to create?

To create a notification with basic color, just add this

NitimeAPI.createNotifications(title, texts, position, seconds);

with value:

  • title String: Title to notify, the best is 5 characters and lower
  • texts String: Text to notify, lower than 45 characters it's better
  • position Position: Location in screen, maybe you'll need this
  • seconds int: How many seconds to show? 5 is better

Without default color, try with this

NitimeAPI.createNotifications(title, texts, backcolor, fontcolor, position, seconds)

with value:

  • title String: Title to notify, the best is 5 characters and lower
  • texts String: Text to notify, lower than 45 characters it's better
  • backcolor Color: Background color of noti'. Go here to see how to create custom color
  • fontcolor Color: Like background color, but this for text, not for background.
  • position Position: Location in screen, maybe you'll need this
  • seconds int: How many seconds to show? 5 is better

To directively, Nitime had a normal noti', Check out this list:

  • info(String texts, Position position, int seconds);
  • error(String texts, Position position, int seconds);
  • And more will add in another version

Clone this wiki locally