Usage
While PathFinderAPI is intended to be utilized as an extension of other plugins, it is packaged with a few default commands and permissions.
Commands
Permissions
Development
PathFinderAPI is designed to be easily integrated into any Spigot plugin with minimal effort needed from other developers.
Importing
Gradle
Code (Text):
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.TheCrossboneColonies:PathFinderAPI:v1.0'
}
Maven
Code (Text):
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.TheCrossboneColonies</groupId>
<artifactId>PathFinderAPI</artifactId>
<version>v1.0</version>
</dependency>
</dependencies>
API Methods
All of the necessary classes and methods for utilizing the PathFinderAPI are accessible from
com.tcc.pathfinderapi.api.
The most basic and fundamental way to access PathFinderAPI's path generation is through
com.tcc.pathfinderapi.api.Path. Here's a simple example that communicates to a player the number of blocks they must traverse to travel to a given destination.
Code (Java):
assert player
instanceof org.
bukkit.
entity.
Player
;
assert destination
instanceof org.
bukkit.
Location
;
Path path
=
new Path
(player, player.
getLocation
(
), destination
)
;
path.
generatePath
(
)
;
player.
sendMessage
(path.
fullPath.
size
(
)
)
;
While generating a path is fun and all, the real excitement comes from actually being able to manipulate player and world data based on the outcomes of path generation. This all happens through the
com.tcc.pathfinderapi.api.visualizers.PathVisualizer interface. Here are two examples that are included in PathFinderAPI as default visualizers.
Here are two examples that utilze the above visualizers to generate paths between a player and a given destination.
Block Visualizer:
Code (Java):
assert player
instanceof org.
bukkit.
entity.
Player
;
assert destination instaceof org.
bukkit.
Location
;
Path path
=
new Path
(player, player.
getLocation
(
), destination,
new BlockVisualizer
(
)
)
;
path.
generatePath
(
)
;
Particle Visualizer:
Code (Java):
assert player
instanceof org.
bukkit.
entity.
Player
;
assert destination instaceof org.
bukkit.
Location
;
Path path
=
new Path
(player, player.
getLocation
(
), destination,
new ParticleVisualizer
(
)
)
;
path.
generatePath
(
)
;