Skip to content

Commit

Permalink
feat(minecraft): document proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Jan 24, 2024
1 parent 9ca084e commit c04a512
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 3 deletions.
66 changes: 66 additions & 0 deletions docs/minecraft/bungee.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# cloud-bungee

`cloud-bungee` allows you to write commands for [BungeeCord](https://github.com/SpigotMC/BungeeCord).

## Links

<div class="grid cards" markdown>

- [:fontawesome-brands-github: Source Code](https://github.com/Incendo/cloud-minecraft/tree/master/cloud-bungee)
- [:fontawesome-brands-github: Example Plugin](https://github.com/Incendo/cloud-minecraft/tree/master/examples/example-bungee)

</div>

## Installation

Cloud for BungeeCord is available through [Maven Central](https://central.sonatype.com/artifact/cloud.commandframework/cloud-bungee).

<!-- prettier-ignore -->
=== "Maven"

```xml
<dependencies>
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-bungee</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
```

=== "Gradle (Kotlin)"

```kotlin
implementation("cloud.commandframework:cloud-bungee:2.0.0-SNAPSHOT")
```

=== "Gradle (Groovy)"

```groovy
implementation 'cloud.commandframework:cloud-bungee:2.0.0-SNAPSHOT'
```

## Usage

`cloud-bungee` has a command manager implementation called `BungeeCommandManager` that can be created like:

```{ .java .annotate }
BungeeCommandManager<YourSenderType> commandManager = new BungeeCommandManager<>(
plugin,
executionCoordinator, /* (1) */
senderMapper /* (2) */
);
```

1. Information about execution coordinators in general can be found
[here](../core/index.md#execution-coordinators).
2. The sender mapper is a two-way mapping between BungeeCord's
[`CommandSender`](https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/net/md_5/bungee/api/CommandSender.html) and your custom sender type.
You may use `SenderMapper.identity()` if using `CommandSender` as the sender type.

## Parsers

| Parser | Type |
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| PlayerParser | [ProxiedPlayer](https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/net/md_5/bungee/api/connection/ProxiedPlayer.html) |
| ServerParser | [ServerInfo](https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/net/md_5/bungee/api/config/ServerInfo.html) |
14 changes: 11 additions & 3 deletions docs/minecraft/paper.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# cloud-paper

<!-- prettier-ignore -->
`cloud-paper` is an extension of `cloud-bukkit` with additional support for
[Paper](https://papermc.io/software/paper)-based platforms. `cloud-paper` maintains support for all platforms supported
by `cloud-bukkit`, and therefore is the recommended dependency to use Cloud on any Bukkit-based platform.
The following documentation is written with the assumption that you have already read and understand the
[`cloud-bukkit` documentation](bukkit.md).

## Links

<div class="grid cards" markdown>

- [:fontawesome-brands-github: Source Code](https://github.com/Incendo/cloud-minecraft/tree/master/cloud-paper)
- [:fontawesome-brands-github: Example Plugin](https://github.com/Incendo/cloud-minecraft/tree/master/examples/example-bukkit)

</div>

## Installation

Cloud for Paper is available through [Maven Central](https://central.sonatype.com/artifact/cloud.commandframework/cloud-paper).
Expand Down Expand Up @@ -70,8 +78,8 @@ PaperCommandManager<CommandSender> commandManager = PaperCommandManager.createNa

## Brigadier

Paper exposes Brigadier, which means that you may use the features from [cloud-brigadier](brigadier.md) on Paper
servers.
Paper exposes [Brigadier](https://github.com/mojang/brigadier), which means that you may use the features
from [cloud-brigadier](brigadier.md) on Paper servers.

You may enable Brigadier mappings using `PaperCommandManager#registerBrigadier()`. You should make use of the
capability system to make sure that Brigadier is available on the server your plugin is running on:
Expand Down
91 changes: 91 additions & 0 deletions docs/minecraft/velocity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# cloud-velocity

`cloud-velocity` allows you to write commands for [Velocity](https://papermc.io/software/velocity).

## Links

<div class="grid cards" markdown>

- [:fontawesome-brands-github: Source Code](https://github.com/Incendo/cloud-minecraft/tree/master/cloud-velocity)
- [:fontawesome-brands-github: Example Plugin](https://github.com/Incendo/cloud-minecraft/tree/master/examples/example-velocity)

</div>

## Installation

Cloud for Velocity is available through [Maven Central](https://central.sonatype.com/artifact/cloud.commandframework/cloud-paper).

<!-- prettier-ignore -->
=== "Maven"

```xml
<dependencies>
<dependency>
<groupId>cloud.commandframework</groupId>
<artifactId>cloud-velocity</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
```

=== "Gradle (Kotlin)"

```kotlin
implementation("cloud.commandframework:cloud-velocity:2.0.0-SNAPSHOT")
```

=== "Gradle (Groovy)"

```groovy
implementation 'cloud.commandframework:cloud-velocity:2.0.0-SNAPSHOT'
```

## Usage

`cloud-velocity` has a command manager implementation called `VelocityCommandManager` that can be created in two ways.

By using a Guice injector:

```java
// @Inject private Injector injector;
Injector childInjector = injector.createChildInjector(
new CloudInjectionModule<>(
YourSenderType.class,
executionCoordinator, /* 1 */
senderMapper /* 2 */
)
);

VelocityCommandManager<YourSenderType> commandManager = childInjector.getInstance(
Key.get(new TypeLiteral<VelocityCommandManager<YourSenderType>>() {})
);
```

Or, manually creating an instance:

```java
VelocityCommandManager<YourSenderType> commandManager = new VelocityCommandManager<>(
pluginContainer,
proxyServer,
executionCoordinator, /* 1 */
senderMapper /* 2 */
);
```

1. Information about execution coordinators in general can be found
[here](../core/index.md#execution-coordinators).
2. The sender mapper is a two-way mapping between Velocity's
[`CommandSource`](https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/command/CommandSource.html) and your custom sender type.
You may use `SenderMapper.identity()` if using `CommandSource` as the sender type.

## Brigadier

Velocity commands are powered by [Brigadier](https://github.com/mojang/brigadier), which means that you may
use the features from [cloud-brigadier](brigadier.md).

## Parsers

| Parser | Type |
| ------------ | ------------------------------------------------------------------------------------------------------------------- |
| PlayerParser | [Player](https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/proxy/Player.html) |
| ServerParser | [RegisteredServer](https://jd.papermc.io/velocity/3.0.0/com/velocitypowered/api/proxy/server/RegisteredServer.html) |

0 comments on commit c04a512

Please sign in to comment.