Search in sources :

Example 1 with CommandScanHistory

use of dev.frankheijden.insights.commands.CommandScanHistory in project Insights by InsightsPlugin.

the class Insights method loadCommands.

private void loadCommands() {
    PaperCommandManager<CommandSender> commandManager;
    try {
        commandManager = new PaperCommandManager<>(this, AsynchronousCommandExecutionCoordinator.<CommandSender>newBuilder().build(), Function.identity(), Function.identity());
    } catch (Exception ex) {
        ex.printStackTrace();
        return;
    }
    // Register parsers
    ParserRegistry<CommandSender> parserRegistry = commandManager.getParserRegistry();
    parserRegistry.registerParserSupplier(TypeToken.get(new TypeToken<Limit>() {
    }.getType()), options -> new LimitArgument.LimitParser());
    parserRegistry.registerParserSupplier(TypeToken.get(new TypeToken<ScanObject<?>[]>() {
    }.getType()), options -> new ScanObjectArrayArgument.ScanObjectArrayParser());
    parserRegistry.registerParserSupplier(TypeToken.get(new TypeToken<CommandScanHistory.Page>() {
    }.getType()), options -> new ScanHistoryPageArgument.ScanHistoryPageParser());
    parserRegistry.registerParserSupplier(TypeToken.get(new TypeToken<World>() {
    }.getType()), options -> new WorldArgument.WorldParser());
    // Register capabilities if allowed
    if (commandManager.queryCapability(CloudBukkitCapabilities.BRIGADIER)) {
        commandManager.registerBrigadier();
        CloudBrigadierManager<CommandSender, ?> brigadierManager = commandManager.brigadierManager();
        var handler = new BrigadierHandler(brigadierManager);
        handler.registerTypes();
    }
    if (commandManager.queryCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {
        commandManager.registerAsynchronousCompletions();
    }
    // Create Annotation Parser
    AnnotationParser<CommandSender> annotationParser = new AnnotationParser<>(commandManager, CommandSender.class, parameters -> SimpleCommandMeta.empty());
    // Parse commands
    annotationParser.parse(new CommandInsights(this));
    annotationParser.parse(new CommandScan(this));
    annotationParser.parse(new CommandScanCache(this));
    annotationParser.parse(new CommandScanWorld(this));
    annotationParser.parse(new CommandScanRegion(this));
    annotationParser.parse(new CommandScanHistory(this));
    annotationParser.parse(new CommandTeleportChunk(this));
    annotationParser.parse(new CommandCancelScan(this));
}
Also used : AnnotationParser(cloud.commandframework.annotations.AnnotationParser) CommandTeleportChunk(dev.frankheijden.insights.commands.CommandTeleportChunk) BrigadierHandler(dev.frankheijden.insights.commands.brigadier.BrigadierHandler) World(org.bukkit.World) CommandScanWorld(dev.frankheijden.insights.commands.CommandScanWorld) CommandScanRegion(dev.frankheijden.insights.commands.CommandScanRegion) CommandScan(dev.frankheijden.insights.commands.CommandScan) ScanHistoryPageArgument(dev.frankheijden.insights.commands.parser.ScanHistoryPageArgument) CommandScanHistory(dev.frankheijden.insights.commands.CommandScanHistory) CommandCancelScan(dev.frankheijden.insights.commands.CommandCancelScan) LimitArgument(dev.frankheijden.insights.commands.parser.LimitArgument) CommandInsights(dev.frankheijden.insights.commands.CommandInsights) ScanObjectArrayArgument(dev.frankheijden.insights.commands.parser.ScanObjectArrayArgument) CommandScanWorld(dev.frankheijden.insights.commands.CommandScanWorld) YamlParseException(dev.frankheijden.insights.api.config.parser.YamlParseException) IOException(java.io.IOException) WorldArgument(dev.frankheijden.insights.commands.parser.WorldArgument) CommandSender(org.bukkit.command.CommandSender) Limit(dev.frankheijden.insights.api.config.limits.Limit) CommandScanCache(dev.frankheijden.insights.commands.CommandScanCache)

Aggregations

AnnotationParser (cloud.commandframework.annotations.AnnotationParser)1 Limit (dev.frankheijden.insights.api.config.limits.Limit)1 YamlParseException (dev.frankheijden.insights.api.config.parser.YamlParseException)1 CommandCancelScan (dev.frankheijden.insights.commands.CommandCancelScan)1 CommandInsights (dev.frankheijden.insights.commands.CommandInsights)1 CommandScan (dev.frankheijden.insights.commands.CommandScan)1 CommandScanCache (dev.frankheijden.insights.commands.CommandScanCache)1 CommandScanHistory (dev.frankheijden.insights.commands.CommandScanHistory)1 CommandScanRegion (dev.frankheijden.insights.commands.CommandScanRegion)1 CommandScanWorld (dev.frankheijden.insights.commands.CommandScanWorld)1 CommandTeleportChunk (dev.frankheijden.insights.commands.CommandTeleportChunk)1 BrigadierHandler (dev.frankheijden.insights.commands.brigadier.BrigadierHandler)1 LimitArgument (dev.frankheijden.insights.commands.parser.LimitArgument)1 ScanHistoryPageArgument (dev.frankheijden.insights.commands.parser.ScanHistoryPageArgument)1 ScanObjectArrayArgument (dev.frankheijden.insights.commands.parser.ScanObjectArrayArgument)1 WorldArgument (dev.frankheijden.insights.commands.parser.WorldArgument)1 IOException (java.io.IOException)1 World (org.bukkit.World)1 CommandSender (org.bukkit.command.CommandSender)1