Search in sources :

Example 1 with LookupData

use of org.cubeengine.module.vigil.data.LookupData in project modules-extra by CubeEngine.

the class Vigil method onEnable.

@Listener
public void onEnable(GameInitializationEvent event) {
    this.tf = mm.getThreadFactory(Vigil.class);
    ReportManager reportManager = new ReportManager(this, em, i18n);
    qm = new QueryManager(tf, bd.getDatabase().getCollection("vigil"), reportManager, i18n, plugin);
    this.cm.getProviders().register(this, new LookupDataParser(i18n), LookupData.class);
    ;
    VigilCommands vc = new VigilCommands(sm, i18n, cm);
    cm.addCommand(vc);
    vc.addCommand(new VigilAdminCommands(cm, i18n, this));
    cm.addCommands(vc, this, new VigilLookupCommands(cm, i18n, qm));
    em.registerListener(Vigil.class, new ToolListener(pm, qm));
    DataRegistration<LookupData, ImmutableLookupData> dr = DataRegistration.<LookupData, ImmutableLookupData>builder().dataClass(LookupData.class).immutableClass(ImmutableLookupData.class).builder(new LookupDataBuilder()).manipulatorId("vigil-lookup").dataName("CubeEngine vigil Lookup Data").buildAndRegister(plugin);
}
Also used : LookupDataParser(org.cubeengine.module.vigil.commands.LookupDataParser) ImmutableLookupData(org.cubeengine.module.vigil.data.ImmutableLookupData) LookupDataBuilder(org.cubeengine.module.vigil.data.LookupDataBuilder) QueryManager(org.cubeengine.module.vigil.storage.QueryManager) VigilCommands(org.cubeengine.module.vigil.commands.VigilCommands) ImmutableLookupData(org.cubeengine.module.vigil.data.ImmutableLookupData) LookupData(org.cubeengine.module.vigil.data.LookupData) ReportManager(org.cubeengine.module.vigil.report.ReportManager) VigilAdminCommands(org.cubeengine.module.vigil.commands.VigilAdminCommands) VigilLookupCommands(org.cubeengine.module.vigil.commands.VigilLookupCommands) Listener(org.spongepowered.api.event.Listener)

Example 2 with LookupData

use of org.cubeengine.module.vigil.data.LookupData in project modules-extra by CubeEngine.

the class LookupDataParser method parse.

@Override
public LookupData parse(Class clazz, CommandInvocation ci) throws ParserException {
    String token = ci.consume(1);
    if (!types.keySet().contains(token.toLowerCase())) {
        throw new TranslatedParserException(i18n.translate(ci.getContext(Locale.class), NEGATIVE, "{input} is not a valid log-type. Use chest, container, player, block or kills instead!", token));
    }
    LookupData data = types.get(token.toLowerCase()).copy();
    return data.withCreator(((Player) ci.getCommandSource()).getUniqueId());
}
Also used : TranslatedParserException(org.cubeengine.libcube.service.command.TranslatedParserException) LookupData(org.cubeengine.module.vigil.data.LookupData)

Example 3 with LookupData

use of org.cubeengine.module.vigil.data.LookupData 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);
}
Also used : Lookup(org.cubeengine.module.vigil.Lookup) LookupData(org.cubeengine.module.vigil.data.LookupData) Command(org.cubeengine.butler.parametric.Command) ContainerCommand(org.cubeengine.libcube.service.command.ContainerCommand) Alias(org.cubeengine.butler.alias.Alias)

Aggregations

LookupData (org.cubeengine.module.vigil.data.LookupData)3 Alias (org.cubeengine.butler.alias.Alias)1 Command (org.cubeengine.butler.parametric.Command)1 ContainerCommand (org.cubeengine.libcube.service.command.ContainerCommand)1 TranslatedParserException (org.cubeengine.libcube.service.command.TranslatedParserException)1 Lookup (org.cubeengine.module.vigil.Lookup)1 LookupDataParser (org.cubeengine.module.vigil.commands.LookupDataParser)1 VigilAdminCommands (org.cubeengine.module.vigil.commands.VigilAdminCommands)1 VigilCommands (org.cubeengine.module.vigil.commands.VigilCommands)1 VigilLookupCommands (org.cubeengine.module.vigil.commands.VigilLookupCommands)1 ImmutableLookupData (org.cubeengine.module.vigil.data.ImmutableLookupData)1 LookupDataBuilder (org.cubeengine.module.vigil.data.LookupDataBuilder)1 ReportManager (org.cubeengine.module.vigil.report.ReportManager)1 QueryManager (org.cubeengine.module.vigil.storage.QueryManager)1 Listener (org.spongepowered.api.event.Listener)1