mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-13 14:58:35 +00:00
Feature/unsafe over reflections (#1082)
* Use Unsafe to replace Lock * Start cleaning up everything that has to do with CleanableThreadLocal * Make cancellation work Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
@ -24,7 +24,6 @@ import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.object.collection.SparseBitSet;
|
||||
@ -80,6 +79,8 @@ import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.snapshot.experimental.Snapshot;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@ -92,15 +93,12 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.TimeZone;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -159,7 +157,6 @@ public class LocalSession implements TextureHolder {
|
||||
private transient UUID uuid;
|
||||
private transient volatile long historySize = 0;
|
||||
|
||||
private transient VirtualWorld virtual;
|
||||
private transient BlockVector3 cuiTemporaryBlock;
|
||||
@SuppressWarnings("unused")
|
||||
private transient EditSession.ReorderMode reorderMode = EditSession.ReorderMode.MULTI_STAGE;
|
||||
@ -752,35 +749,6 @@ public class LocalSession implements TextureHolder {
|
||||
return selector.getRegion();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualWorld getVirtualWorld() {
|
||||
synchronized (dirty) {
|
||||
return virtual;
|
||||
}
|
||||
}
|
||||
|
||||
public void setVirtualWorld(@Nullable VirtualWorld world) {
|
||||
VirtualWorld tmp;
|
||||
synchronized (dirty) {
|
||||
tmp = this.virtual;
|
||||
if (tmp == world) {
|
||||
return;
|
||||
}
|
||||
this.virtual = world;
|
||||
}
|
||||
if (tmp != null) {
|
||||
try {
|
||||
tmp.close(world == null);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (world != null) {
|
||||
Fawe.imp().registerPacketListener();
|
||||
world.update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selection world.
|
||||
*
|
||||
@ -1234,10 +1202,6 @@ public class LocalSession implements TextureHolder {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player != null && previous instanceof BrushTool) {
|
||||
BrushTool brushTool = (BrushTool) previous;
|
||||
brushTool.clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1723,14 +1687,4 @@ public class LocalSession implements TextureHolder {
|
||||
this.transform = transform;
|
||||
}
|
||||
|
||||
public void unregisterTools(Player player) {
|
||||
synchronized (tools) {
|
||||
for (Tool tool : tools.values()) {
|
||||
if (tool instanceof BrushTool) {
|
||||
((BrushTool) tool).clear(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user