3 Clipboard API
Jesse Boyd edited this page 2017-02-23 15:22:37 +11:00

With FAWE installed, you can register a new ClipboardFormat through the API

 // (name of format, aliases...)
ClipboardFormat.addFormat(new AbstractClipboardFormat("CUSTOM", "custom") {
    @Override
    public ClipboardReader getReader(InputStream inputStream) throws IOException {
        return new yourCustomClipboardReader();
    }

    @Override
    public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
        return new yourCustomClipboardWriter();
    }

    @Override
    public boolean isFormat(File file) {
        // Return true if this file is using the format (usually just check the extension)
        return file.getName().endsWith(".custom");
    }

    @Override
    public String getExtension() {
        return "custom";
    }
});

The format will then be usable ingame: //schem load <format> <file>