Small changes

This commit is contained in:
MattBDev
2019-06-26 20:14:00 -04:00
parent 1932c96d4f
commit d0a31691e1
61 changed files with 382 additions and 577 deletions

View File

@ -382,7 +382,7 @@ public class Fawe {
}
} catch (Throwable e) {
debug("====== MEMORY LISTENER ERROR ======");
MainUtil.handleError(e);
e.printStackTrace();
debug("===================================");
debug("FAWE needs access to the JVM memory system:");
debug(" - Change your Java security settings");

View File

@ -5,7 +5,6 @@ import com.boydti.fawe.configuration.MemorySection;
import com.boydti.fawe.configuration.file.YamlConfiguration;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RunnableVal3;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.chat.Message;
import com.google.gson.Gson;
@ -472,7 +471,7 @@ public enum BBC {
yml.save(file);
}
} catch (final Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}

View File

@ -10,7 +10,6 @@ import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.RunnableVal2;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.LightingExtent;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.SetQueue;
import com.boydti.fawe.util.TaskManager;
@ -229,7 +228,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
try {
task.run();
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
}
@ -246,7 +245,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
try {
run.run();
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
}

View File

@ -1,17 +1,10 @@
package com.boydti.fawe.example;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> extends MappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> {
private final int maxY;
@ -104,7 +97,7 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
try {
refreshChunk(fc);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}

View File

@ -1,14 +1,13 @@
package com.boydti.fawe.object;
import com.boydti.fawe.object.visitor.FaweChunkVisitor;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.ArrayDeque;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ -121,7 +120,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
return BaseBlock.getFromInternalId(combined, tile).toImmutableState();
}
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return BlockState.getFromInternalId(combined);
}

View File

@ -1,7 +1,6 @@
package com.boydti.fawe.object;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.TaskManager;
public abstract class FaweCommand<T> {
@ -36,7 +35,7 @@ public abstract class FaweCommand<T> {
}
return true;
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return false;
}

View File

@ -42,6 +42,7 @@ import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.selector.CylinderRegionSelector;
import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.world.World;
@ -353,7 +354,7 @@ public abstract class FawePlayer<T> extends Metadatable {
}
} catch (Exception event) {
Fawe.debug("====== INVALID CLIPBOARD ======");
MainUtil.handleError(event);
event.printStackTrace();
Fawe.debug("===============---=============");
Fawe.debug("This shouldn't result in any failure");
Fawe.debug("File: " + file.getName() + " (len:" + file.length() + ")");
@ -560,19 +561,14 @@ public abstract class FawePlayer<T> extends Metadatable {
public void setSelection(Region region) {
RegionSelector selector;
switch (region.getClass().getName()) {
case "ConvexPolyhedralRegion":
selector = new ConvexPolyhedralRegionSelector((ConvexPolyhedralRegion) region);
break;
case "CylinderRegion":
selector = new CylinderRegionSelector((CylinderRegion) region);
break;
case "Polygonal2DRegion":
selector = new com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector((Polygonal2DRegion) region);
break;
default:
selector = new CuboidRegionSelector(null, region.getMinimumPoint(), region.getMaximumPoint());
break;
if (region instanceof ConvexPolyhedralRegion) {
selector = new ConvexPolyhedralRegionSelector((ConvexPolyhedralRegion) region);
} else if (region instanceof CylinderRegion) {
selector = new CylinderRegionSelector((CylinderRegion) region);
} else if (region instanceof Polygonal2DRegion) {
selector = new Polygonal2DRegionSelector((Polygonal2DRegion) region);
} else {
selector = new CuboidRegionSelector(null, region.getMinimumPoint(), region.getMaximumPoint());
}
selector.setWorld(region.getWorld());

View File

@ -77,7 +77,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
try {
return BlockState.getFromInternalId(combinedId4Data);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return BlockTypes.AIR.getDefaultState();
}
}
@ -100,7 +100,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
}
return block;
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
}

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.object.brush.heightmap;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.mask.Mask;
@ -14,21 +13,19 @@ import com.sk89q.worldedit.util.Location;
import java.util.concurrent.ThreadLocalRandom;
public interface HeightMap {
public double getHeight(int x, int z);
double getHeight(int x, int z);
public void setSize(int size);
void setSize(int size);
default void perform(EditSession session, Mask mask, BlockVector3 pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
int[][] data = generateHeightData(session, mask, pos, size, rotationMode, yscale, smooth, towards, layers);
applyHeightMapData(data, session, mask, pos, size, rotationMode, yscale, smooth, towards, layers);
applyHeightMapData(data, session, pos, size, yscale, smooth, towards, layers);
}
default void applyHeightMapData(int[][] data, EditSession session, Mask mask, BlockVector3 pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
default void applyHeightMapData(int[][] data, EditSession session, BlockVector3 pos, int size, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
BlockVector3 top = session.getMaximumPoint();
int maxY = top.getBlockY();
int diameter = 2 * size + 1;
int iterations = 1;
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size).toVector3());
BlockVector3 max = pos.add(size, maxY, size);
Region region = new CuboidRegion(session.getWorld(), min.toBlockPoint(), max);
@ -36,19 +33,16 @@ public interface HeightMap {
if (smooth) {
try {
HeightMapFilter filter = (HeightMapFilter) HeightMapFilter.class.getConstructors()[0].newInstance(GaussianKernel.class.getConstructors()[0].newInstance(5, 1));
int diameter = 2 * size + 1;
data[1] = filter.filter(data[1], diameter, diameter);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
try {
if (layers) {
heightMap.applyLayers(data[1]);
} else {
heightMap.apply(data[1]);
}
} catch (MaxChangedBlocksException e) {
throw e;
if (layers) {
heightMap.applyLayers(data[1]);
} else {
heightMap.apply(data[1]);
}
}
@ -59,22 +53,18 @@ public interface HeightMap {
int centerX = pos.getBlockX();
int centerZ = pos.getBlockZ();
int centerY = pos.getBlockY();
int endY = pos.getBlockY() + size;
int startY = pos.getBlockY() - size;
int[] oldData = new int[diameter * diameter];
int[] newData = new int[oldData.length];
if (layers) { // Pixel accuracy
centerY <<= 3;
maxY <<= 3;
}
// Vector mutablePos = new Vector(0, 0, 0);
if (towards) {
double sizePowInv = 1d / Math.pow(size, yscale);
int targetY = pos.getBlockY();
int tmpY = targetY;
for (int x = -size; x <= size; x++) {
int xx = centerX + x;
// mutablePos.mutX(xx);
for (int z = -size; z <= size; z++) {
int index = (z + size) * diameter + (x + size);
int zz = centerZ + z;
@ -118,7 +108,6 @@ public interface HeightMap {
int height = pos.getBlockY();
for (int x = -size; x <= size; x++) {
int xx = centerX + x;
// mutablePos.mutX(xx);
for (int z = -size; z <= size; z++) {
int index = (z + size) * diameter + (x + size);
int zz = centerZ + z;

View File

@ -13,13 +13,12 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@ -181,7 +180,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
if (osENTCF != null) osENTCF.flush();
if (osENTCT != null) osENTCT.flush();
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return flushed;
}
@ -218,7 +217,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
osENTCT = null;
}
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return flushed;
}
@ -418,7 +417,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
}
return summary;
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
return null;
@ -439,7 +438,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
fis.close();
gis.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
return new IntegerPair(ox, oz);

View File

@ -107,7 +107,7 @@ public abstract class FaweChangeSet implements ChangeSet {
}
}
} catch (InterruptedException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return true;
}
@ -194,7 +194,7 @@ public abstract class FaweChangeSet implements ChangeSet {
BaseBlock to = change.getCurrent();
add(loc, from, to);
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -222,7 +222,7 @@ public abstract class FaweChangeSet implements ChangeSet {
add(x, y, z, combinedFrom, combinedTo);
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -241,7 +241,7 @@ public abstract class FaweChangeSet implements ChangeSet {
add(x, y, z, combinedFrom, combinedTo);
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -343,7 +343,7 @@ public abstract class FaweChangeSet implements ChangeSet {
}
}
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
} finally {
if (FaweChangeSet.this.waitingCombined.decrementAndGet() <= 0) {
synchronized (FaweChangeSet.this.waitingAsync) {

View File

@ -320,7 +320,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
posDel.write(stream, x - originX, y, z - originZ);
idDel.writeChange(stream, combinedFrom, combinedTo);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -340,7 +340,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
os.writeVarInt(from.getInternalId());
os.writeVarInt(to.getInternalId());
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -353,7 +353,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
NBTOutputStream nbtos = getTileCreateOS();
nbtos.writeTag(tag);
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -366,7 +366,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
NBTOutputStream nbtos = getTileRemoveOS();
nbtos.writeTag(tag);
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -379,7 +379,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
NBTOutputStream nbtos = getEntityRemoveOS();
nbtos.writeTag(tag);
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -392,7 +392,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
NBTOutputStream nbtos = getEntityCreateOS();
nbtos.writeTag(tag);
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -415,12 +415,12 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
} catch (EOFException ignored) {
} catch (Exception e) {
e.printStackTrace();
MainUtil.handleError(e);
e.printStackTrace();
}
try {
is.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -470,12 +470,12 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
} catch (EOFException ignored) {
} catch (Exception e) {
e.printStackTrace();
MainUtil.handleError(e);
e.printStackTrace();
}
try {
is.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -530,12 +530,12 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
} catch (EOFException ignored) {
} catch (Exception e) {
e.printStackTrace();
MainUtil.handleError(e);
e.printStackTrace();
}
try {
is.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -562,7 +562,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
};
}
public Iterator<MutableEntityChange> getEntityIterator(final NBTInputStream is, final boolean create, final boolean dir) {
public Iterator<MutableEntityChange> getEntityIterator(final NBTInputStream is, final boolean create) {
if (is == null) {
return new ArrayList<MutableEntityChange>().iterator();
}
@ -580,7 +580,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
try {
is.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -606,12 +606,12 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
}
};
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
return null;
}
}
public Iterator<MutableTileChange> getTileIterator(final NBTInputStream is, final boolean create, final boolean dir) {
public Iterator<MutableTileChange> getTileIterator(final NBTInputStream is, final boolean create) {
if (is == null) {
return new ArrayList<MutableTileChange>().iterator();
}
@ -629,7 +629,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
try {
is.close();
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -655,7 +655,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
}
};
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
return null;
}
}
@ -663,11 +663,11 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
public Iterator<Change> getIterator(final boolean dir) {
close();
try {
final Iterator<MutableTileChange> tileCreate = getTileIterator(getTileCreateIS(), true, dir);
final Iterator<MutableTileChange> tileRemove = getTileIterator(getTileRemoveIS(), false, dir);
final Iterator<MutableTileChange> tileCreate = getTileIterator(getTileCreateIS(), true);
final Iterator<MutableTileChange> tileRemove = getTileIterator(getTileRemoveIS(), false);
final Iterator<MutableEntityChange> entityCreate = getEntityIterator(getEntityCreateIS(), true, dir);
final Iterator<MutableEntityChange> entityRemove = getEntityIterator(getEntityRemoveIS(), false, dir);
final Iterator<MutableEntityChange> entityCreate = getEntityIterator(getEntityCreateIS(), true);
final Iterator<MutableEntityChange> entityRemove = getEntityIterator(getEntityRemoveIS(), false);
final Iterator<MutableBlockChange> blockChange = getBlockIterator(dir);
@ -709,7 +709,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
}
};
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return new ArrayList<Change>().iterator();
}

View File

@ -9,9 +9,9 @@ import com.boydti.fawe.util.MainUtil;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.worldedit.world.World;
import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
/**
* ChangeSet optimized for low memory usage
@ -66,7 +66,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
if (tileRStream != null) tileRStreamZip.flush();
return true;
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
return false;
@ -115,7 +115,7 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
}
return true;
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
return false;
@ -248,6 +248,6 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
@Override
public void setRecordChanges(boolean recordChanges) {
// TODO Auto-generated method stub
}
}

View File

@ -78,9 +78,9 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
this.braf = new RandomAccessFile(file, "rw");
braf.setLength(file.length());
init();
width = (int) mbb.getChar(2);
height = (int) mbb.getChar(4);
length = (int) mbb.getChar(6);
width = mbb.getChar(2);
height = mbb.getChar(4);
length = mbb.getChar(6);
area = width * length;
this.volume = length * width * height;
@ -180,7 +180,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
clipboard.setOrigin(BlockVector3.at(ox, oy, oz));
return clipboard;
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return null;
}
@ -204,7 +204,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
file.createNewFile();
}
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
this.braf = new RandomAccessFile(file, "rw");
long volume = (long) width * (long) height * (long) length * 4L + (long) HEADER_SIZE;
@ -229,7 +229,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
mbb.putShort(10, (short) offset.getBlockY());
mbb.putShort(12, (short) offset.getBlockZ());
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -252,7 +252,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
mbb.putChar(4, (char) height);
mbb.putChar(6, (char) length);
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -289,7 +289,6 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
System.gc();
}
}
cb = null;
}
@Override
@ -311,7 +310,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
braf = null;
}
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -350,7 +349,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
}
}
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -441,7 +440,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
} catch (IndexOutOfBoundsException ignore) {
} catch (Exception e) {
e.printStackTrace();
MainUtil.handleError(e);
e.printStackTrace();
}
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
@ -480,7 +479,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
return base;
} catch (IndexOutOfBoundsException ignore) {
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return BlockTypes.AIR.getDefaultState().toBaseBlock();
}
@ -501,13 +500,13 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
int index = (HEADER_SIZE) + ((getIndex(x, y, z) << 2));
int combined = block.getInternalId();
mbb.putInt(index, combined);
boolean hasNbt = block instanceof BaseBlock && ((BaseBlock)block).hasNbtData();
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
if (hasNbt) {
setTile(x, y, z, block.getNbtData());
}
return true;
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return false;
}
@ -528,7 +527,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
}
return true;
} catch (Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
return false;
}

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.util;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import java.lang.reflect.Field;
public class ExtentTraverser<T extends Extent> {
@ -75,7 +76,7 @@ public class ExtentTraverser<T extends Extent> {
}
return null;
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return null;
}
}
@ -91,7 +92,7 @@ public class ExtentTraverser<T extends Extent> {
}
return null;
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return null;
}
}

View File

@ -609,18 +609,12 @@ public class MainUtil {
return newFile;
}
} catch (IOException e) {
MainUtil.handleError(e);
e.printStackTrace();
Fawe.debug("&cCould not save " + resource);
}
return null;
}
public static void handleError(Throwable e) {
if (e == null) {
return;
}
e.printStackTrace(); }
public static int[] regionNameToCoords(String fileName) {
int[] res = new int[2];
int len = fileName.length() - 4;

View File

@ -150,7 +150,7 @@ public class ReflectionUtils {
m.setAccessible(true);
return (Map<T, V>) m.get(map);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return map;
}
}
@ -163,7 +163,7 @@ public class ReflectionUtils {
m.setAccessible(true);
return (List<T>) m.get(list);
} catch (Throwable e) {
MainUtil.handleError(e);
e.printStackTrace();
return list;
}
}

View File

@ -5,6 +5,7 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.sk89q.worldedit.world.World;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -273,7 +274,7 @@ public class SetQueue {
} catch (Throwable e) {
pool.awaitQuiescence(Settings.IMP.QUEUE.DISCARD_AFTER_MS, TimeUnit.MILLISECONDS);
completer = new ExecutorCompletionService(pool);
MainUtil.handleError(e);
e.printStackTrace();
} finally {
queue.endSet(Settings.IMP.QUEUE.PARALLEL_THREADS > 1);
queue.setStage(QueueStage.NONE);

View File

@ -4,15 +4,16 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.RunnableVal;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import javax.annotation.Nullable;
public abstract class TaskManager {
@ -283,7 +284,7 @@ public abstract class TaskManager {
}
}
} catch (InterruptedException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}
@ -330,7 +331,7 @@ public abstract class TaskManager {
} catch (RuntimeException e) {
this.value = e;
} catch (Throwable neverHappens) {
MainUtil.handleError(neverHappens);
neverHappens.printStackTrace();
} finally {
running.set(false);
}
@ -347,7 +348,7 @@ public abstract class TaskManager {
}
}
} catch (InterruptedException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
if (run.value != null) {
throw run.value;
@ -382,7 +383,7 @@ public abstract class TaskManager {
} catch (RuntimeException e) {
this.value = e;
} catch (Throwable neverHappens) {
MainUtil.handleError(neverHappens);
neverHappens.printStackTrace();
} finally {
running.set(false);
synchronized (function) {
@ -399,7 +400,7 @@ public abstract class TaskManager {
}
}
} catch (InterruptedException e) {
MainUtil.handleError(e);
e.printStackTrace();
}
if (run.value instanceof RuntimeException) {
throw (RuntimeException) run.value;

View File

@ -14,9 +14,9 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
public class WEManager {
@ -33,7 +33,7 @@ public class WEManager {
field.set(parent, new NullExtent((Extent) field.get(parent), reason));
}
} catch (final Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
throw new FaweException(reason);
}
@ -189,7 +189,7 @@ public class WEManager {
}), 2);
});
} catch (final Exception e) {
MainUtil.handleError(e);
e.printStackTrace();
}
}, false, false);
}