Developers

Instructions on integrating with BanManager

Dependency

To make use of BanManager's API, simply add the relevant build as a Maven dependency to your project. For access to BmAPI only, please use BanManagerCommon. For anything else, use the server implementation specific build.

<repositories>
  <repository>
    <id>confuser-repo</id>
    <url>https://ci.frostcast.net/plugin/repository/everything</url>
  </repository>
</repositories>

BanManagerCommon

<dependencies>
  <dependency>
    <groupId>me.confuser.banmanager</groupId>
    <artifactId>BanManagerCommon</artifactId>
    <version>7.3.0-SNAPSHOT</version>
    <scope>provided</scope>
  </dependency>
</dependencies>

Bukkit

<dependencies>
  <dependency>
    <groupId>me.confuser.banmanager</groupId>
    <artifactId>BanManagerBukkit</artifactId>
    <version>7.3.0-SNAPSHOT</version>
    <scope>provided</scope>
  </dependency>
</dependencies>

Sponge

<dependencies>
  <dependency>
    <groupId>me.confuser.banmanager</groupId>
    <artifactId>BanManagerSponge</artifactId>
    <version>7.3.0-SNAPSHOT</version>
    <scope>provided</scope>
  </dependency>
</dependencies>
-

API

BmAPI

This is a static API class for BanManager to create and manipulate punishments

Caveats:

No methods are thread safe unless stated otherwise
The API does not check permissions for exemptions

A list of methods is available at the javadocs

Events

This provides a way to listen to punishments triggered which contain data about the event itself such as reason, actor (who caused the event) and the player or ip it affects

A server specific build is required to access these, e.g. BanManagerBukkit

Events which are in the present tense can be cancelled, e.g. PlayerMuteEvent, whereas events in the past tense cannot e.g. PlayerMutedEvent

These events are used internally by BanManager

The following events are supported:

IpBanEvent
IpBannedEvent
IpMuteEvent
IpMutedEvent
IpRangeBanEvent
IpRangeBannedEvent
IpRangeUnbanEvent
IpUnbanEvent
IpUnmutedEvent
NameBanEvent
NameBannedEvent
NameUnbanEvent
PlayerBanEvent
PlayerBannedEvent
PlayerKickedEvent
PlayerMuteEvent
PlayerMutedEvent
PlayerNoteCreatedEvent
PlayerReportDeletedEvent
PlayerReportEvent
PlayerReportedEvent
PlayerUnbanEvent
PlayerUnmuteEvent
PlayerWarnEvent
PlayerWarnedEvent

Examples

Bukkit
public class BanListener implements Listener {

  @EventHandler
  public void notifyOnBan(PlayerBannedEvent event) {
    PlayerBanData ban = event.getBan();

    if (!event.isSilent()) {
      Bukkit.broadcast(ban.getPlayer().getName() + " has been banned!");
    }
  }
}
Sponge
public class BanListener {

  @Listener(order = Order.POST)
  public void notifyOnBan(PlayerBannedEvent event) {
    PlayerBanData ban = event.getBan();

    if (!event.isSilent()) {
      Sponge.getServer().getConsole().sendMessage(Text.of(ban.getPlayer().getName() + " has been banned!"));
    }
  }
}