Skip to content

77darkness/33-plots-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

33-Plots API

Public API for the 33-Plots plugin.

Installation

Repository

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

Dependency

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.

Usage

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 object

Reference

PlotsAPI

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages