public String uploadPasteData(BytebinClient bytebin, Sender sender, User user, PermissionCache checker) throws IOException, UnsuccessfulRequestException {
        // only paste if there is actually data here
        if (!hasData()) {
            throw new IllegalStateException();
        }

        // work out the prefix to apply
        // since the view is relative, we need to prepend this to all permissions
        String prefix = this.rootPosition.equals(".") ? "" : this.rootPosition + ".";
        JsonObject jsonTree = this.view.toJson(prefix);

        JObject metadata = new JObject()
                .add("time", DATE_FORMAT.format(new Date(System.currentTimeMillis())))
                .add("root", this.rootPosition)
                .add("uploader", new JObject()
                        .add("name", sender.getNameWithLocation())
                        .add("uuid", sender.getUniqueId().toString())
                );

        JObject checks;
        if (user != null && checker != null) {
            metadata.add("referenceUser", new JObject()
                    .add("name", user.getPlainDisplayName())
                    .add("uuid", user.getUniqueId().toString())
            );

            checks = new JObject();
            for (Map.Entry<Integer, String> node : this.view.getNodeEndings()) {
                String permission = prefix + node.getValue();
                checks.add(permission, checker.checkPermission(permission, CheckOrigin.INTERNAL).result().name().toLowerCase(Locale.ROOT));
            }
        } else {
            checks = null;
        }

        JsonObject payload = new JObject()
                .add("metadata", metadata)
                .add("data", new JObject()
                        .add("tree", jsonTree)
                        .consume(obj -> {
                            if (checks != null) {
                                obj.add("checkResults", checks);
                            }
                        })
                )
                .toJson();

        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        try (Writer writer = new OutputStreamWriter(new GZIPOutputStream(bytesOut), StandardCharsets.UTF_8)) {
            GsonProvider.normal().toJson(payload, writer);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return bytebin.postContent(bytesOut.toByteArray(), AbstractHttpClient.JSON_TYPE).key();
    }
Uploads the data contained in this TreeView and returns the id.

@param bytebin the bytebin instance to upload to
@param sender the sender
@param user the reference user, or null
@param checker the permission data instance to check against, or null
@return the id, or null
common/src/main/java/me/lucko/luckperms/common/treeview/TreeView.java