API
This page will teach you all you need to know about utilizing the Grappling Hook API.
Setting Up
Before you can do anything with the API you need to add the jar file to your project's java build path as with any api.
Listening For Grapple Events
Listening for a grapple event is easy! Just do exactly as you would when listening to a normal Bukkit event.
@EventHandler
public void onGrapple(PlayerGrappleEvent event){
...
}
Hooking Into The API
Utilizing the Grappling Hook API is extremely simple and straight forward.
First, import this :
import com.snowgears.grapplinghook.api.HookAPI;
Then just call this static method for all Grappling Hook methods:
HookAPI
Click here to see the full API on Github
Examples
If I wanted to check if the item in a player's hand was a Grappling Hook, I would do this:
if(HookAPI.isGrapplingHook(player.getItemInHand()))
If I wanted to set how many uses someone's grappling hook had to 12, I would do this:
ItemStack grapplingHook = player.getItemInHand();
HookAPI.setUses(grapplingHook, 12);