Skip to content

Commit

Permalink
refactor: apply final/abstract to various fawe extent classes (#2615)
Browse files Browse the repository at this point in the history
* refactor: apply final/abstract to various fawe extent classes

* Remove forremoval as targets v3
  • Loading branch information
dordsor21 committed Sep 26, 2024
1 parent 986d351 commit de49924
Show file tree
Hide file tree
Showing 22 changed files with 21 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;

public class BlockTranslateExtent extends AbstractDelegateExtent {
public final class BlockTranslateExtent extends AbstractDelegateExtent {

private final int dx;
private final int dy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IBatchProcessor {
public final class DisallowedBlocksExtent extends AbstractDelegateExtent implements IBatchProcessor {

private static final BlockState RESERVED = BlockTypes.__RESERVED__.getDefaultState();
private final Set<PropertyRemap<?>> remaps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.Arrays;

public class ExtentHeightCacher extends PassthroughExtent {
public final class ExtentHeightCacher extends PassthroughExtent {

private transient int cacheBotX = Integer.MIN_VALUE;
private transient int cacheBotZ = Integer.MIN_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.Collection;
import java.util.Collections;

public class HeightBoundExtent extends FaweRegionExtent {
public final class HeightBoundExtent extends FaweRegionExtent {

private final int min;
private final int max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* Stores changes to a {@link ChangeSet}.
*/
public class HistoryExtent extends AbstractDelegateExtent {
public final class HistoryExtent extends AbstractDelegateExtent {

private final MutableBlockVector3 mutable = new MutableBlockVector3();
private AbstractChangeSet changeSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.UUID;
import java.util.function.Consumer;

public class LimitExtent extends AbstractDelegateExtent implements IBatchProcessor {
public final class LimitExtent extends AbstractDelegateExtent implements IBatchProcessor {

private final FaweLimit limit;
private final boolean[] faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;

public class MemoryCheckingExtent extends PassthroughExtent {
public final class MemoryCheckingExtent extends PassthroughExtent {

private final Actor actor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;
import java.util.concurrent.Future;

public class MultiRegionExtent extends FaweRegionExtent {
public final class MultiRegionExtent extends FaweRegionExtent {

@Nullable
private final RegionIntersection intersection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.concurrent.Future;

//todo This should be removed in favor of com.sk89q.worldedit.extent.NullExtent
public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
public final class NullExtent extends FaweRegionExtent implements IBatchProcessor {

private final FaweException reason;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.List;
import java.util.Set;

public class PassthroughExtent extends AbstractDelegateExtent {
public abstract class PassthroughExtent extends AbstractDelegateExtent {

/**
* Create a new instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;

public class PositionTransformExtent extends ResettableExtent {
public final class PositionTransformExtent extends ResettableExtent {

private transient MutableBlockVector3 mutable = new MutableBlockVector3();
private transient BlockVector3 min;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.util.UUID;

public class ProcessedWEExtent extends AbstractDelegateExtent {
public final class ProcessedWEExtent extends AbstractDelegateExtent {

private final FaweLimit limit;
private final Extent extent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

public class ResettableExtent extends AbstractDelegateExtent implements Serializable {
public abstract class ResettableExtent extends AbstractDelegateExtent implements Serializable {

public ResettableExtent(Extent parent) {
super(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.Collections;
import java.util.concurrent.Future;

public class SingleRegionExtent extends FaweRegionExtent {
public final class SingleRegionExtent extends FaweRegionExtent {

private final Region region;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BlockStateHolder;

public class SlowExtent extends AbstractDelegateExtent {
public final class SlowExtent extends AbstractDelegateExtent {

private final long THRESHOLD = 50 * 1000000; // 1 tick
private final long nanos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

public class SourceMaskExtent extends TemporalExtent {
public final class SourceMaskExtent extends TemporalExtent {

private Mask mask;
private final MutableBlockVector3 mutable = new MutableBlockVector3();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

public class StripNBTExtent extends AbstractDelegateExtent implements IBatchProcessor {
public final class StripNBTExtent extends AbstractDelegateExtent implements IBatchProcessor {

private final Set<String> strip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* An extent that delegates actions to another extent that may change at any time.
*/
public class SupplyingExtent extends PassthroughExtent {
public final class SupplyingExtent extends PassthroughExtent {

private final Supplier<Extent> extentSupplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;

public class TemporalExtent extends PassthroughExtent {
public abstract class TemporalExtent extends PassthroughExtent {

private int x;
private int y;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.concurrent.ForkJoinTask;
import java.util.stream.IntStream;

public class ParallelQueueExtent extends PassthroughExtent {
public final class ParallelQueueExtent extends PassthroughExtent {

private static final Logger LOGGER = LogManagerCompat.getLogger();
private static final ThreadLocal<Extent> extents = new ThreadLocal<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* This queue is reusable {@link #init(Extent, IChunkCache, IChunkCache)}
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
public final class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {

private static final Logger LOGGER = LogManagerCompat.getLogger();

Expand Down

0 comments on commit de49924

Please sign in to comment.