use of me.botsko.prism.measurement.TimeTaken 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())));
}
}
Aggregations