public void inject(Plugin plugin) { Bukkit.getLogger() .info( "[" + PluginBungeePermsBukkitBridge.getInstance().getDescription().getName() + "] Injection of BungeepermsBukkit into Vault"); try { Vault v = (Vault) plugin; // inject BungeePerms Method m = v.getClass() .getDeclaredMethod( "hookPermission", String.class, Class.class, ServicePriority.class, String[].class); m.setAccessible(true); m.invoke( v, "BungeePermsBukkit", Permission_BungeePermsBukkit.class, ServicePriority.Normal, new String[] {"net.alpenblock.bungeeperms.bukkit.BungeePerms"}); Field f = v.getClass().getDeclaredField("perms"); f.setAccessible(true); f.set(v, Bukkit.getServicesManager().getRegistration(Permission.class).getProvider()); } catch (Exception ex) { ex.printStackTrace(); } }
public Permission_Starburst(Vault plugin) { this.plugin = plugin; Bukkit.getServer().getPluginManager().registerEvents(new PermissionServerListener(), plugin); // Load Plugin in case it was loaded before if (perms == null) { Plugin p = plugin.getServer().getPluginManager().getPlugin("Starburst"); if (p != null) { perms = (StarburstPlugin) p; log.info( String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), name)); } } }