Search in sources :

Example 1 with Kit

use of com.voxelgameslib.voxelgameslib.components.kits.Kit in project VoxelGamesLibv2 by VoxelGamesLib.

the class KitFeature method enable.

/**
 * @see AbstractFeature#enable()
 */
@Override
public void enable() {
    if (registerCommands) {
        commandManager.registerCommand(injector.getInstance(KitCommands.class));
    }
    if (allowedKits.size() == 0) {
        allowedKits.add("DefaultKit");
    }
    // try to load kits
    allowedKits.forEach(kit -> {
        Optional<Kit> k = kitHandler.loadKit(kit);
        if (k.isPresent()) {
            kits.add(k.get());
        } else {
            log.warning("Could not find kit " + kit);
        }
    });
    kits.forEach(kit -> {
        if (kit.getAbilities() != null) {
            for (Ability ability : kit.getAbilities().values()) {
                Bukkit.getPluginManager().registerEvents(ability, voxelGamesLib);
            }
        }
    });
}
Also used : Ability(com.voxelgameslib.voxelgameslib.components.ability.Ability) Kit(com.voxelgameslib.voxelgameslib.components.kits.Kit) KitCommands(com.voxelgameslib.voxelgameslib.command.commands.KitCommands)

Aggregations

KitCommands (com.voxelgameslib.voxelgameslib.command.commands.KitCommands)1 Ability (com.voxelgameslib.voxelgameslib.components.ability.Ability)1 Kit (com.voxelgameslib.voxelgameslib.components.kits.Kit)1