Skip to content
Hannes Greule edited this page May 17, 2021 · 7 revisions

LandLord Developer API

Maven

<repository>
  <id>gitlab-maven</id>
  <url>https://gitlab.com/api/v4/projects/6801239/packages/maven</url>
</repository>

<dependency>
  <groupId>biz.princeps</groupId>
  <artifactId>LandLord-api</artifactId>
  <version>4.0.6</version>
  <scope>provided</scope>
</dependency>

Notes: How's landlord working internally?

LandLord itself doesnt store any lands. Weird, isnt it? All lands are stored via worldguard. That basically means, LandLord is just a fancy wrapper around worldguard with a shitton of extra functions.
Why did I decided to this way? Because I don't like to reinvent the wheel, but rather focus on features and stability.
Although LandLord is not storing any lands, its still storing something. There are two storage providers: FlatFile or SQL. FlatFile-sample:

0d6c305c-da31-4664-b9f3-bba7389f29ae:
  claims: 0
  home: ''
  lastlogin: 2019-06-08 14:18 

Database-scheme:

ll_players (uuid VARCHAR(36) NOT NULL, name VARCHAR(16), claims INTEGER, home TEXT, lastseen VARCHAR(50), PRIMARY KEY(uuid))

In case you wanna sync the playerdata across multiple servers, feel free to use mysql.

Hook into landlord

Into your plugin.yml:

depend: [Landlord]

In your Main class:

private ILandLord api;

@Override
public void enable(){
    try {
            this.api = (ILandLord) getServer().getPluginManager().getPlugin("Landlord");
        } catch (NoClassDefFoundError ex) {
            getLogger().warning("Landlord missing!");
            this.getPluginLoader().disablePlugin(this);
            return;
        }
}

The ILandLord interface

This methods are provided directly in 'this.api'.

public interface ILandLord {

    /**
     * Adapter to JavaPlugin#getConfig
     *
     * @return the config file
     */
    FileConfiguration getConfig();

    /**
     * Adapter to JavaPlugin#getConfig
     *
     * @return the config file
     */
    Logger getLogger();

    /**
     * Returns the instance of the JavaPlugin.
     * Useful for starting runnables.
     *
     * @return instance of JavaPlugin
     */
    JavaPlugin getPlugin();


    /**
     * Gets the reference to the WorldGuardManager.
     * This class is responsible to handle all interactions with worldguard.
     *
     * @return the worldguard manager
     */
    IWorldGuardManager getWGManager();

    /**
     * Gets the reference to the MaterialManager.
     * This class is responsible to handle Materials and Itemstacks, that change from version to version.
     *
     * @return the mat manager
     */
    IMaterialsManager getMaterialsManager();

    /**
     * Gets the reference to the UtilsManager
     * This class is responsible to handle interactions with spigot, that change from version to version.
     *
     * @return the utils manager
     */
    IUtilsManager getUtilsManager();

    /**
     * Gets the reference to the PlayerManager.
     * This class is responsible to handle interactions with LPlayers.
     *
     * @return the player manager
     */
    IPlayerManager getPlayerManager();

    /**
     * Gets the reference to the CostManager.
     * This class calculates costs for the next claim.
     *
     * @return the cost manager
     */
    ICostManager getCostManager();

    /**
     * Gets the reference to the MapManager.
     * This class handles interactions with the land map system.
     *
     * @return the map manager
     */
    IMapManager getMapManager();

    /**
     * Gets the reference to the language manager.
     * This class is responsible to handle translations.
     *
     * @return the language manager
     */
    ILangManager getLangManager();

    /**
     * Gets the reference to the vault manager.
     * This class is responsible for interactions with money.
     *
     * @return the vault manager
     */
    IVaultManager getVaultManager();

    /**
     * Gets the reference to the delimitation manager.
     * This class is responsible for the delimitation of lands.
     *
     * @return the delimitation manager
     */
    IDelimitationManager getDelimitationManager();

    /**
     * Sets up PrincepsLib. Also sets specific translated messages for princepslib
     */
    void setupPrincepsLib();

    /**
     * Get the reference to the MobManager.
     * This class is responsible to interact with spigot mobs that change from version to version.
     *
     * @return the mob manager
     */
    IMobManager getMobManager();
}

public class Options {
    // Provides some fancy static methods, so you don't have to query the landlord config. 
}

Events

  • LandPreClaimEvent - called when a land is about to happen. May be cancelled
  • LandPostClaimEvent - called when a land was successful
  • LandUnclaimEvent - called when a land was unclaimed
  • PlayerBrokeSecureWorldEvent - called when a player tried to break something, but was stopped by SecureWorld. Cancelling will allow the break process.
  • LandManageEvent - called when a land is managed and an option was changed

Other

all of the other Interfaces (starting with a big I) can be found here.

Clone this wiki locally