use of org.cubeengine.module.vigil.Lookup in project modules-extra by CubeEngine.
the class VigilLookupCommands method lookup.
@Alias(value = "lookup")
@Command(desc = "Performs a lookup.")
public void lookup(Player context, @Named("radius") int radius) {
LookupData ld = new LookupData();
Lookup lookup = new Lookup(ld).with(context.getLocation()).withRadius(radius);
this.qm.queryAndShow(lookup, context);
}
use of org.cubeengine.module.vigil.Lookup in project modules-extra by CubeEngine.
the class QueryManager method queryAndShow.
public // TODO lookup object
void queryAndShow(// TODO lookup object
Lookup lookup, // TODO lookup object
Player player) {
// TODO lookup cancel previous?
Future future = queryFuture.get(player.getUniqueId());
if (future != null && !future.isDone()) {
i18n.send(ChatTypes.ACTION_BAR, player, MessageType.NEGATIVE, "There is another lookup active!");
return;
}
Query query = buildQuery(lookup);
future = // Async MongoDB Lookup
CompletableFuture.supplyAsync(() -> lookup(lookup, query)).thenApply(// Still Async Prepare Reports
result -> this.prepareReports(lookup, player, result)).thenAcceptAsync(r -> this.show(lookup, player, r), // Resync to show information
queryShowExecutor);
queryFuture.put(player.getUniqueId(), future);
}
Aggregations