The BanService is a service built into SpongeAPI that adds the functionality for you to ban or pardon users in your plugin. The BanService provides several methods to do things such as banning users, pardoning users, or even getting a Ban and the information on the Ban.
For a basic understanding of services, make sure you read サービス first.
Note that if you wish to create a simple, indefinite ban on a User, you can use the Ban#of(GameProfile) method or the Ban#of(GameProfile, Text) method to quickly construct a ban.
Now that we have created our ban, we can now register it to be used in Sponge. Using our BanService from before, we can use the BanService#addBan(Ban) method to accomplish this. Note that adding a ban will remove any previously existing ban.
Now let’s say we wanted to remove a ban from a user. We can use the BanService#pardon(GameProfile) method. This method returns a boolean, which specifies if the user had a ban in place previously.