Public API for the 33-Plots plugin.
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Gradle
repositories {
maven { url 'https://jitpack.io' }
}Maven
<dependency>
<groupId>com.github.77darkness</groupId>
<artifactId>plots-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>Gradle
dependencies {
compileOnly("com.github.77darkness:plots-api:1.0")
}Keep it provided/compileOnly - the classes are supplied at runtime by the 33-Plots
plugin itself. Add depend: [33-Plots] to your own plugin.yml.
Query a plot
PlotsAPI api = PlotsProvider.get();
Plot plot = api.getPlotAt(player.getLocation());
if (plot != null && plot.isOwner(player.getUniqueId())) {
// ...
}Block entering a plot (e.g. combat-tagged players)
@EventHandler
public void onEnter(PlayerEnterPlotEvent e) {
if (combatLogApi.isInCombat(e.getPlayer())) {
e.setCancelled(true);
}
}Mutate a plot
plot.setFlag("PVP", true);
api.savePlot(plot); // required - mutators only change the in-memory objectPlotsAPI
| Method | Description |
|---|---|
getPlotAt(Location) |
Plot at a location, or null |
getPlotByName(String) |
Plot by name |
getPlayerPlots(UUID) |
Plots owned by a player |
getPlayerMemberPlots(UUID) |
Plots a player has access to (owner + member) |
isPlotAt(Location) |
Existence check |
getPlotLimit(Player) |
Player's plot limit based on their permissions |
savePlot(Plot) |
Persists changes made via Plot mutators |
Plot - read: getName(), getOwner(), getMembers(), getBlockedPlayers(),
getFlag(String), isOwner/isMember/isBlocked(UUID), isInRegion(Location),
hasExpired(). Mutate: setFlag(String, boolean), addMember(UUID), removeMember(UUID),
blockPlayer(UUID), unblockPlayer(UUID) - always follow up with PlotsAPI#savePlot(plot).
Events (dev.darkness.plots.api.event):
PlayerEnterPlotEvent- fired before a player enters a plot.PlayerLeavePlotEvent- fired when a player leaves a plot.