-
Notifications
You must be signed in to change notification settings - Fork 2
PointsOfInterestAPI
Plugin Developers who want to write a plugin which interacts with the PointsOfInterest plugin for bukkit. If you are a strictly a server admin, then you do not need the API -- You can get the plugin here.
The Points of Interest API is a jar file which allows your code to interact with my code.
The source is here and the download is there.
If you are not familiar with implementing Interfaces in Java or including jars as libraries in Eclipse, you should brush up on these topics before attempting this.
Exactly how you do this is up to you, but I typically include it as an external jar through the "Build Path" dialog.
There is currently only one method to implement:
onEvent(crussell52.poi.api.PoiEvent event)
This will receive and react to a PoiEvent whenever one occurs. There are currently two event types:
// when player selects a POI or current poi is unselected
// crussell52.poi.api.IPoi getPoi() will represent the selected POI or have
// a value of null in the case of deselection.
PoiEvent.Type.SELECTION_CHANGE
// when player crosses the range boundary of their selected POI.
// Boolean inRange() will contain their current state.
// crussell52.poi.api.IPoi getPoi() will represent the related POI.
PoiEvent.Type.IN_RANGE_CHANGE
PoiEvent.getType()
should be used to take action as necessary, based on which one of the above types it returns.
You will also have access to the related org.bukkit.entity.Player
instance through PoiEvent.getPlayer()
.
You can register any implementer of IPoiListener using the following code:
Plugin plugin = getServer().getPluginManager().getPlugin("PointsOfInterest");
if (plugin instanceof IPointsOfInterest) {
((IPointsOfInterest)plugin).registerPoiListener(PoiEvent.Type, IPoiListener);
}
You will need to include the PointsOfInterestAPI classes in your exported jar. Use your favorite technique to do this.
I use an ant script. You can find my ant script as well as a template for building your own in the PointsOfInterest project in my BukkitPlugins repository. Hopefully it helps!
Feel free to contact me with any questions, comments, or suggestions! I will help in any way I can.
Enjoy!