Search in sources :

Example 1 with ServicesManager

use of org.bukkit.plugin.ServicesManager in project CloudNet by Dytanic.

the class VaultInvoker method invoke.

public static void invoke() {
    ServicesManager servicesManager = BukkitBootstrap.getPlugin(BukkitBootstrap.class).getServer().getServicesManager();
    Permission permission = new VaultPermissionImpl();
    servicesManager.register(Permission.class, permission, BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
    servicesManager.register(Chat.class, new VaultChatImpl(permission), BukkitBootstrap.getPlugin(BukkitBootstrap.class), ServicePriority.Highest);
}
Also used : ServicesManager(org.bukkit.plugin.ServicesManager) Permission(net.milkbowl.vault.permission.Permission) BukkitBootstrap(de.dytanic.cloudnet.bridge.BukkitBootstrap)

Example 2 with ServicesManager

use of org.bukkit.plugin.ServicesManager in project LuckPerms by lucko.

the class VaultHookManager method unhook.

/**
 * Unregisters the LuckPerms Vault hooks, if present.
 *
 * @param plugin the plugin
 */
public void unhook(LPBukkitPlugin plugin) {
    final ServicesManager sm = plugin.getBootstrap().getServer().getServicesManager();
    if (this.permissionHook != null) {
        sm.unregister(Permission.class, this.permissionHook);
        this.permissionHook.getExecutor().shutdown();
        this.permissionHook = null;
    }
    if (this.chatHook != null) {
        sm.unregister(Chat.class, this.chatHook);
        this.chatHook = null;
    }
}
Also used : ServicesManager(org.bukkit.plugin.ServicesManager)

Example 3 with ServicesManager

use of org.bukkit.plugin.ServicesManager in project LuckPerms by lucko.

the class VaultHookManager method hook.

/**
 * Registers the LuckPerms implementation of {@link Permission} and {@link Chat} with
 * the service manager.
 *
 * @param plugin the plugin
 */
public void hook(LPBukkitPlugin plugin) {
    try {
        if (this.permissionHook == null) {
            this.permissionHook = new VaultPermissionHook(plugin);
        }
        if (this.chatHook == null) {
            this.chatHook = new VaultChatHook(plugin, this.permissionHook);
        }
        final ServicesManager sm = plugin.getBootstrap().getServer().getServicesManager();
        sm.register(Permission.class, this.permissionHook, plugin.getBootstrap(), ServicePriority.High);
        sm.register(Chat.class, this.chatHook, plugin.getBootstrap(), ServicePriority.High);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ServicesManager(org.bukkit.plugin.ServicesManager)

Aggregations

ServicesManager (org.bukkit.plugin.ServicesManager)3 BukkitBootstrap (de.dytanic.cloudnet.bridge.BukkitBootstrap)1 Permission (net.milkbowl.vault.permission.Permission)1