This commit is contained in:
Jesse Boyd
2020-01-04 10:12:33 +00:00
66 changed files with 878 additions and 862 deletions

View File

@ -1,7 +1,6 @@
package com.boydti.fawe;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.brush.visualization.VisualQueue;
import com.boydti.fawe.regions.general.integrations.plotquared.PlotSquaredFeature;

View File

@ -1,8 +1,6 @@
package com.boydti.fawe;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.object.changeset.DiskStorageHistory;
@ -31,6 +29,7 @@ import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.world.World;
import java.io.File;
import java.io.IOException;
@ -152,13 +151,12 @@ public class FaweAPI {
* Remember to commit when you're done!<br>
*
* @param world The name of the world
* @param autoqueue If it should start dispatching before you enqueue it.
* @return
* @see IQueueExtent#enqueue()
* @param autoQueue If it should start dispatching before you enqueue it.
* @return the queue extent
*/
public static IQueueExtent createQueue(World world, boolean autoqueue) {
public static IQueueExtent createQueue(World world, boolean autoQueue) {
IQueueExtent queue = Fawe.get().getQueueHandler().getQueue(world);
if (!autoqueue) {
if (!autoQueue) {
queue.disableQueue();
}
return queue;
@ -189,10 +187,9 @@ public class FaweAPI {
/**
* Just forwards to ClipboardFormat.SCHEMATIC.load(file)
*
* @param file
* @return
* @param file the file to load
* @return a clipboard containing the schematic
* @see ClipboardFormat
* @see Schematic
*/
public static Clipboard load(File file) throws IOException {
return ClipboardFormats.findByFile(file).load(file);

View File

@ -4,11 +4,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.beta.Trimable;
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.collection.BitArray4096;
import com.boydti.fawe.object.collection.CleanableThreadLocal;
@ -18,6 +13,9 @@ import com.boydti.fawe.object.exception.FaweChunkLoadException;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.IOUtil;
import com.boydti.fawe.util.MathMan;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
@ -34,6 +32,7 @@ import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import java.lang.reflect.Field;
import java.util.ArrayList;
@ -192,7 +191,7 @@ public enum FaweCache implements Trimable {
} else {
pool = cache::get;
}
Pool previous = REGISTERED_POOLS.putIfAbsent(clazz, pool);
Pool<T> previous = REGISTERED_POOLS.putIfAbsent(clazz, pool);
if (previous != null) {
throw new IllegalStateException("Previous key");
}

View File

@ -1,9 +1,7 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor;
import com.sk89q.jnbt.CompoundTag;
@ -68,10 +66,18 @@ public interface IBatchProcessor {
}
}
}
for (int layer = (minY - 15) >> 4; layer < (maxY + 15) >> 4; layer++) {
if (set.hasSection(layer)) {
return true;
try {
int layer = (minY - 15) >> 4;
while (layer < (maxY + 15) >> 4) {
if (set.hasSection(layer)) {
return true;
}
layer++;
}
} catch (ArrayIndexOutOfBoundsException exception) {
Fawe.imp().debug("minY = " + minY);
Fawe.imp().debug("layer = " + ((minY - 15) >> 4));
exception.printStackTrace();
}
return false;
}

View File

@ -8,12 +8,9 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockRegistry;
import java.io.IOException;
import java.util.Map;
import java.util.Set;

View File

@ -10,7 +10,7 @@ public interface IQueueChunk<T extends Future<T>> extends IChunk, Callable<T> {
* @return
*/
@Override
default IQueueChunk reset() {
default IQueueChunk<T> reset() {
init(null, getX(), getZ());
return this;
}

View File

@ -4,13 +4,10 @@ import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.object.collection.MemBlockSet;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

View File

@ -1,9 +1,11 @@
package com.boydti.fawe.beta.implementation.blocks;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkSet;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import org.jetbrains.annotations.Range;
public abstract class CharBlocks implements IBlocks {
@ -66,7 +68,7 @@ public abstract class CharBlocks implements IBlocks {
return null;
}
public void reset(int layer) {
public void reset(@Range(from = 0, to = 15) int layer) {
sections[layer] = EMPTY;
}
@ -81,12 +83,12 @@ public abstract class CharBlocks implements IBlocks {
}
@Override
public boolean hasSection(int layer) {
public boolean hasSection(@Range(from = 0, to = 15) int layer) {
return sections[layer] == FULL;
}
@Override
public char[] load(int layer) {
public char[] load(@Range(from = 0, to = 15) int layer) {
return sections[layer].get(this, layer);
}
@ -104,18 +106,24 @@ public abstract class CharBlocks implements IBlocks {
public void set(int x, int y, int z, char value) {
final int layer = y >> 4;
final int index = (y & 15) << 8 | z << 4 | x;
set(layer, index, value);
try {
set(layer, index, value);
} catch (ArrayIndexOutOfBoundsException exception) {
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
Fawe.imp().debug("Layer variable was = " + layer);
exception.printStackTrace();
}
}
/*
Section
*/
public final char get(int layer, int index) {
public final char get(@Range(from = 0, to = 15)int layer, int index) {
return sections[layer].get(this, layer, index);
}
public final void set(int layer, int index, char value) {
public final void set(@Range(from = 0, to = 15) int layer, int index, char value) throws ArrayIndexOutOfBoundsException {
sections[layer].set(this, layer, index, value);
}

View File

@ -207,8 +207,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
}
@Override
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
BlockStateHolder block) {
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
return chunk.chunkSet.setBlock(x, y, z, block);
}
@ -250,16 +249,14 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
}
@Override
public boolean setBiome(ChunkHolder chunk, int x, int y, int z,
BiomeType biome) {
public boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome) {
chunk.getOrCreateSet();
chunk.delegate = SET;
return chunk.setBiome(x, y, z, biome);
}
@Override
public boolean setBlock(ChunkHolder chunk, int x, int y, int z,
BlockStateHolder block) {
public boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder block) {
chunk.getOrCreateSet();
chunk.delegate = SET;
return chunk.setBlock(x, y, z, block);
@ -471,11 +468,9 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
IChunkGet get(ChunkHolder chunk);
IChunkSet set(ChunkHolder chunk);
boolean setBiome(ChunkHolder chunk, int x, int y, int z,
BiomeType biome);
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
boolean setBlock(ChunkHolder chunk, int x, int y, int z,
BlockStateHolder holder);
boolean setBlock(ChunkHolder chunk, int x, int y, int z, BlockStateHolder holder);
BiomeType getBiome(ChunkHolder chunk, int x, int y, int z);

View File

@ -33,8 +33,8 @@ import java.util.concurrent.Future;
*/
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
// Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
// Chunks currently being queued / worked on
private final Long2ObjectLinkedOpenHashMap<IQueueChunk> chunks = new Long2ObjectLinkedOpenHashMap<>();

View File

@ -15,7 +15,7 @@ public class Settings extends Config {
@Ignore
public boolean PROTOCOL_SUPPORT_FIX = false;
@Ignore
public boolean PLOTSQUARED_HOOK = true;
public boolean PLOTSQUARED_HOOK = false;
@Comment("These first 6 aren't configurable") // This is a comment
@Final // Indicates that this value isn't configurable

View File

@ -48,7 +48,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
private @Language("SQLite") String GET_EDITS_USER = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` DESC, `id` DESC";
private @Language("SQLite") String GET_EDITS_USER_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? AND `player`=? ORDER BY `time` ASC, `id` ASC";
private @Language("SQLite") String GET_EDITS = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` DESC, `id` DESC";
private @Language("SQLite") String GET_EDITS_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` ASC, `id` ASC";
private @Language("SQLite") String GET_EDITS_ASC = "SELECT * FROM `{0}edits` WHERE `time`>? AND `x2`>=? AND `x1`<=? AND `z2`>=? AND `z1`<=? AND `y2`>=? AND `y1`<=? ORDER BY `time` , `id` ";
private @Language("SQLite") String GET_EDIT_USER = "SELECT * FROM `{0}edits` WHERE `player`=? AND `id`=?";
private @Language("SQLite") String DELETE_EDITS_USER = "DELETE FROM `{0}edits` WHERE `player`=? AND `time`>? AND `x2`>=? AND `x1`<=? AND `y2`>=? AND `y1`<=? AND `z2`>=? AND `z1`<=?";

View File

@ -51,7 +51,7 @@ public class MCAChunk implements IChunk {
public final char[] blocks = new char[65536];
public final BlockVector3ChunkMap<CompoundTag> tiles = new BlockVector3ChunkMap<CompoundTag>();
public final BlockVector3ChunkMap<CompoundTag> tiles = new BlockVector3ChunkMap<>();
public final Map<UUID, CompoundTag> entities = new HashMap<>();
public long inhabitedTime = System.currentTimeMillis();
public long lastUpdate;
@ -142,7 +142,7 @@ public class MCAChunk implements IChunk {
for (Map.Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
Property property = type.getProperty(key);
Property<Object> property = type.getProperty(key);
state = state.with(property, property.getValueFor(value));
}
}
@ -246,8 +246,8 @@ public class MCAChunk implements IChunk {
int type = NBTConstants.TYPE_BYTE_ARRAY;
out.writeNamedTagName("Biomes", type);
out.writeInt(biomes.length);
for (int i = 0; i < biomes.length; i++) {
out.write(biomes[i].getLegacyId());
for (BiomeType biome : biomes) {
out.write(biome.getLegacyId());
}
}
int len = 0;
@ -430,9 +430,7 @@ public class MCAChunk implements IChunk {
if (tile != null) {
tiles.put(x, y, z, tile);
} else {
if (tiles.remove(x, y, z) == null) {
return false;
}
return tiles.remove(x, y, z) != null;
}
return true;
}
@ -520,18 +518,14 @@ public class MCAChunk implements IChunk {
@Override
public void setBlocks(int layer, char[] data) {
int offset = layer << 12;
for (int i = 0; i < 4096; i++) {
blocks[offset + i] = data[i];
}
System.arraycopy(data, 0, blocks, offset, 4096);
}
@Override
public char[] load(int layer) {
char[] tmp = FaweCache.IMP.SECTION_BITS_TO_CHAR.get();
int offset = layer << 12;
for (int i = 0; i < 4096; i++) {
tmp[i] = blocks[offset + i];
}
System.arraycopy(blocks, offset, tmp, 0, 4096);
return tmp;
}

View File

@ -34,6 +34,7 @@ import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.IntStream;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
@ -397,10 +398,8 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
}
public List<MCAChunk> getCachedChunks() {
int size = 0;
for (int i = 0; i < chunks.length; i++) {
if (chunks[i] != null && this.chunkInitialized[i]) size++;
}
int size = (int) IntStream.range(0, chunks.length)
.filter(i -> chunks[i] != null && this.chunkInitialized[i]).count();
ArrayList<MCAChunk> list = new ArrayList<>(size);
for (int i = 0; i < chunks.length; i++) {
MCAChunk chunk = chunks[i];

View File

@ -13,6 +13,7 @@ import com.boydti.fawe.beta.implementation.filter.block.MultiFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.jnbt.anvil.MCAChunk;
import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweOutputStream;
@ -51,7 +52,6 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.util.Location;
@ -66,7 +66,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
@ -1548,9 +1547,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
public void setHeights(int value) {
heights.record(() -> {
Arrays.fill(heights.get(), (byte) value);
});
heights.record(() -> Arrays.fill(heights.get(), (byte) value));
}
@Override

View File

@ -18,6 +18,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.io.Closeable;
import java.util.Collection;
import java.util.Iterator;
import org.jetbrains.annotations.NotNull;
/**
* Best used when clipboard selections are small, or using legacy formats
@ -42,12 +43,12 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
* The locations provided are relative to the clipboard min
*
* @param task
* @param air
*/
public abstract void streamBiomes(IntValueReader task);
public abstract Collection<CompoundTag> getTileEntities();
@Override
public void close() {}
public void flush() {}
@ -57,6 +58,7 @@ public abstract class LinearClipboard extends SimpleClipboard implements Clipboa
close();
}
@NotNull
@Override
public Iterator<BlockVector3> iterator() {
return iterator(Order.YZX);

View File

@ -9,8 +9,6 @@ import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
/**

View File

@ -1,8 +1,5 @@
package com.boydti.fawe.object.collection;
import java.util.function.Function;
import java.util.function.Supplier;
public class VariableThreadLocal extends CleanableThreadLocal<byte[]> {
public VariableThreadLocal() {
super(() -> null);

View File

@ -6,7 +6,6 @@ import java.io.RandomAccessFile;
import java.io.Writer;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Iterator;
/**
@ -156,10 +155,8 @@ public class FastByteArrayOutputStream extends OutputStream {
public void writeTo(OutputStream out) throws IOException {
// Check if we have a list of buffers
if (buffers != null) {
Iterator iter = buffers.iterator();
while (iter.hasNext()) {
byte[] bytes = (byte[]) iter.next();
for (byte[] bytes : buffers) {
out.write(bytes, 0, blockSize);
}
}
@ -171,10 +168,8 @@ public class FastByteArrayOutputStream extends OutputStream {
public void writeTo(RandomAccessFile out) throws IOException {
// Check if we have a list of buffers
if (buffers != null) {
Iterator iter = buffers.iterator();
while (iter.hasNext()) {
byte[] bytes = (byte[]) iter.next();
for (byte[] bytes : buffers) {
out.write(bytes, 0, blockSize);
}
}
@ -231,4 +226,4 @@ public class FastByteArrayOutputStream extends OutputStream {
size = 0;
buffers.clear();
}
}
}

View File

@ -5,6 +5,7 @@ import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UTFDataFormatException;
import org.jetbrains.annotations.NotNull;
public class LittleEndianOutputStream extends FilterOutputStream implements DataOutput {
@ -18,7 +19,7 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
* output stream specified by the out argument.
*
* @param out the underlying output stream.
* @see java.io.FilterOutputStream#out
* @see FilterOutputStream#out
*/
public LittleEndianOutputStream(OutputStream out) {
super(out);
@ -27,24 +28,26 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
/**
* Writes the specified byte value to the underlying output stream.
*
* @param b the <code>byte</code> value to be written.
* @param b the {@code byte} value to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public synchronized void write(int b) throws IOException {
out.write(b);
written++;
}
/**
* Writes <code>length</code> bytes from the specified byte array
* starting at <code>offset</code> to the underlying output stream.
* Writes {@code length} bytes from the specified byte array
* starting at {@code offset} to the underlying output stream.
*
* @param data the data.
* @param offset the start offset in the data.
* @param length the number of bytes to write.
* @exception IOException if the underlying stream throws an IOException.
*/
public synchronized void write(byte[] data, int offset, int length)
@Override
public synchronized void write(@NotNull byte[] data, int offset, int length)
throws IOException {
out.write(data, offset, length);
written += length;
@ -52,13 +55,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
/**
* Writes a <code>boolean</code> to the underlying output stream as
* Writes a {@code boolean} to the underlying output stream as
* a single byte. If the argument is true, the byte value 1 is written.
* If the argument is false, the byte value <code>0</code> in written.
* If the argument is false, the byte value {@code 0} in written.
*
* @param b the <code>boolean</code> value to be written.
* @param b the {@code boolean} value to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeBoolean(boolean b) throws IOException {
if (b) this.write(1);
@ -67,23 +71,25 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
}
/**
* Writes out a <code>byte</code> to the underlying output stream
* Writes out a {@code byte} to the underlying output stream
*
* @param b the <code>byte</code> value to be written.
* @param b the {@code byte} value to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeByte(int b) throws IOException {
out.write(b);
written++;
}
/**
* Writes a two byte <code>short</code> to the underlying output stream in
* Writes a two byte {@code short} to the underlying output stream in
* little endian order, low byte first.
*
* @param s the <code>short</code> to be written.
* @param s the {@code short} to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeShort(int s) throws IOException {
out.write(s & 0xFF);
@ -93,12 +99,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
}
/**
* Writes a two byte <code>char</code> to the underlying output stream
* Writes a two byte {@code char} to the underlying output stream
* in little endian order, low byte first.
*
* @param c the <code>char</code> value to be written.
* @param c the {@code char} value to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeChar(int c) throws IOException {
out.write(c & 0xFF);
@ -108,12 +115,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
}
/**
* Writes a four-byte <code>int</code> to the underlying output stream
* Writes a four-byte {@code int} to the underlying output stream
* in little endian order, low byte first, high byte last
*
* @param i the <code>int</code> to be written.
* @param i the {@code int} to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeInt(int i) throws IOException {
out.write(i & 0xFF);
@ -125,12 +133,13 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
}
/**
* Writes an eight-byte <code>long</code> to the underlying output stream
* Writes an eight-byte {@code long} to the underlying output stream
* in little endian order, low byte first, high byte last
*
* @param l the <code>long</code> to be written.
* @param l the {@code long} to be written.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeLong(long l) throws IOException {
out.write((int) l & 0xFF);
@ -149,9 +158,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
* Writes a 4 byte Java float to the underlying output stream in
* little endian order.
*
* @param f the <code>float</code> value to be written.
* @param f the {@code float} value to be written.
* @exception IOException if an I/O error occurs.
*/
@Override
public final void writeFloat(float f) throws IOException {
this.writeInt(Float.floatToIntBits(f));
@ -162,9 +172,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
* Writes an 8 byte Java double to the underlying output stream in
* little endian order.
*
* @param d the <code>double</code> value to be written.
* @param d the {@code double} value to be written.
* @exception IOException if an I/O error occurs.
*/
@Override
public final void writeDouble(double d) throws IOException {
this.writeLong(Double.doubleToLongBits(d));
@ -174,13 +185,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
/**
* Writes a string to the underlying output stream as a sequence of
* bytes. Each character is written to the data output stream as
* if by the <code>writeByte()</code> method.
* if by the {@code writeByte()} method.
*
* @param s the <code>String</code> value to be written.
* @param s the {@code String} value to be written.
* @exception IOException if the underlying stream throws an IOException.
* @see java.io.DataOutputStream#writeByte(int)
* @see java.io.DataOutputStream#out
*/
@Override
public void writeBytes(String s) throws IOException {
int length = s.length();
@ -193,13 +205,14 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
/**
* Writes a string to the underlying output stream as a sequence of
* characters. Each character is written to the data output stream as
* if by the <code>writeChar</code> method.
* if by the {@code writeChar} method.
*
* @param s a <code>String</code> value to be written.
* @param s a {@code String} value to be written.
* @exception IOException if the underlying stream throws an IOException.
* @see java.io.DataOutputStream#writeChar(int)
* @see java.io.DataOutputStream#out
*/
@Override
public void writeChars(String s) throws IOException {
int length = s.length();
@ -227,6 +240,7 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
* 65,535 characters.
* @exception IOException if the underlying stream throws an IOException.
*/
@Override
public void writeUTF(String s) throws IOException {
int numchars = s.length();
@ -270,11 +284,10 @@ public class LittleEndianOutputStream extends FilterOutputStream implements Data
* (This class is not thread-safe with respect to this method. It is
* possible that this number is temporarily less than the actual
* number of bytes written.)
* @return the value of the <code>written</code> field.
* @see java.io.DataOutputStream#written
* @return the value of the {@code written} field.
*/
public int size() {
return this.written;
}
}
}

View File

@ -33,7 +33,6 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import javax.annotation.Nullable;
public class PolyhedralRegion extends AbstractRegion {
@ -69,7 +68,7 @@ public class PolyhedralRegion extends AbstractRegion {
private BlockVector3 centerAccum = BlockVector3.ZERO;
/**
* The last triangle that caused a {@link #contains(Vector)} to classify a point as "outside". Used for optimization.
* The last triangle that caused a {@link #contains(BlockVector3)} to classify a point as "outside". Used for optimization.
*/
private Triangle lastTriangle;

View File

@ -1,13 +1,9 @@
package com.boydti.fawe.object.task;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.util.TaskManager;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;

View File

@ -97,7 +97,12 @@ public class PlotSquaredFeature extends FaweMaskManager {
return false;
}
UUID uid = player.getUniqueId();
return !Flags.NO_WORLDEDIT.isTrue(plot) && ((plot.isOwner(uid) || (type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE) || ((plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player.hasPermission("fawe.plotsquared.member"))))) || player.hasPermission("fawe.plotsquared.admin"));
return !Flags.NO_WORLDEDIT.isTrue(plot) && (plot.isOwner(uid)
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
.contains(DBFunc.EVERYONE)
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
&& player.hasPermission("fawe.plotsquared.member")) || player
.hasPermission("fawe.plotsquared.admin"));
}
@Override

View File

@ -7,12 +7,15 @@ import com.google.gson.JsonParser;
import com.sk89q.worldedit.util.paste.Paster;
import java.io.*;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/**
* Single class paster for the Incendo paste service
@ -212,18 +215,19 @@ public final class IncendoPaster implements Paster {
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
+ "problem\n");
b.append("\n# Server Information\n");
b.append("server.platform: ").append(Fawe.imp().getPlatform()).append('\n');
b.append(Fawe.imp().getDebugInfo()).append('\n');
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
b.append(Fawe.imp().getDebugInfo());
b.append("\n# YAY! Now, let's see what we can find in your JVM\n");
Runtime runtime = Runtime.getRuntime();
b.append("memory.free: ").append(runtime.freeMemory()).append('\n');
b.append("memory.max: ").append(runtime.maxMemory()).append('\n');
b.append("java.specification.version: '").append(System.getProperty("java.specification.version")).append("'\n");
b.append("java.vendor: '").append(System.getProperty("java.vendor")).append("'\n");
b.append("java.version: '").append(System.getProperty("java.version")).append("'\n");
b.append("os.arch: '").append(System.getProperty("os.arch")).append("'\n");
b.append("os.name: '").append(System.getProperty("os.name")).append("'\n");
b.append("os.version: '").append(System.getProperty("os.version")).append("'\n\n");
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n');
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n');
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n');
b.append("Java Name: ").append(rb.getVmName()).append('\n');
b.append("Java Version: '").append(System.getProperty("java.version")).append("'\n");
b.append("Java Vendor: '").append(System.getProperty("java.vendor")).append("'\n");
b.append("Operating System: '").append(System.getProperty("os.name")).append("'\n");
b.append("OS Version: ").append(System.getProperty("os.version")).append('\n');
b.append("OS Arch: ").append(System.getProperty("os.arch")).append('\n');
b.append("# Okay :D Great. You are now ready to create your bug report!");
b.append("\n# You can do so at https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues");
b.append("\n# or via our Discord at https://discord.gg/ngZCzbU");

View File

@ -52,7 +52,7 @@ public class ReflectionUtils {
// 2. Copy it
T[] previousValues = (T[]) valuesField.get(enumType);
List values = new ArrayList(Arrays.asList(previousValues));
List<T> values = new ArrayList<>(Arrays.asList(previousValues));
// 3. build new enum
T newValue = (T) makeEnum(enumType, // The target enum class
@ -176,7 +176,7 @@ public class ReflectionUtils {
public static <T> List<T> getList(List<T> list) {
try {
Class<? extends List> clazz = (Class<? extends List>) Class.forName("java.util.Collections$UnmodifiableList");
Class<? extends List<T>> clazz = (Class<? extends List<T>>) Class.forName("java.util.Collections$UnmodifiableList");
if (!clazz.isInstance(list)) return list;
Field m = clazz.getDeclaredField("list");
m.setAccessible(true);
@ -566,10 +566,10 @@ public class ReflectionUtils {
* @throws RuntimeException if constructor not found
*/
public RefConstructor findConstructor(int number) {
final List<Constructor> constructors = new ArrayList<>();
final List<Constructor<?>> constructors = new ArrayList<>();
Collections.addAll(constructors, this.clazz.getConstructors());
Collections.addAll(constructors, this.clazz.getDeclaredConstructors());
for (Constructor m : constructors) {
for (Constructor<?> m : constructors) {
if (m.getParameterTypes().length == number) {
return new RefConstructor(m);
}

View File

@ -32,7 +32,7 @@ public class ReflectionUtils9 {
// 2. Copy it
T[] previousValues = (T[]) valuesField.get(enumType);
List values = new ArrayList<>(Arrays.asList(previousValues));
List<T> values = new ArrayList<>(Arrays.asList(previousValues));
// 3. build new enum
T newValue = (T) makeEnum(enumType, // The target enum class

View File

@ -13,6 +13,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.lang.reflect.Field;
import java.util.ArrayDeque;
import java.util.HashSet;
@ -92,6 +93,7 @@ public class WEManager {
backupRegions.add(region);
}
} else {
player.printDebug(TextComponent.of("Invalid Mask"));
removed = true;
iterator.remove();
}
@ -115,6 +117,8 @@ public class WEManager {
} catch (Throwable e) {
e.printStackTrace();
}
} else {
player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey()));
}
}
regions.addAll(backupRegions);