@Override public void onFailure(@Nullable Throwable throwable) { try { exceptionConverter.convert(throwable); } catch (CommandException e) { String failure = this.failure != null ? this.failure : "An error occurred"; String message = e.getMessage() != null ? e.getMessage() : "An unknown error occurred. Please see the console!"; sender.printError(failure + ": " + message); } }
exceptionConverter.convert(next); next = next.getCause(); } while (next != null);
WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); return null;
@Override public Object call(CommandArgs args, CommandLocals locals) throws CommandException { if (!testPermission(locals)) { throw new CommandPermissionsException(); } RegionFactory regionFactory = regionFactoryParser.call(args, locals); int radius = radiusCommand.call(args, locals).intValue(); Contextual<? extends Operation> factory = delegate.call(args, locals); Player player = (Player) locals.get(Actor.class); LocalSession session = WorldEdit.getInstance().getSessionManager().get(player); try { WorldEdit.getInstance().checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new OperationFactoryBrush(factory, regionFactory), permission); } catch (MaxBrushRadiusException | InvalidToolBindException e) { WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); } player.print("Set brush to " + factory); return true; }