Banning a user

How would I go about programmatically banning a user from a server? Either GameProfile or InetAddress works. Thanks.

  1. Use Ban.builder() to create a ban. Make sure to call either profile() or address(), depending on your needs.
  2. Call Sponge.getServiceManager().getUnchecked(BanService.class).addBan(ban);.
1 Like