-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAPI HowTo.txt
More file actions
36 lines (25 loc) · 1.01 KB
/
API HowTo.txt
File metadata and controls
36 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Add CommandPoints.jar as an external archive then import the API class using:
import pgDev.bukkit.CommandPoints.*;
// Declare the CommandPoints variable:
CommandPointsAPI cpAPI;
// Recommended Method
// Run this function from onEnable.
private void setupCommandPoints() {
Plugin commandPoints = this.getServer().getPluginManager().getPlugin("CommandPoints");
if (commandPoints != null) {
cpAPI = ((CommandPoints)commandPoints).getAPI();
}
}
// Alternate Method
// Here is the function you should add to your plugin's main class.
// It outputs the CommandPointsAPI class so don't forget to assign this to a variable.
private CommandPointsAPI getCommandPointsAPI() {
Plugin commandPoints = this.getServer().getPluginManager().getPlugin("CommandPoints");
if (commandPoints != null) {
return ((CommandPoints)commandPoints).getAPI();
} else {
return null;
}
}
// In your onEnable function add this.
cpAPI = getCommandPointsAPI();