Developer API

In Nojump version 1.2 I made the plugin much more comfortable for developers.

How to use Nojump in plugins

First, make sure that:

1. You have the latest version of Nojump in your build path

2. If you need Nojump for the plugin to run, add "depend: [Nojump]" to your plugin.yml. If the support of Nojump is optional, add "softdepend: [Nojump]" to your plugin.yml.

3. If you are using the Nojump group system make sure to add Vault to the softdepend in the plugin.yml: "softdepend: [Vault]" or if there is already a softdepend just add "softdepend: [Vault]".

Now that you did those three, you are good to go. There are only 2 classes:

Nojump.java - Has the nojump adding, toggling, disabling and setuping nojump. NojumpMode.java - A simple enum, has the Modes (NojumpMode.TOGGLE, NojumpMode.ENABLE, NojumpMode.DISABLE).

Enabling/Disabling/Toggling Nojump

You can add Nojump to a Player, A Player List or a Player Array(Player[]). There are three methods and one main method. All methods can be used to control a certain Player, a Player Array, or a Player List. The main method is setupNojump(Player, Player[] or List<Player> - All 3 exist p, NojumpMode mode) and is the one that is recommended to use. There is also enableNojump, disableNojump and toggleNojump that only need a player(Can be list or array) and no mode because each method referes to a different mode.

List of methods needed

void Nojump.setupNojump(Player[] p, NojumpMode mode)
void Nojump.setupNojump(List<Player> list, Nojumpmode mode)
void Nojump.setupNojump(Player p, NojumpMode mode)
boolean Nojump.hasNojump(Player p)//Returns whether the player has nojump or dosen't.

ArrayList<Player> Main.hasnojump //The arraylist the plugin uses to store all the players that has nojump.

String NojumpMode.getModeName(NojumpMode m)//Returns "Toggle", "Enable", or "Disable"
NojumpMode NojumpMode.parseMode(String s)//Returns the mode, if string dosen't match any mode will return null.

NOTICE: The Nojump class's ArrayList is reffering to the Main class of the Nojump plugin. The hasnojump List can be accessed by importing the main class of the nojump plugin then using the ArrayList<Player> Main.hasnojump.


Comments

Posts Quoted:
Reply
Clear All Quotes