Search in sources :

Example 6 with Timing

use of com.voxelgameslib.voxelgameslib.internal.timings.Timing in project VoxelGamesLibv2 by VoxelGamesLib.

the class VoxelGamesLib method onDisable.

@Override
public void onDisable() {
    if (!enabledCleanly) {
        return;
    }
    try {
        // chat menu api
        ChatMenuAPI.disable();
        getServer().getPluginManager().callEvent(new VoxelGamesLibDisableEvent());
        try (final Timing timing = new Timing("DisableAllHandlers")) {
            configHandler.disable();
            langHandler.disable();
            tickHandler.disable();
            chatHandler.disable();
            userHandler.disable();
            roleHandler.disable();
            mapHandler.disable();
            worldHandler.disable();
            teamHandler.disable();
            eloHandler.disable();
            matchmakingHandler.disable();
            signHandler.disable();
            metricHandler.disable();
            kitHandler.disable();
            pointHandler.disable();
            commandHandler.disable();
            textureHandler.disable();
            statsHandler.disable();
            gameHandler.disable();
            moduleHandler.disable();
            eventHandler.disable();
            persistenceHandler.disable();
            errorHandler.disable();
            loggingHandler.disable();
            injector = null;
        }
    } catch (Exception ex) {
        errorHandler.handle(ex, Severity.ERROR, true);
    }
}
Also used : VoxelGamesLibDisableEvent(com.voxelgameslib.voxelgameslib.api.event.events.VoxelGamesLibDisableEvent) Timing(com.voxelgameslib.voxelgameslib.internal.timings.Timing)

Example 7 with Timing

use of com.voxelgameslib.voxelgameslib.internal.timings.Timing in project VoxelGamesLibv2 by VoxelGamesLib.

the class VoxelGamesLibModule method getScannerWithAddons.

@Provides
@Named("IncludeAddons")
public ScanResult getScannerWithAddons(ModuleHandler moduleHandler) {
    try (Timing timing = new Timing("ModuleClassPathScanning")) {
        ClassGraph scanner = new ClassGraph();
        scanner.addClassLoader(getClass().getClassLoader());
        moduleHandler.getModuleClassLoaders().forEach(scanner::addClassLoader);
        return scanner.enableAllInfo().scan();
    }
}
Also used : ClassGraph(io.github.classgraph.ClassGraph) Timing(com.voxelgameslib.voxelgameslib.internal.timings.Timing) Named(com.google.inject.name.Named) Provides(com.google.inject.Provides)

Aggregations

Timing (com.voxelgameslib.voxelgameslib.internal.timings.Timing)7 Named (com.google.inject.name.Named)2 VoxelGamesLib (com.voxelgameslib.voxelgameslib.VoxelGamesLib)2 Handler (com.voxelgameslib.voxelgameslib.internal.handler.Handler)2 ClassGraph (io.github.classgraph.ClassGraph)2 Logger (java.util.logging.Logger)2 Inject (javax.inject.Inject)2 Singleton (javax.inject.Singleton)2 BukkitCommandManager (co.aikar.commands.BukkitCommandManager)1 Severity (com.bugsnag.Severity)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 Injector (com.google.inject.Injector)1 Provides (com.google.inject.Provides)1 VoxelGamesLibDisableEvent (com.voxelgameslib.voxelgameslib.api.event.events.VoxelGamesLibDisableEvent)1 VoxelGamesLibEnableEvent (com.voxelgameslib.voxelgameslib.api.event.events.VoxelGamesLibEnableEvent)1 GameHandler (com.voxelgameslib.voxelgameslib.api.game.GameHandler)1 UserHandler (com.voxelgameslib.voxelgameslib.components.user.UserHandler)1 ErrorHandler (com.voxelgameslib.voxelgameslib.internal.error.ErrorHandler)1