2 Web API
Jesse Boyd edited this page 2016-11-02 04:12:21 +11:00

FAWE allows you to upload or download schematics from a compatible and configured webserver.

Relevant config options

web:
  # I am already hosting a web interface for you here
  url: "http://empcraft.com/fawe/"

Website software

https://github.com/boy0001/plotupload + custom style

Uploading a clipboard

If it returns null, it indicates the upload was unsuccessful.

URL url = FaweAPI.upload(clipboard, format);

Downloading:

URL base = new URL(Settings.WEB.URL);
URL url = new URL(base, "uploads/" + uuid + ".schematic");
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
InputStream in = Channels.newInputStream(rbc);
// Load and paste the stream (assuming it's a schematic format) etc.
EditSession editSession = ClipboardFormat.SCHEMATIC.load(in).paste(world, position, allowUndo, !noAir, (Transform) null);