cloud-velocity#
cloud-velocity
allows you to write commands for Velocity.
Links#
Installation#
Cloud for Velocity is available through Maven Central.
<dependencies>
<dependency>
<groupId>org.incendo</groupId>
<artifactId>cloud-velocity</artifactId>
<version>2.0.0-beta.10</version>
</dependency>
</dependencies>
implementation("org.incendo:cloud-velocity:2.0.0-beta.10")
implementation 'org.incendo:cloud-velocity:2.0.0-beta.10'
Usage#
cloud-velocity
has a command manager implementation called
VelocityCommandManager
that can be created in two ways.
By using a Guice injector:
// @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:
VelocityCommandManager<YourSenderType> commandManager = new VelocityCommandManager<>(
pluginContainer,
proxyServer,
executionCoordinator, /* 1 */
senderMapper /* 2 */
);
- Information about execution coordinators in general can be found here.
- The sender mapper is a two-way mapping between Velocity’s
CommandSource
and your custom sender type. You may useSenderMapper.identity()
if usingCommandSource
as the sender type.
Brigadier#
Velocity commands are powered by Brigadier, which means that you may use the features from cloud-brigadier.
Parsers#
Parser | Type |
---|---|
PlayerParser | Player |
ServerParser | RegisteredServer |
Localization#
cloud-velocity
provides additional caption keys for the localization system.
These can be found in
VelocityCaptionKeys
.
The default caption values can be found in
VelocityCommandManager
.