-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
269 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
--- | ||
title: DoorsModule | ||
--- | ||
--- | ||
`DoorsModule` reimplements the vanilla behavior for interacting with doors. Interacting with an open door will cause it to close for everyone on the server, and interacting with a closed door will cause it to open for everyone on the server. All types of wooden doors are supported. Iron doors do not open or close upon interaction. Trapdoors are not currently implemented, but they may be in the future. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.vanilla.DoorsModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(DoorsModule()) | ||
``` | ||
|
||
## Attribution | ||
- The code for this module was adopted from [BasicRedstone](https://github.com/TogAr2/BasicRedstone/blob/master/src/main/java/io/github/bloepiloepi/basicredstone/door/Doors.java) by TogAr2, which is under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
--- | ||
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/) | ||
|
||
## Public Methods | ||
### `getRequiredInstances` | ||
```kotlin | ||
open fun getRequiredInstances(): Iterable<Instance> | ||
``` | ||
Returns a set of instances that are required, but not owned, by this module. This is necessary because shared instances must have a registered instance container for chunk loading, but the instance container can be used by multiple games at the same time (and therefore not "owned" by any game). Returns an empty set if not overridden. | ||
|
||
### `getSpawningInstance` | ||
```kotlin | ||
abstract fun getSpawningInstance(player: Player): Instance | ||
``` | ||
Returns the instance that a player should spawn in when initially joining the game. | ||
|
||
### `ownsInstance` | ||
```kotlin | ||
abstract fun ownsInstance(instance: Instance): Boolean | ||
``` | ||
Returns `true` if this module "owns" the instance. Modules should own an instance if they created it, and ownership should be released when the instance is no longer needed. Instances with no modules that declare ownership of them may be cleaned up at any time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
--- | ||
title: ItemDropModule | ||
--- | ||
--- | ||
By default, Minestom allows players to use the drop action to remove items from their inventory, but these items do not appear on the ground. Additionally, players can break blocks, but they do not get the blocks back. `ItemDropModule` reimplements a few vanilla behaviors: | ||
- When a player drops an item, an item entity will spawn in front of them | ||
- When a player breaks a block, an item entity will spawn where the block was (optional, specified by `dropBlocksOnBreak` parameter) | ||
- When a player dies, an item entity will spawn on the ground for each of their items (optional, specified by `dropAllOnDeath` parameter) | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.vanilla.ItemDropModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(ItemDropModule(dropBlocksOnBreak = true, dropAllOnDeath = true)) | ||
``` | ||
|
||
If `dropBlocksOnBreak` is true, an item entity will spawn whenever a player breaks a block. If `dropAllOnDeath` is true, a player's entire inventory will be dropped when they die. | ||
|
||
## See Also | ||
- If you're looking to prevent players from removing items from their inventory, use [InventoryPermissionsModule](../inventorypermissionsmodule) | ||
- If you're looking to allow players to pick up items from the ground, use [ItemPickupModule](../itempickupmodule) |
16 changes: 15 additions & 1 deletion
16
src/content/docs/reference/Game Modules/ItemPickupModule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
--- | ||
title: ItemPickupModule | ||
--- | ||
--- | ||
`ItemPickupModule` adds items to players' inventories when the pick up items from the ground. It listens for `PickupItemEvent`, which is automatically called by Minestom when a player walks over an item. The module cancels the event if the player is in spectator mode. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.vanilla.ItemPickupModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(ItemPickupModule()) | ||
``` | ||
|
||
## See Also | ||
- If you're looking to allow players to drop items onto the ground, see [ItemDropModule](../itemdropmodule/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
--- | ||
title: MOTDModule | ||
--- | ||
--- | ||
`MOTDModule` sends a message to players when they join the game. This message includes the name of the game, a brief overview of how to play, and some information about the current map. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.minigame.MOTDModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(MOTDModule(motd = Component.text("Test MOTD!"), showMapName = true)) | ||
``` | ||
This will display the following to players who join the game: | ||
``` | ||
================================= | ||
Game Name | ||
Test MOTD! | ||
Map: Map Name by Author | ||
================================= | ||
``` | ||
Hovering over the map name will show a description of the map. | ||
|
||
Note: [ConfigModule](../configmodule/) is required to show map data. The nodes `world.name`, `world.author`, and `world.description` should be set. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
--- | ||
title: MaxHealthModule | ||
--- | ||
--- | ||
`MaxHealthModule` sets the max health attribute of all players when they join the game, and resets it when they leave. BlueDragon uses this module to limit the health available in FastFall. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.gameplay.MaxHealthModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
// sets the max health of all players to 2.0, which is equal to 1 heart | ||
use(MaxHealthModule(maxHealth = 2f)) | ||
``` |
15 changes: 14 additions & 1 deletion
15
src/content/docs/reference/Game Modules/NaturalRegenerationModule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
--- | ||
title: NaturalRegenerationModule | ||
--- | ||
--- | ||
`NaturalRegenerationModule` restores a player's health by 0.5 (1 heart) every second when they have not been in combat for at least 15 seconds. A player's combat status is determined by the time elapsed since an `OldCombatModule.PlayerAttackEvent` was called with the player as the `attacker` or the `target`. [OldCombatModule](../oldcombatmodule/) is not required for this module to work, but it is currently the only official module that calls `PlayerAttackEvent`. | ||
|
||
**Unlike in vanilla, this module does not use hunger to determine regeneration, only combat status.** | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.vanilla.NaturalRegenerationModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(NaturalRegenerationModule()) | ||
``` |
66 changes: 65 additions & 1 deletion
66
src/content/docs/reference/Game Modules/SpawnpointModule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,67 @@ | ||
--- | ||
title: SpawnpointModule | ||
--- | ||
--- | ||
`SpawnpointModule` controls where players are teleported when they first join the game or die and respawn. It uses the `SpawnpointProvider` interface to allow games to define their own behavior for setting the spawnpoints of players. | ||
|
||
## SpawnpointProvider | ||
`SpawnpointProvider` is an interface that allows the module to determine where players should spawn. | ||
### Public Methods | ||
#### `initialize` | ||
```kotlin | ||
fun initialize(game: Game) | ||
``` | ||
Called when the spawnpoint module is loaded by the given `game`. | ||
|
||
#### `getSpawnpoint` | ||
```kotlin | ||
fun getSpawnpoint(player: Player): Pos | ||
``` | ||
Returns the given player's spawnpoint. This function is typically called right before a player is going to spawn, and the return value is not cached by `SpawnpointModule` between spawns. | ||
|
||
#### `getAllSpawnpoints` | ||
```kotlin | ||
fun getAllSpawnpoints(): List<Pos> | ||
``` | ||
Returns a list of every place a player could spawn. | ||
|
||
### Implementations | ||
These implementations are supplied by BlueDragon, but you can always create your own if necessary. | ||
#### `TestSpawnpointProvider` | ||
```kotlin | ||
class TestSpawnpointProvider(private vararg val spawns: Pos) : SpawnpointProvider | ||
``` | ||
Spawns players sequentially at the positions provided in the constructor. | ||
|
||
#### `SingleSpawnpointProvider` | ||
```kotlin | ||
class SingleSpawnpointProvider(private val spawn: Pos) : SpawnpointProvider | ||
``` | ||
Spawns all players at a single location. | ||
|
||
#### `ConfigSpawnpointProvider` | ||
```kotlin | ||
class ConfigSpawnpointProvider(private val allowRandomOrder: Boolean = true) : SpawnpointProvider | ||
``` | ||
Gets spawnpoints from the `world.spawnpoints` configuration node. If `allowRandomOrder` is `false`, players will be spawned in the order of the spawnpoints in the config file. Otherwise, players will be spawned in a random order, but no spawnpoint will be used twice until all locations have been used. [ConfigModule](../configmodule/) is required to use this provider. | ||
|
||
#### `TeamConfigSpawnpointProvider` | ||
```kotlin | ||
class TeamConfigSpawnpointProvider(private val allowRandomOrder: Boolean = false) : SpawnpointProvider | ||
``` | ||
Gets spawnpoints from the `world.spawnpoints` configuration node. One spawnpoint is assigned to each team. All players on a given team will spawn in the same location. If a player's spawnpoint is required, and they are not on a team yet, they will be spawned at the first spawnpoint in the database. If they are on a team, they will be given their team's spawnpoint. If `allowRandomOrder` is `false`, team spawnpoints will be assigned in the order of the spawnpoints in the config file. Otherwise, teams will be spawned in a random order, but no spawnpoint will be used twice until all locations have been used. [ConfigModule](../configmodule) and [TeamModule](../teammodule) are required to use this provider. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.minigame.SpawnpointModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
val mySpawnpointProvider = SpawnpointModule.TestSpawnpointProvider(Pos(0.0, 64.0, 0.0)) | ||
use(SpawnpointModule(spawnpointProvider = mySpawnpointProvider)) | ||
``` | ||
|
||
If you need to get the spawnpoint for a specific player, use the spawnpoint provider: | ||
```kotlin | ||
getModule<SpawnpointModule>().spawnpointProvider.getSpawnpoint(player) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
--- | ||
title: VoidDeathModule | ||
--- | ||
--- | ||
`VoidDeathModule` automatically kills players when they go below a certain y-coordinate. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.minigame.VoidDeathModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(VoidDeathModule(threshold = 32.0, respawnMode = false)) | ||
``` | ||
|
||
The `threshold` parameter controls the minimum height required to activate the module. When the y-component of any player's position goes below this value, the player will be killed or respawned. | ||
|
||
When the `respawnMode` parameter is set to true, the module will not actually kill the player. Instead, it will teleport the player to their spawnpoint, call `player.respawn()`, and call a `PlayerDeathEvent` for the player. Set this to `false` if you are also using a module that instantly respawns the player, such as [PlayerRespawnModule](../playerrespawnmodule). Set this to `true` if you want to teleport them back to spawn without displaying the respawn screen or using other modules to hide this screen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,26 @@ | ||
--- | ||
title: WeatherModule | ||
--- | ||
--- | ||
`WeatherModule` reimplements the vanilla behavior of per-instance weather. It **does not** implement automatically changing weather, but the weather can be manually set for each instance. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.vanilla.WeatherModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(WeatherModule(globalRaining = false)) | ||
``` | ||
|
||
Now, you can use `setRaining` to set the weather for a specific instance: | ||
```kotlin | ||
getModule<WeatherModule>().setRaining(instance, true) | ||
``` | ||
|
||
Alternatively, you can change the value of `globalRaining`: | ||
```kotlin | ||
getModule<WeatherModule>().setRaining(true) // sets globalRaining to true | ||
``` | ||
|
||
If `globalRaining` is `true`, it will always be raining for all players in your game, regardless of which instance they are in. If `globalRaining` is `false`, the current weather is determined based on the instance the player is in. |
38 changes: 37 additions & 1 deletion
38
src/content/docs/reference/Game Modules/WorldPermissionsModule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
--- | ||
title: WorldPermissionsModule | ||
--- | ||
--- | ||
`WorldPermissionsModule` can prevent the player from placing, breaking, or interacting with blocks in the world. | ||
|
||
## Block Breaking | ||
Two module parameters have an effect on players' abilities to break blocks. | ||
- If `allowBlockBreak` is `false`, players will not be able to break any blocks (`PlayerBlockBreakEvent` will be cancelled). | ||
- If `allowBreakMap` is `false`, players will not be able to break blocks that are included with the map (`PlayerBlockBreakEvent` will be cancelled). Any player-placed blocks will still be breakable as long as `allowBlockBreak` is not `false`. | ||
|
||
## Block Placing | ||
Two module parameters have an effect on players' abilities to place blocks. | ||
- If `allowBlockPlace` is `false`, players will not be able to place any blocks (`PlayerBlockPlaceEvent` will be cancelled). | ||
- If `allowBlockInteract` is `false`, players will not be able to place any blocks (`PlayerBlockInteractEvent` will be cancelled). | ||
|
||
## Block Interacting | ||
- If `allowBlockInteract` is `false`, players will not be able to interact with any blocks (`PlayerBlockInteractEvent` will be cancelled). | ||
|
||
## Block Exceptions | ||
The module has an `exceptions` parameter, which is a list of blocks that will be completely ignored by the module. This means the module will not prevent players from placing, breaking, or interacting with any block on the exceptions list. BlueDragon uses this feature to allow beds to be broken in BedWars, even though the rest of the map cannot be removed. | ||
|
||
## Usage | ||
Import the module: | ||
```kotlin | ||
import com.bluedragonmc.server.module.gameplay.gameplay.WorldPermissionsModule | ||
``` | ||
Use the module in your game's `initialize` function: | ||
```kotlin | ||
use(WorldPermissionsModule( | ||
allowBlockBreak = false, | ||
allowBlockPlace = false, | ||
allowBlockInteract = false, | ||
allowBreakMap = false, | ||
exceptions = listOf(Block.OAK_PLANKS) | ||
)) | ||
``` | ||
In this example, no blocks can be placed or broken, except oak planks. | ||
## See Also | ||
- If you're looking to restrict players' inventory management abilities, use [InventoryPermissionsModule](../inventorypermissionsmodule) |