Feature/propagate diff and object cleanup (#1190)

* Feature/main/propagate diff annotations (#1187)

* 25% done

* More work

* More work

* 50%

* More work

* 75%

* 100% & cleanup

* Update adapters

* Squish squash, applesauce

commit 275ba9bd84
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sat Jul 17 01:10:20 2021 +0200

    Update dependency com.comphenix.protocol:ProtocolLib to v4.7.0 (#1173)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 9fd8984804
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sat Jul 17 01:09:29 2021 +0200

    Update dependency org.checkerframework:checker-qual to v3.16.0 (#1184)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>

commit 861fb45e5c
Author: dordsor21 <dordsor21@gmail.com>
Date:   Fri Jul 16 19:07:02 2021 +0100

    Fix #1075

commit 420c45a29a
Author: dordsor21 <dordsor21@gmail.com>
Date:   Fri Jul 16 18:48:21 2021 +0100

    Entity removal should be on the main thread as we're just passing through rather than doing chunk operations
     - Fixes #1164
     - Not working: butcher/remove history

commit 4d4db7dcd0
Author: SirYwell <hannesgreule@outlook.de>
Date:   Fri Jul 16 17:52:44 2021 +0200

    Make sure leaves category is loaded for heightmaps (fixes #1176)

commit c98f6e4f37
Author: dordsor21 <dordsor21@gmail.com>
Date:   Fri Jul 16 10:44:52 2021 +0100

    Do not allow generation commands to generate outside selection

commit 2485f5eccc
Author: dordsor21 <dordsor21@gmail.com>
Date:   Fri Jul 16 10:43:15 2021 +0100

    EditSession needs to override some Extent methods to ensure block changes are correctly set through the various extents
    Fixes #1152

commit d9418ec8ae
Author: dordsor21 <dordsor21@gmail.com>
Date:   Fri Jul 16 09:52:44 2021 +0100

    Undo part of 41073bb1a0
    Fixes #1178

* Update Upstream

fb1fb84 Fixed typo and grammar

* We don't support custom heights yet

* Casing inconsistency

* Address a few comments

* Address comments

* Don't refactor to AP classpath

* Document annotation style

* Refactoring & shade cleanup

* Address a few comments

* More work

* Resolve comments not being resolved yet

* Feature/main/propagate diff annotations (#1187) (#1194)

* Remove beta package, fix history packages, move classes out of object package

* Resolve comments not being resolved yet

* Remove beta package, fix history packages, move classes out of object package

Co-authored-by: NotMyFault <mc.cache@web.de>

* brushes should be under brush

* More refactoring
 - Filters/processors should be in the same place and are related to extents
 - Transforms are in `extent.transform` in upstream

* Move history classes under history

* Update adapters

Co-authored-by: dordsor21 <dordsor21@gmail.com>
This commit is contained in:
NotMyFault
2021-07-23 17:48:51 +02:00
committed by GitHub
parent ad102ab7a9
commit 50ab8ad5c7
799 changed files with 4916 additions and 10589 deletions

View File

@ -63,6 +63,7 @@ public class ClipboardHolder {
return clipboard;
}
//FAWE start
/**
* Gets all currently held clipboards.
* @return all clipboards being held.
@ -84,6 +85,7 @@ public class ClipboardHolder {
public List<ClipboardHolder> getHolders() {
return Collections.singletonList(this);
}
//FAWE end
/**
* Set the transform.

View File

@ -83,7 +83,7 @@ public class PasteBuilder {
* This provides a more flexible alternative to {@link #ignoreAirBlocks(boolean)}, for example
* one might want to ignore structure void if copying a Minecraft Structure, etc.
*
* @param sourceMask
* @param sourceMask the mask for the source
* @return this builder instance
*/
public PasteBuilder maskSource(Mask sourceMask) {
@ -109,7 +109,7 @@ public class PasteBuilder {
* Set whether the copy should include source entities.
* Note that this is true by default for legacy reasons.
*
* @param copyEntities
* @param copyEntities if entities should be copied
* @return this builder instance
*/
public PasteBuilder copyEntities(boolean copyEntities) {
@ -120,17 +120,20 @@ public class PasteBuilder {
/**
* Set whether the copy should include source biomes (if available).
*
* @param copyBiomes
* @param copyBiomes if biomes should be copied
* @return this builder instance
*/
public PasteBuilder copyBiomes(boolean copyBiomes) {
this.copyBiomes = copyBiomes;
return this;
}
//FAWE start
public PasteBuilder filter(RegionFunction function) {
this.canApply = function;
return this;
}
//FAWE end
/**
* Build the operation.
@ -138,19 +141,24 @@ public class PasteBuilder {
* @return the operation
*/
public Operation build() {
//FAWE start
Extent extent = clipboard;
if (!transform.isIdentity()) {
extent = new BlockTransformExtent(extent, transform);
}
//FAWE end
ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to);
copy.setTransform(transform);
//FAWE start
copy.setCopyingEntities(copyEntities);
copy.setCopyingBiomes(copyBiomes && clipboard.hasBiomes());
if (this.canApply != null) {
copy.setFilterFunction(this.canApply);
}
//FAWE end
if (ignoreAirBlocks) {
//FAWE start - respect clipboard
sourceMask = MaskIntersection.of(sourceMask, new ExistingBlockMask(clipboard));
}
if (targetExtent instanceof EditSession) {
@ -164,6 +172,7 @@ public class PasteBuilder {
sourceMask = MaskIntersection.of(sourceMask, esSourceMask);
}
}
//FAWE end
if (sourceMask != null && sourceMask != Masks.alwaysTrue()) {
copy.setSourceMask(sourceMask);
}

View File

@ -71,7 +71,6 @@ public class SessionManager {
private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5, "WorldEdit Session Saver - %s"));
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static boolean warnedInvalidTool;
private final Timer timer = new Timer("WorldEdit Session Manager");
private final WorldEdit worldEdit;
@ -169,6 +168,7 @@ public class SessionManager {
session.setConfiguration(config);
session.setBlockChangeLimit(config.defaultChangeLimit);
session.setTimeout(config.calculationTimeout);
//FAWE start
/*
try {
if (owner.hasPermission("worldedit.selection.pos")) {
@ -184,6 +184,7 @@ public class SessionManager {
}
}
*/
//FAWE end
// Remember the session regardless of if it's currently active or not.
// And have the SessionTracker FLUSH inactive sessions.
@ -328,8 +329,10 @@ public class SessionManager {
stored.lastActive = now;
if (stored.session.compareAndResetDirty()) {
//FAWE start
// Don't save unless player disconnects
// saveQueue.put(stored.key, stored.session);
//FAWE end
}
} else {
if (now - stored.lastActive > EXPIRATION_GRACE) {
@ -350,7 +353,7 @@ public class SessionManager {
@Subscribe
public void onConfigurationLoad(ConfigurationLoadEvent event) {
LocalConfiguration config = event.getConfiguration();
File dir = new File(config.getWorkingDirectory(), "sessions");
File dir = new File(config.getWorkingDirectoryPath().toFile(), "sessions");
store = new JsonFileSessionStore(dir);
}

View File

@ -36,21 +36,26 @@ import java.util.concurrent.ConcurrentHashMap;
public final class Request {
private static final ThreadLocal<Request> threadLocal = ThreadLocal.withInitial(Request::new);
//FAWE start
// TODO any better way to deal with this?
private static final Map<Thread, Request> requests = new ConcurrentHashMap<>();
//FAWE end
@Nullable
private World world;
@Nullable
private Actor actor;
@Nullable
private LocalSession session;
@Nullable
private EditSession editSession;
private boolean valid;
//FAWE start
@Nullable
private Actor actor;
@Nullable
private Extent extent;
private boolean valid;
//FAWE end
//FAWE start
private Request() {
requests.put(Thread.currentThread(), this);
}
@ -58,6 +63,7 @@ public final class Request {
public static Collection<Request> getAll() {
return requests.values();
}
//FAWE end
/**
* Get the request world.
@ -78,6 +84,7 @@ public final class Request {
this.world = world;
}
//FAWE start
public void setExtent(@Nullable Extent extent) {
this.extent = extent;
}
@ -104,6 +111,7 @@ public final class Request {
public void setActor(@Nullable Actor actor) {
this.actor = actor;
}
//FAWE end
/**
* Get the request session.
@ -115,6 +123,7 @@ public final class Request {
return session;
}
//FAWE start
/**
* Get the request session.
*
@ -123,6 +132,7 @@ public final class Request {
public void setSession(@Nullable LocalSession session) {
this.session = session;
}
//FAWE end
/**
* Get the {@link EditSession}.
@ -158,7 +168,9 @@ public final class Request {
public static void reset() {
request().invalidate();
threadLocal.remove();
//FAWE start
requests.remove(Thread.currentThread());
//FAWE end
}
/**

View File

@ -90,10 +90,12 @@ public class RequestExtent implements Extent {
return getExtent().getBiome(position);
}
//FAWE start
@Override
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
return getExtent().setBlock(position, block);
}
//FAWE end
@Override
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
@ -106,6 +108,7 @@ public class RequestExtent implements Extent {
return getExtent().fullySupports3DBiomes();
}
//FAWE start
@Override
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return getExtent().setTile(x, y, z, tile);
@ -115,6 +118,7 @@ public class RequestExtent implements Extent {
public boolean setBiome(BlockVector3 position, BiomeType biome) {
return getExtent().setBiome(position, biome);
}
//FAWE end
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {