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);
}
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;
}
}
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();
}
}
Aggregations