public static void inject(LPForgePlugin plugin, CommandDispatcher<CommandSourceStack> dispatcher) {
        Iterable<CommandNodeWithParent> tree = CommandNodeGraph.INSTANCE.traverse(
                TraversalAlgorithm.DEPTH_FIRST_PRE_ORDER,
                new CommandNodeWithParent(null, dispatcher.getRoot())
        );

        for (CommandNodeWithParent node : tree) {
            Predicate<CommandSourceStack> requirement = node.node.getRequirement();

            // already injected - skip
            if (requirement instanceof InjectedPermissionRequirement) {
                continue;
            }

            String permission = buildPermissionNode(node);
            if (permission == null) {
                continue;
            }

            plugin.getPermissionRegistry().insert(permission);

            InjectedPermissionRequirement newRequirement = new InjectedPermissionRequirement(plugin, permission, requirement);
            try {
                REQUIREMENT_FIELD.set(node.node, newRequirement);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }
Inject permission requirements into the commands in the given dispatcher.

@param plugin the plugin
@param dispatcher the command dispatcher
forge/src/main/java/me/lucko/luckperms/forge/util/BrigadierInjector.java