use of dev.frankheijden.insights.commands.CommandScanCache 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));
}
Aggregations