public static void inject(Player player, LuckPermsPermissible newPermissible) throws Exception {
        // get the existing PermissibleBase held by the player
        PermissibleBase oldPermissible = (PermissibleBase) PLAYER_PERMISSIBLE_FIELD.get(player);

        if (oldPermissible instanceof LuckPermsPermissible) {
            // Nukkit seems to re-use player instances (or perhaps calls the login event twice?)
            // so, just uninject here instead of throwing an exception like we do on Bukkit
            // See: https://github.com/LuckPerms/LuckPerms/issues/2791
            uninject(player, false);
        }

        // Move attachments over from the old permissible

        //noinspection unchecked
        Set<PermissionAttachment> attachments = (Set<PermissionAttachment>) PERMISSIBLE_BASE_ATTACHMENTS_FIELD.get(oldPermissible);

        newPermissible.convertAndAddAttachments(attachments);
        attachments.clear();
        oldPermissible.clearPermissions();

        // Setup the new permissible
        newPermissible.getActive().set(true);
        newPermissible.setOldPermissible(oldPermissible);

        // inject the new instance
        PLAYER_PERMISSIBLE_FIELD.set(player, newPermissible);
    }
Injects a {@link LuckPermsPermissible} into a {@link Player}.

@param player the player to inject into
@param newPermissible the permissible to inject
@throws Exception propagates any exceptions which were thrown during injection
nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/PermissibleInjector.java