Record source
This commit is contained in:
parent
c683b414ba
commit
fa7fc22398
@ -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());
|
||||
|
@ -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 {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user