Skip to content

Module Moderation

j-gaertig-co-dev edited this page Aug 13, 2026 · 3 revisions

Moderation Module (Ban, Tempban, Kick & IP-Ban)

Config file: modules/moderation.yml — current version: 2.0view current default on GitHub Enable via config.ymlmodules.moderation: true

This is the only module backed by a real database instead of a YAML file — punishments are persisted in SQLite or MySQL, not plugins/PlainBase/config.yml.

Enabling this module (or ban/kick/ip-ban inside it) only makes the commands available — nobody is punished automatically, a staff member always has to run /ban, /kick etc. themselves first.

This file's structure differs from other modules: every other module config nests everything under one top-level key matching the module name (e.g. vanish:, menu:). moderation.yml does notban:, kick:, ip-ban:, storage:, broadcast:, messages: and commands: are separate top-level sections instead. Intentional, not a bug — just don't expect the same layout as e.g. Vanish or Menu.

Features

  • Custom ban / tempban / unban / kick / IP-ban system. These commands replace vanilla's /ban and /kick and use their own storage instead of the server's vanilla ban list.
  • Everything is keyed by the player's UUID, never by name — a name change can never evade a ban.
  • Cross-server ready: the default backend is a local SQLite file (zero setup, single server only). Point every server in your network at the same MySQL database instead and they all enforce the exact same ban and IP-ban list — a ban issued on one server blocks the login on every other connected server immediately, because every login check queries the database live (never a stale local cache).
  • Full history is kept forever: total ban count, total kick count and the last ban reason remain available via /baninfo even after a ban expires or is manually revoked.
  • Bans can be permanent (/ban) or timed (/tempban, duration format like 1d, 2h30m, 7d).
  • IP bans (/banip / /unbanip) are checked completely independently of name/UUID bans on every login attempt. Accepts either a raw IP address or a player name (resolved to their last-known IP).
  • Works for offline players too — you can pre-emptively ban someone who has never joined; a warning is shown that the target has never played before, and the ban is stored by name until they join and get a UUID recorded.
  • plainbase.moderation.exempt protects a (currently online) player from being banned/kicked by non-admins.
  • All commands also work from the console.
  • Fully configurable ban/kick/IP-ban screens and broadcast messages via MiniMessage.

Commands

Command Description Permission
/ban <player> [reason] Permanently ban a player. plainbase.moderation.ban
/tempban <player> <duration> [reason] Temporarily ban a player. plainbase.moderation.tempban
/unban <player> Revoke an active ban. plainbase.moderation.unban
/kick <player> [reason] Kick an online player. plainbase.moderation.kick
/banip <ip|player> [reason] Ban an IP address (raw, or resolved from a player name). plainbase.moderation.banip
/unbanip <ip> Revoke an active IP ban. plainbase.moderation.unbanip
/banlist [page] List all currently active bans and IP bans. plainbase.moderation.banlist
/baninfo <player> Show ban status, total bans/kicks and the last ban reason. plainbase.moderation.baninfo
(all Moderation commands) Grants every permission of this module. plainbase.moderation.admin
(punishment immunity) Makes an online player immune to /ban//kick by non-admins. Default: not granted to anyone. plainbase.moderation.exempt

Storage backend

storage:
  type: sqlite      # sqlite (default, local file) or mysql (shared across servers)

  sqlite:
    file: moderation.db  # relative to plugins/PlainBase/data/

  mysql:
    host: localhost
    port: 3306
    database: plainbase
    username: root
    password: ""
    table-prefix: "pb_"
    useSSL: false
    pool-size: 5

  # How often the local read cache (used by /banlist, /baninfo, PAPI placeholders)
  # re-syncs from the database. Login enforcement is NOT affected by this — it
  # always queries the database directly, so a ban from another server (MySQL)
  # is enforced immediately regardless of this value.
  refresh-interval-seconds: 30

Connection pooling (HikariCP) is used internally for both SQLite and MySQL.

Broadcasts & messages

broadcast:
  enabled: true
  # false = broadcast to everyone online.
  # true  = only to players with plainbase.moderation.notify
  #         (or plainbase.moderation.admin / plainbase.admin).
  staff-only: false

messages:
  default-reason: "No reason specified."
  ban-screen: |-
    <red><bold>You are banned from this server!</bold>
    <gray>Reason: <yellow>%reason%
    <gray>Banned by: <yellow>%staff%
    <gray>This ban is permanent.
  # ... tempban-screen, ipban-screen, kick-screen, success/broadcast/banlist/baninfo
  # messages are all configurable the same way — see modules/moderation.yml
  # for the full list of message keys.

All message keys (success confirmations, broadcasts, error messages like already-banned/not-banned/invalid-duration, banlist/baninfo formatting) live in modules/moderation.yml under messages: and can be fully re-worded/re-colored.

Per-command toggles

commands:
  ban: { enabled: true }
  tempban: { enabled: true }
  unban: { enabled: true }
  kick: { enabled: true }
  banlist: { enabled: true }
  baninfo: { enabled: true }
  banip: { enabled: true }
  unbanip: { enabled: true }

PlaceholderAPI placeholders

See PlaceholderAPI — this module additionally exposes %plainbase_moderation_bancount%, %plainbase_moderation_kickcount% and %plainbase_moderation_banned%.

Clone this wiki locally