Search in sources :

Example 1 with CrateElement

use of pw.codehusky.huskycrates.commands.elements.CrateElement in project HuskyCrates-Sponge by codeHusky.

the class HuskyCrates method gameStarted.

@Listener
public void gameStarted(GameStartedServerEvent event) {
    CommandSpec key = CommandSpec.builder().description(Text.of("Get a key for a specified crate.")).arguments(new CrateElement(Text.of("type")), GenericArguments.playerOrSource(Text.of("player")), GenericArguments.optional(GenericArguments.integer(Text.of("quantity")))).permission("huskycrates.key").executor(new Key()).build();
    CommandSpec keyAll = CommandSpec.builder().description(Text.of("Give everyone a specified amount of keys for a crate.")).arguments(new CrateElement(Text.of("type")), GenericArguments.optional(GenericArguments.integer(Text.of("quantity")))).permission("huskycrates.keyAll").executor(new KeyAll()).build();
    CommandSpec wand = CommandSpec.builder().description(Text.of("Give yourself an entity wand for crates.")).arguments(new CrateElement(Text.of("type"))).permission("huskycrates.wand").executor(new Wand()).build();
    CommandSpec chest = CommandSpec.builder().description(Text.of("Get the placeable crate item.")).permission("huskycrates.chest").arguments(new CrateElement(Text.of("type")), GenericArguments.playerOrSource(Text.of("player")), GenericArguments.optional(GenericArguments.integer(Text.of("quantity")))).executor(new Chest()).build();
    CommandSpec crateSpec = CommandSpec.builder().description(Text.of("Main crates command")).child(key, "key").child(chest, "chest").child(keyAll, "keyAll").child(wand, "wand").arguments(GenericArguments.optional(GenericArguments.remainingRawJoinedStrings(Text.of("")))).executor(new Crate(this)).build();
    scheduler = Sponge.getScheduler();
    genericCause = Cause.of(NamedCause.of("PluginContainer", pC));
    Sponge.getCommandManager().register(this, crateSpec, "crate");
    logger.info("Crates has been started.");
}
Also used : CommandSpec(org.spongepowered.api.command.spec.CommandSpec) VirtualCrate(pw.codehusky.huskycrates.crate.VirtualCrate) PhysicalCrate(pw.codehusky.huskycrates.crate.PhysicalCrate) CrateElement(pw.codehusky.huskycrates.commands.elements.CrateElement) Listener(org.spongepowered.api.event.Listener)

Aggregations

CommandSpec (org.spongepowered.api.command.spec.CommandSpec)1 Listener (org.spongepowered.api.event.Listener)1 CrateElement (pw.codehusky.huskycrates.commands.elements.CrateElement)1 PhysicalCrate (pw.codehusky.huskycrates.crate.PhysicalCrate)1 VirtualCrate (pw.codehusky.huskycrates.crate.VirtualCrate)1