Search in sources :

Example 1 with PrismEntityEvents

use of me.botsko.prism.listeners.PrismEntityEvents in project Prism-Bukkit by prism.

the class Prism method enabled.

private void enabled() {
    if (isEnabled()) {
        eventTimer = new TimeTaken(this);
        queueStats = new QueueStats();
        ignore = new Ignore(this);
        // Assign event listeners
        getServer().getPluginManager().registerEvents(new PrismBlockEvents(this), this);
        getServer().getPluginManager().registerEvents(new PrismEntityEvents(this), this);
        getServer().getPluginManager().registerEvents(new PrismWorldEvents(), this);
        getServer().getPluginManager().registerEvents(new PrismPlayerEvents(this), this);
        if (isPaper) {
            // register listeners that only work with paper.
            getServer().getPluginManager().registerEvents(new PaperListeners(this), this);
        }
        getServer().getPluginManager().registerEvents(new PrismInventoryEvents(this), this);
        getServer().getPluginManager().registerEvents(new PrismVehicleEvents(this), this);
        // InventoryMoveItem
        if (getConfig().getBoolean("prism.track-hopper-item-events") && Prism.getIgnore().event("item-insert")) {
            getServer().getPluginManager().registerEvents(new PrismInventoryMoveItemEvent(), this);
        }
        if (getConfig().getBoolean("prism.tracking.api.enabled")) {
            getServer().getPluginManager().registerEvents(new PrismCustomEvents(this), this);
        }
        getServer().getPluginManager().registerEvents(new PrismMiscEvents(), this);
        // Add commands
        PluginCommand command = getCommand("prism");
        if (command != null) {
            commands = new PrismCommands(this, false);
            command.setExecutor(commands);
            command.setTabCompleter(commands);
        } else {
            warn("Command Executor Error: Check plugin.yml");
            Bukkit.getPluginManager().disablePlugin(instance);
            return;
        }
        PluginCommand commandAlt = getCommand("what");
        if (commandAlt != null) {
            commandAlt.setExecutor(new WhatCommand(this));
        } else {
            log("Command Executor Error: Check plugin.yml - what command not found ");
        }
        // Register official parameters
        registerParameter(new ActionParameter());
        registerParameter(new BeforeParameter());
        registerParameter(new BlockParameter());
        registerParameter(new EntityParameter());
        registerParameter(new FlagParameter());
        registerParameter(new IdParameter());
        registerParameter(new KeywordParameter());
        registerParameter(new PlayerParameter());
        registerParameter(new RadiusParameter());
        registerParameter(new SinceParameter());
        registerParameter(new WorldParameter());
        // Init re-used classes
        oreMonitor = new OreMonitor(instance);
        useMonitor = new UseMonitor(instance);
        // Init async tasks
        actionRecorderTask();
        // Init scheduled events
        endExpiredQueryCaches();
        endExpiredPreviews();
        removeExpiredLocations();
        // Delete old data based on config
        launchScheduledPurgeManager();
        // Keep watch on db connections, other sanity
        launchInternalAffairs();
        if (config.getBoolean("prism.preload-materials")) {
            config.set("prism.preload-materials", false);
            saveConfig();
            Prism.log("Preloading materials - This will take a while!");
            items.initAllMaterials();
            Prism.log("Preloading complete!");
        }
        items.initMaterials(Material.AIR);
        Bukkit.getScheduler().runTaskAsynchronously(instance, () -> Bukkit.getPluginManager().callEvent(EventHelper.createLoadEvent(Prism.getInstance())));
    }
}
Also used : Ignore(me.botsko.prism.actionlibs.Ignore) BeforeParameter(me.botsko.prism.parameters.BeforeParameter) RadiusParameter(me.botsko.prism.parameters.RadiusParameter) PrismWorldEvents(me.botsko.prism.listeners.PrismWorldEvents) EntityParameter(me.botsko.prism.parameters.EntityParameter) UseMonitor(me.botsko.prism.monitors.UseMonitor) FlagParameter(me.botsko.prism.parameters.FlagParameter) QueueStats(me.botsko.prism.measurement.QueueStats) PaperListeners(me.botsko.prism.listeners.PaperListeners) OreMonitor(me.botsko.prism.monitors.OreMonitor) PluginCommand(org.bukkit.command.PluginCommand) PrismMiscEvents(me.botsko.prism.listeners.self.PrismMiscEvents) WhatCommand(me.botsko.prism.commands.WhatCommand) PrismCustomEvents(me.botsko.prism.listeners.PrismCustomEvents) PrismCommands(me.botsko.prism.commands.PrismCommands) TimeTaken(me.botsko.prism.measurement.TimeTaken) PrismEntityEvents(me.botsko.prism.listeners.PrismEntityEvents) PrismInventoryMoveItemEvent(me.botsko.prism.listeners.PrismInventoryMoveItemEvent) KeywordParameter(me.botsko.prism.parameters.KeywordParameter) ActionParameter(me.botsko.prism.parameters.ActionParameter) PrismVehicleEvents(me.botsko.prism.listeners.PrismVehicleEvents) WorldParameter(me.botsko.prism.parameters.WorldParameter) PrismPlayerEvents(me.botsko.prism.listeners.PrismPlayerEvents) BlockParameter(me.botsko.prism.parameters.BlockParameter) PlayerParameter(me.botsko.prism.parameters.PlayerParameter) IdParameter(me.botsko.prism.parameters.IdParameter) SinceParameter(me.botsko.prism.parameters.SinceParameter) PrismInventoryEvents(me.botsko.prism.listeners.PrismInventoryEvents) PrismBlockEvents(me.botsko.prism.listeners.PrismBlockEvents)

Aggregations

Ignore (me.botsko.prism.actionlibs.Ignore)1 PrismCommands (me.botsko.prism.commands.PrismCommands)1 WhatCommand (me.botsko.prism.commands.WhatCommand)1 PaperListeners (me.botsko.prism.listeners.PaperListeners)1 PrismBlockEvents (me.botsko.prism.listeners.PrismBlockEvents)1 PrismCustomEvents (me.botsko.prism.listeners.PrismCustomEvents)1 PrismEntityEvents (me.botsko.prism.listeners.PrismEntityEvents)1 PrismInventoryEvents (me.botsko.prism.listeners.PrismInventoryEvents)1 PrismInventoryMoveItemEvent (me.botsko.prism.listeners.PrismInventoryMoveItemEvent)1 PrismPlayerEvents (me.botsko.prism.listeners.PrismPlayerEvents)1 PrismVehicleEvents (me.botsko.prism.listeners.PrismVehicleEvents)1 PrismWorldEvents (me.botsko.prism.listeners.PrismWorldEvents)1 PrismMiscEvents (me.botsko.prism.listeners.self.PrismMiscEvents)1 QueueStats (me.botsko.prism.measurement.QueueStats)1 TimeTaken (me.botsko.prism.measurement.TimeTaken)1 OreMonitor (me.botsko.prism.monitors.OreMonitor)1 UseMonitor (me.botsko.prism.monitors.UseMonitor)1 ActionParameter (me.botsko.prism.parameters.ActionParameter)1 BeforeParameter (me.botsko.prism.parameters.BeforeParameter)1 BlockParameter (me.botsko.prism.parameters.BlockParameter)1