mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-18 01:46:11 +00:00
Pass the exception converter through more.
This commit is contained in:
parent
9c3964d330
commit
d80ac24c63
@ -44,4 +44,9 @@ public class DelegateEntity implements Entity {
|
||||
public <T> T getFacet(Class<? extends T> cls) {
|
||||
return parent.getFacet(cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
return parent.setLocation(location);
|
||||
}
|
||||
}
|
||||
|
@ -2286,4 +2286,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -127,4 +127,9 @@ public class MCAWorld implements SimpleWorld {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return queue.getWEWorld().getSpawnPosition();
|
||||
}
|
||||
}
|
||||
|
@ -163,5 +163,10 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
public <T> T getFacet(final Class<? extends T> cls) {
|
||||
return this.entity.getFacet(cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
return this.entity.setLocation(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,5 +161,11 @@ public abstract class FaweClipboard {
|
||||
public Extent getExtent() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
//Should not be teleporting this entity
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -640,4 +640,10 @@ public class SchemVis extends ImmutableVirtualWorld {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -304,4 +304,10 @@ public class FakePlayer extends AbstractPlayerActor {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
this.pos = location;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -420,4 +420,9 @@ public class PlayerWrapper extends AbstractPlayerActor {
|
||||
public File openFileSaveDialog(String[] extensions) {
|
||||
return parent.openFileSaveDialog(extensions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setLocation(Location location) {
|
||||
return parent.setLocation(location);
|
||||
}
|
||||
}
|
||||
|
@ -259,4 +259,9 @@ public class WorldWrapper extends AbstractWorld {
|
||||
public boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException {
|
||||
return parent.notifyAndLightBlock(position, previousType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return parent.getSpawnPosition();
|
||||
}
|
||||
}
|
||||
|
@ -3604,4 +3604,9 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
return world.notifyAndLightBlock(position, previousType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector3 getSpawnPosition() {
|
||||
return world.getSpawnPosition();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class WorldEditCommands {
|
||||
@CommandPermissions("worldedit.debugpaste")
|
||||
public void debugpaste(Actor actor) throws WorldEditException, IOException {
|
||||
// BBC.DOWNLOAD_LINK.send(actor, HastebinUtility.debugPaste());
|
||||
ActorCallbackPaste.pastebin(we.getSupervisor(), actor, null, "FastAsyncWorldEdit report: " + BBC.DOWNLOAD_LINK);
|
||||
ActorCallbackPaste.pastebin(we.getSupervisor(), actor, null, "FastAsyncWorldEdit report: " + BBC.DOWNLOAD_LINK, WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter());
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
|
||||
import com.sk89q.worldedit.util.task.FutureForwardingTask;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -35,17 +36,20 @@ public class AsyncCommandHelper {
|
||||
private final ListenableFuture<?> future;
|
||||
private final Supervisor supervisor;
|
||||
private final Actor sender;
|
||||
private final ExceptionConverter exceptionConverter;
|
||||
@Nullable
|
||||
private Object[] formatArgs;
|
||||
|
||||
private AsyncCommandHelper(ListenableFuture<?> future, Supervisor supervisor, Actor sender) {
|
||||
private AsyncCommandHelper(ListenableFuture<?> future, Supervisor supervisor, Actor sender, ExceptionConverter exceptionConverter) {
|
||||
checkNotNull(future);
|
||||
checkNotNull(supervisor);
|
||||
checkNotNull(sender);
|
||||
checkNotNull(exceptionConverter);
|
||||
|
||||
this.future = future;
|
||||
this.supervisor = supervisor;
|
||||
this.sender = sender;
|
||||
this.exceptionConverter = exceptionConverter;
|
||||
}
|
||||
|
||||
public AsyncCommandHelper formatUsing(Object... args) {
|
||||
@ -78,6 +82,7 @@ public class AsyncCommandHelper {
|
||||
Futures.addCallback(
|
||||
future,
|
||||
new MessageFutureCallback.Builder(sender)
|
||||
.exceptionConverter(exceptionConverter)
|
||||
.onSuccess(format(success))
|
||||
.onFailure(format(failure))
|
||||
.build());
|
||||
@ -89,6 +94,7 @@ public class AsyncCommandHelper {
|
||||
Futures.addCallback(
|
||||
future,
|
||||
new MessageFutureCallback.Builder(sender)
|
||||
.exceptionConverter(exceptionConverter)
|
||||
.onFailure(format(failure))
|
||||
.build());
|
||||
return this;
|
||||
@ -128,8 +134,8 @@ public class AsyncCommandHelper {
|
||||
return this;
|
||||
}
|
||||
|
||||
public static AsyncCommandHelper wrap(ListenableFuture<?> future, Supervisor supervisor, Actor sender) {
|
||||
return new AsyncCommandHelper(future, supervisor, sender);
|
||||
public static AsyncCommandHelper wrap(ListenableFuture<?> future, Supervisor supervisor, Actor sender, ExceptionConverter exceptionConverter) {
|
||||
return new AsyncCommandHelper(future, supervisor, sender, exceptionConverter);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.sk89q.worldedit.command.util.AsyncCommandHelper;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
|
||||
import java.net.URL;
|
||||
@ -46,10 +47,10 @@ public class ActorCallbackPaste {
|
||||
* @param content The content
|
||||
* @param successMessage The message, formatted with {@link String#format(String, Object...)} on success
|
||||
*/
|
||||
public static void pastebin(Supervisor supervisor, final Actor sender, String content, final String successMessage) {
|
||||
public static void pastebin(Supervisor supervisor, final Actor sender, String content, final String successMessage, final ExceptionConverter exceptionConverter) {
|
||||
ListenableFuture<URL> future = new IncendoPaste("fastasyncworldedit").paste(content);
|
||||
|
||||
AsyncCommandHelper.wrap(future, supervisor, sender)
|
||||
AsyncCommandHelper.wrap(future, supervisor, sender, exceptionConverter)
|
||||
.registerWithSupervisor("Submitting content to a pastebin service...")
|
||||
.sendMessageAfterDelay("(Please wait... sending output to pastebin...)");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user