Record source

This commit is contained in:
Jesse Boyd 2018-08-11 15:06:02 +10:00
parent c683b414ba
commit fa7fc22398
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 16 additions and 7 deletions

View File

@ -338,7 +338,9 @@ public class SchematicCommands extends MethodCommands {
} else {
target = clipboard;
}
if (new PlayerSaveClipboardEvent(player, clipboard, f.toURI()).call()) {
URI uri = null;
if (holder instanceof URIClipboardHolder) uri = ((URIClipboardHolder) holder).getURI(clipboard);
if (new PlayerSaveClipboardEvent(player, clipboard, uri, f.toURI()).call()) {
try (ClipboardWriter writer = format.getWriter(fos)) {
if (writer instanceof StructureFormat) {
((StructureFormat) writer).write(target, holder.getWorldData(), player.getName());

View File

@ -21,11 +21,13 @@ package com.sk89q.worldedit.event.extent;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.event.Cancellable;
import com.sk89q.worldedit.event.Event;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import java.net.URI;
import static com.sk89q.worldedit.EditSession.Stage;
public class PasteEvent extends FaweEvent {

View File

@ -11,13 +11,14 @@ import java.net.URI;
public class PlayerSaveClipboardEvent extends FaweEvent {
private final Player player;
private final Clipboard clipboard;
private final URI uri;
private final URI source, destination;
private boolean cancelled;
public PlayerSaveClipboardEvent(Player player, Clipboard clipboard, URI destination) {
public PlayerSaveClipboardEvent(Player player, Clipboard clipboard, URI source, URI destination) {
this.player = player;
this.clipboard = clipboard;
this.uri = destination;
this.source = source;
this.destination = destination;
}
@Override
@ -30,8 +31,12 @@ public class PlayerSaveClipboardEvent extends FaweEvent {
this.cancelled = cancelled;
}
public URI getUri() {
return uri;
public URI getSourceURI() {
return source;
}
public URI getDestinationURI() {
return destination;
}
public Clipboard getClipboard() {