Skip to content

OUTDATED VERSION

You are viewing the documentation for an older AutoWhitelist version
Click here to go to the latest version

Installing

TIP

Basic JSON or JSON5 knowledge is highly recommended.

Installing the mod

Make sure you download the correct version for your server's Minecraft version.

  1. Download the mod from Modrinth
  2. Download the required dependencies FabricAPI and Fabric Language Kotlin
  3. Put the downloaded files in your mods folder
  4. Start the server, this will generate the config file at config/autowhitelist.json5

Setting up the Discord bot

The mod requires a Discord bot, you can create a new one or choose an existing one in the Discord developer portal
Make sure it has the Server members intent enabled

Configuring the mod

Bot token

Copy the bot token from the developer console and add it to the mod config

json5
  "lock_time": "1d",
  // Your bot token. Never share it, anyone with it has full control of the bot
  "token": "NEVER SHARE YOUR BOT TOKEN",
  "discord_server_id": 0,
  // When enabled, all interactions and slash commands will be ephemeral, meaning only the user can see the response.
  "ephemeral_replies": true,

Server ID

Copy the Discord server/guild id of the server where you added the bot to

json5
  "lock_time": "1d",
  // Your bot token. Never share it, anyone with it has full control of the bot
  "token": "NEVER SHARE YOUR BOT TOKEN",
  "discord_server_id": 0,
  // When enabled, all interactions and slash commands will be ephemeral, meaning only the user can see the response.
  "ephemeral_replies": true,

Adding the bot to your server

Create the url to add the bot to a server and use it to add it to the server you plan to use it on

Configuring the entries

On the config file, entries will be empty by default, there you will configure what the server will do when whitelisting the players.

All of them takes a list of roles that will be used to whitelist the players, and a type that will be used to determine what the server will do when whitelisting the players.

roles takes either the role ID or the role name, prefixed by an @, you can use both ways on the same entry

Any extra keys (if any) go inside the execute object

The format is

json5
{
  // The Discord roles that will be used to whitelist the players
  "roles": ["Discord role id", "@Or the role name"],
  // The method that will be used to whitelist the players
  "type": "namespace:path",
  // Any extra option goes in here, it defines what will be done when the entry runs, for adding/removing to the whitelist
  "execute": {}
}

When a player is moved between entries, for example, due to a role change, the mod will execute the code for removal of the old entry and right after it executes the code for adding into the new entry

For more details on entries view the entries documentation page

Example

Let's take this example config:

json5
{
  "roles": ["@Role 1"],
  "type": "autowhitelist:execute_command",
  "execute": {
    "on_add": "say {player} joined the cool team",
    "on_remove": "say {player} is no longer cool"
  }
},
{
  "roles": ["@Role 2"],
  "type": "autowhitelist:execute_command",
  "execute": {
    "on_add": "say {player} is now awesome",
    "on_remove": "say {player} left the awesome team"
  }
}

Once I register while having @Role 1 the server will announce:

log
[23:31:22] [AutoWhitelist] AwakenedRedstone joined the cool team

Now, I got a new role, @Role 2
The server will follow with:

log
[23:33:53] [AutoWhitelist] AwakenedRedstone is no longer cool
[23:33:53] [AutoWhitelist] AwakenedRedstone is now awesome