Developer API

Hooking Into the API

Obtaining the instance of the API is pretty simple by using the singleton that provides static access to the class. You can obtain the instance of the API through the main Guilds class.

GuildsAPI api = Guilds.getApi();

Using the API

The API can be used for obtaining a bunch of information from the plugin. You can browse over the following section to see what all is provided.

Getting a Guild object

We provide a few ways to obtain a Guild object, so feel free to use what is easiest for you.

Using OfflinePlayer

    /**
     * Get the guild of a player
     * @param player the players you're getting the guild of
     * @return the guild that the player is in
     */
    public Guild getGuild(@NotNull OfflinePlayer player) {
        return guildHandler.getGuild(player);
    }

Using Guild UUID

Using Player name

Getting a Guild Vault

Getting a GuildRole

Getting the GuildHandler

The GuildHandler will give you access to anything you might need in the plugin. Please use caution with this method as the content it lets you access to can break the plugin if you use it incorrectly.

Custom Events

In the plugin we offer a bunch of custom events that you can listen to and modify as you see fit.

Base GuildEvent

GuildAddAllyEvent

GuildCreateEvent

GuildDepositMoneyEvent

GuildInviteEvent

GuildJoinEvent

GuildLeaveEvent

GuildPrefixEvent

GuildRemoveAllyEvent

GuildRemoveEvent

GuildRenameEvent

GuildTransferEvent

GuildWithdrawMoneyEvent

Last updated

Was this helpful?