API

SimplePointsv0.4






Hooking into SimplePoints is fairly simple, first off, download SimplePoints.jar and add it to your plugin's dependencies. Next, add this line to your main class:

public static SimplePointsHandler spHandler;



Make sure you are importing "me.badbh222.SimplePoints.SimplePoints" and "me.badbh222.SimplePoints.SimplePointsHandler", next, add this block of code into your main class:

public void setupSimplePoints(){
	
	Plugin spPlugin = (SimplePoints) Bukkit.getServer().getPluginManager().getPlugin("SimplePoints");
	if (spPlugin == null) return;
	spHandler = new SimplePointsHandler();
}



Then, add this to your "onEnable();" method:

setupSimplePoints();



And then you are ready to go, use "spHandler" to call the methods listed below, just make sure to check if "spHandler != null" before trying to modify any points and everything should be working.


Note: This is my first time creating an API of any sort, so if things aren't quite right, don't yell at me. :'(

There are 9 methods in the API at the moment:


public int getPoints(String pointHolder){
	//Returns pointHolder's points.
}

public void addPoints(String pointHolder, int points){
	//Adds points to pointHolder
}

public void subtractPoints(String pointHolder, int points){
	//Subtracts points from pointHolder
}

public void setPoints(String pointHolder, int points){
	//Sets pointHolder's points
}

public boolean addPointHolder(String pointHolder){
	//Adds a pointHolder with 0 points
	//Returns false if there is already a pointHolder by that name
}

public boolean removePointHolder(String pointHolder){
	//Removes a pointHolder
	//Returns false if there is no pointHolder by that name
}

public int pointHolderRank(String pointHolder){
	//Returns the actual rank of the pointHolder (1 and above)
}

public String pointHolderofRank(int rank){
	//Returns the name of the pointHolder at (int) rank (1 and above)
	//Returns null if there is no one at that rank
}

public Set<Entry<String, Integer>> pointLeaderboard(){
	//Returns the EntrySet of the Leaderboard
}

Comments

Posts Quoted:
Reply
Clear All Quotes