Skip to content

Commit

Permalink
Add documentation for InstanceModule implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
ex4dev committed Mar 10, 2024
1 parent ce8813f commit fc0eb57
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/content/docs/modules/AwardsModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use(AwardsModule())
### Custom Awards
Now, you can use the `awardCoins` method to give coins and XP to the player. This will also send them a message letting them know that they earned coins, and a level up screen if the new XP got them to the next level.
```kotlin
getModule<AwardsModule>().awardCoins(player, amount, reason);
getModule<AwardsModule>().awardCoins(player, amount, reason)
```

### Award for Winning
Expand Down
19 changes: 18 additions & 1 deletion src/content/docs/modules/CustomGeneratorInstanceModule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
---
title: CustomGeneratorInstanceModule
---
---

`CustomGeneratorInstanceModule` is an implementation of [`InstanceModule`](../instancemodule/) that creates a single instance for each game that automatically generates chunks using a custom [world generator](https://wiki.minestom.net/world/generation).

## Usage
Import the module:
```kotlin
import com.bluedragonmc.server.module.instance.CustomGeneratorInstanceModule
```
Use the module in your game's `initialize` function:
```kotlin
// See Minestom documentation to learn more about world generators
val myGenerator = ...
use(CustomGeneratorInstanceModule(dimensionType = DimensionType.OVERWORLD, generator = myGenerator))
```

## Fullbright Dimension
BlueDragon provides a custom dimension type with global maximum lighting. You can obtain a reference to this dimension type with `CustomGeneratorInstanceModule.getFullbrightDimension()`.
20 changes: 19 additions & 1 deletion src/content/docs/modules/InstanceContainerModule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
---
title: InstanceContainerModule
---
---

`InstanceContainerModule` is an implementation of [`InstanceModule`](../instancemodule/) that creates a single [`InstanceContainer`](https://wiki.minestom.net/world/instances#instancecontainer) for each game using a map loaded from an Anvil world.

## Dependencies
This module depends on the following modules:
- [AnvilFileMapProviderModule](../anvilfilemapprovidermodule)

## Usage
Import the module:
```kotlin
import com.bluedragonmc.server.module.instance.InstanceContainerModule
import com.bluedragonmc.server.module.map.AnvilFileMapProviderModule // dependency
```
Use the module in your game's `initialize` function:
```kotlin
use(AnvilFileMapProviderModule("games/$name/$mapName")) // This is how you specify the path to the world folder
use(InstanceContainerModule())
```
6 changes: 3 additions & 3 deletions src/content/docs/modules/InstanceModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ title: InstanceModule
`InstanceModule` is an abstract module that supplies [instances](/intro/games-servers-instances/#instances) to the game. It cannot be used by itself, but BlueDragon includes several implementations.

## Implementations
- [SharedInstanceModule](../sharedinstancemodule/)
- [InstanceContainerModule](../instancecontainermodule/)
- [CustomGeneratorInstanceModule](../customgeneratorinstancemodule/)
- [SharedInstanceModule](../sharedinstancemodule/): Ideal for games that use Anvil world files and do not allow changes to the map during gameplay.
- [InstanceContainerModule](../instancecontainermodule/): Ideal for games that use Anvil world files and allow changes to the map during gameplay.
- [CustomGeneratorInstanceModule](../customgeneratorinstancemodule/): Ideal for games that with custom, dynamic world generation.

## Public Methods
### `getRequiredInstances`
Expand Down
24 changes: 23 additions & 1 deletion src/content/docs/modules/SharedInstanceModule.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
---
title: SharedInstanceModule
---
---

`SharedInstanceModule` is an implementation of [`InstanceModule`](../instancemodule/) that creates a single [`SharedInstance`](https://wiki.minestom.net/world/instances#sharedinstance) for each game using a map loaded from an Anvil world. All instances on the same map of a game with this module will share the same block data, resulting in reduced memory usage compared to other instance modules.

:::caution
Changes to the map made in SharedInstances will also apply to all other SharedInstances using the same map. If the map can be modified in any way during gameplay, use [InstanceContainerModule](../instancecontainermodule) instead.
:::

## Dependencies
This module depends on the following modules:
- [AnvilFileMapProviderModule](../anvilfilemapprovidermodule)

## Usage
Import the module:
```kotlin
import com.bluedragonmc.server.module.instance.SharedInstanceModule
import com.bluedragonmc.server.module.map.AnvilFileMapProviderModule // dependency
```
Use the module in your game's `initialize` function:
```kotlin
use(AnvilFileMapProviderModule("games/$name/$mapName")) // This is how you specify the path to the world folder
use(SharedInstanceModule())
```
38 changes: 37 additions & 1 deletion src/content/docs/reference/commands.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
title: Server Commands
---

Just like in vanilla Minecraft, the [BlueDragonMC/Server](https://github.com/BlueDragonMC/Server) Minestom instance relies on commands for important interactions. Each command has its own permission, and **no permissions are granted by default**. This document references a few different permission levels, but these are for illustrative purposes only, and do not represent specific requirements.

## Selectors

Just like on vanilla servers, BlueDragon supports the use of the following selectors in place of player names:

- `@p`: Selects the nearest player to the command execution. Because the server does not support command blocks, this is effectively the same as `@s`.
- `@s`: Selects the player who executed the command.
- `@e`: Selects all entities on the server. This only works for commands that support entities (most do not).
Expand All @@ -13,9 +16,14 @@ Just like on vanilla servers, BlueDragon supports the use of the following selec

## Command List

> ℹ️ This list includes every command included in BlueDragon's Minestom server. Commands from the proxy server are not listed.
:::note

This list includes every command included in BlueDragon's Minestom server. Commands from the proxy server are not listed.

:::

### `/ban`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -29,6 +37,7 @@ Even after the ban is lifted, it will still remain in the database as part of th
The duration is formatted using several time units. For example, `8d6h30m` is equal to a duration of "8 days, 6 hours, and 30 minutes." Years, days, hours, minutes, and seconds are supported.

### `/fly`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -38,9 +47,11 @@ Usage: /fly [player]
Toggles fly mode for the specified player, or yourself.

### `/game`

> ⚠️ Recommended permission level: **Administrator**
This command has the following subcommands:

- `/game create <gameType> <mapName> <mode>`: Tells the [queue](../queue/) to create an instance of the specified game.
- `/game end`: Calls `WinnerDeclaredEvent` with no winner, and ends the game.
- `/game join <id>`: Sends you to a game based on its Game ID.
Expand All @@ -49,6 +60,7 @@ This command has the following subcommands:
- `/game module unload <module>`: Removes the module from your current game. Modules are given by class name.

### `/gamemode`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -58,13 +70,15 @@ Usage: /gamemode <survival|creative|adventure|spectator> [player]
Changes the game mode of the specified player, or yourself.

This command has the following aliases:

- `/gm`: Same as `/gamemode`
- `/gmc [player]`: Same as `/gamemode creative [player]`
- `/gms [player]`: Same as `/gamemode survival [player]`
- `/gma [player]`: Same as `/gamemode adventure [player]`
- `/gmsp [player]`: Same as `/gamemode spectator [player]`

### `/give`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -74,14 +88,17 @@ Usage: /give [player] <item> [amount]
Gives the `player` the `item` with a quantity of `amount`. `player` defaults to yourself and `amount` defaults to `1`.

### `/instance`

> ⚠️ Recommended permission level: **Administrator**
This command has the following subcommands:

- `/instance list`: Lists all instances on the current server.
- `/instance join <uuid>`: Sends you to the instance with the given UUID.
- `/instance remove <uuid>`: Removes the instance with the given UUID.

### `/join`

> ℹ️ Recommended permission level: **Everyone**
```
Expand All @@ -91,6 +108,7 @@ Usage: /join <gameType> [mode] [mapName]
Tells the [Queue](../queue/) to place you in a game with the given parameters.

### `/kick`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -101,6 +119,7 @@ Instantly removes the specified player from the server, displaying a message tha
The kick is also recorded in the database and included with the player's punishment history.

### `/kill`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -110,6 +129,7 @@ Usage: /kill [player]
Immediately kills the specified player, or yourself.

### `/leaderboard`

> ℹ️ Recommended permission level: **Everyone**
```
Expand All @@ -119,6 +139,7 @@ Usage: /leaderboard <statistic>
Displays the top 10 entries in the leaderboard. Leaderboards are given by `statistic key`.

### `/list`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -128,11 +149,13 @@ Usage: /list
Lists all instances by UUID and the players on those instances.

### `/lobby`

> ℹ️ Recommended permission level: **Everyone**
Tells the [queue](../queue/) to send you to a [lobby](../lobby/).

### `/msg`

> ℹ️ Recommended permission level: **Everyone**
```
Expand All @@ -142,6 +165,7 @@ Usage: /msg <player> <message>
Sends a private message to another player. If the players are on the same server, the message is sent locally. Otherwise, the message is sent through Puffin.

### `/mute`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -155,6 +179,7 @@ Even after the mute is lifted, it will still remain in the database as part of t
The duration is formatted using several time units. For example, `8d6h30m` is equal to a duration of "8 days, 6 hours, and 30 minutes." Years, days, hours, minutes, and seconds are supported.

### `/pardon`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -166,11 +191,13 @@ The punishment will not be removed from the player's punishment history.
It is recommended to specify the punishment by ID, rather than by player, in case the player has several punishments active.

### `/party`

> ℹ️ Recommended permission level: **Everyone**
The *party system* allows players to easily join the same game with their friends. Parties are managed by Puffin, so they work across servers. The `/party` command is used to manage the player's party.

This command has the following subcommands:

- `/p accept <player>`: Accepts a party invitation from `player`.
- `/p chat <message>`: Sends a message to everyone in the party.
- `/p invite <player>`: Invites a player to the party.
Expand All @@ -180,6 +207,7 @@ This command has the following subcommands:
- `/p warp`: Sends everyone in the party to your instance. Only the party leader can use this command.

### `/ping`

> ℹ️ Recommended permission level: **Everyone**
```
Expand All @@ -189,6 +217,7 @@ Usage: /ping
Displays your current ping to the server.

### `/playsound`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -198,6 +227,7 @@ Usage: /playsound <sound> <source> <player> [position] [volume] [pitch]
Plays a specific sound to the given player, almost identical to the vanilla `/playsound` command.

### `/setblock`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -207,6 +237,7 @@ Usage: /setblock <position> <block>
Changes the block at `position` to `block`.

### `/stop`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -216,6 +247,7 @@ Usage: /stop
Immediately shuts down the Minestom server you are currently on. In most cases, players will be moved to another available server.

### `/tp`

> ⚠️ Recommended permission level: **Administrator**
```
Expand All @@ -227,6 +259,7 @@ If there is one argument, the player that ran the command is teleported to the p
In any other case, the syntax is invalid.

### `/viewpunishment`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -236,9 +269,11 @@ Usage: /viewpunishment <id>
Displays detailed information about the punishment with the specified punishment ID.

This command has the following aliases:

- `/vp <id>`: Same as `/viewpunishment <id>`

### `/viewpunishments`

> ⚠️ Recommended permission level: **Moderator**
```
Expand All @@ -249,4 +284,5 @@ Displays a list of all punishments associated with the player, even if they are
To see more detailed information about a punishment, use `/viewpunishment <id>`.

This command has the following aliases:

- `/vps <id>`: Same as `/viewpunishments <id>`

0 comments on commit fc0eb57

Please sign in to comment.