Correctly unwrap old CommandExceptions in AsyncCommandBuilder.

This commit is contained in:
wizjany 2019-06-13 14:35:00 -04:00
parent 7787f2c15e
commit 6e833a9fe4
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.command.util; package com.sk89q.worldedit.command.util;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.ListeningExecutorService;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
@ -142,6 +143,9 @@ public final class AsyncCommandBuilder<T> {
try { try {
if (exceptionConverter != null) { if (exceptionConverter != null) {
try { try {
if (orig instanceof com.sk89q.minecraft.util.commands.CommandException) {
throw new CommandExecutionException(orig, ImmutableList.of());
}
exceptionConverter.convert(orig); exceptionConverter.convert(orig);
throw orig; throw orig;
} catch (CommandException converted) { } catch (CommandException converted) {

View File

@ -79,7 +79,7 @@ public abstract class PaginationBox extends MessageBox {
public Component create(int page) throws InvalidComponentException { public Component create(int page) throws InvalidComponentException {
if (page == 1 && getComponentsSize() == 0) { if (page == 1 && getComponentsSize() == 0) {
return getContents().reset().append("There's nothing to see here").create(); return getContents().reset().append("No results found.").create();
} }
int pageCount = (int) Math.ceil(getComponentsSize() / (double) componentsPerPage); int pageCount = (int) Math.ceil(getComponentsSize() / (double) componentsPerPage);
if (page < 1 || page > pageCount) { if (page < 1 || page > pageCount) {