mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-03 22:24:43 +02:00
Compare commits
13 Commits
fix/v6/plo
...
6.8.0
Author | SHA1 | Date | |
---|---|---|---|
41f546ca6b | |||
d037da33cb | |||
dc2d08c67e | |||
96dfc27411 | |||
171d2e5e99 | |||
4433892431 | |||
98a07dad1b | |||
0ffa22b7a6 | |||
60a0129fe9 | |||
d5f8a0842b | |||
f7d55ce105 | |||
85911646f3 | |||
8b75dece69 |
2
.github/workflows/release-drafter.yml
vendored
2
.github/workflows/release-drafter.yml
vendored
@ -14,6 +14,6 @@ jobs:
|
|||||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@v5.19.0
|
- uses: release-drafter/release-drafter@v5
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -133,3 +133,5 @@ classes/
|
|||||||
*.bat
|
*.bat
|
||||||
docs/
|
docs/
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
jdkVersion = "17"
|
|
||||||
build = "gradle clean build -x test"
|
|
||||||
tools = ["findsecbugs", "ErrorProne", "Semgrep", "Detekt", "Infer"]
|
|
||||||
ignoreRules = ["CatchAndPrintStackTrace", "ReferenceEquality", "FallThrough", "FutureReturnValueIgnored", "MixedMutabilityReturnType", "EmptyCatch", "MissingCasesInEnumSwitch", "OperatorPrecedence", "StaticAssignmentInConstructor", "ReferenceEquality", "EqualsHashCode", "EqualsGetClass", "TypeParameterUnusedInFormals", "StringSplitter", "InlineMeSuggester", "NULL_DEREFERENCE"]
|
|
@ -513,8 +513,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
this.backgroundPipeline.registerService(essentialsUUIDService);
|
this.backgroundPipeline.registerService(essentialsUUIDService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.UUID.IMPROMPTU_SERVICE_MOJANG_API) {
|
||||||
final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT);
|
final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT);
|
||||||
this.impromptuPipeline.registerService(impromptuMojangService);
|
this.impromptuPipeline.registerService(impromptuMojangService);
|
||||||
|
}
|
||||||
final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT);
|
final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT);
|
||||||
this.backgroundPipeline.registerService(backgroundMojangService);
|
this.backgroundPipeline.registerService(backgroundMojangService);
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,7 +25,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.generator.AugmentedUtils;
|
import com.plotsquared.core.generator.AugmentedUtils;
|
||||||
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
@ -52,7 +56,14 @@ public class BukkitAugmentedGenerator extends BlockPopulator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
|
public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
|
||||||
AugmentedUtils.generate(source, world.getName(), source.getX(), source.getZ(), null);
|
QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(BukkitAdapter.adapt(world));
|
||||||
|
// The chunk is already loaded and we do not want to load the chunk in "fully" by using any PaperLib methods.
|
||||||
|
queue.setForceSync(true);
|
||||||
|
queue.setSideEffectSet(SideEffectSet.none());
|
||||||
|
queue.setBiomesEnabled(false);
|
||||||
|
queue.setChunkObject(source);
|
||||||
|
AugmentedUtils.generateChunk(world.getName(), source.getX(), source.getZ(), queue);
|
||||||
|
queue.enqueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,6 +168,7 @@ public class EntityEventListener implements Listener {
|
|||||||
case "RAID":
|
case "RAID":
|
||||||
case "SHEARED":
|
case "SHEARED":
|
||||||
case "SILVERFISH_BLOCK":
|
case "SILVERFISH_BLOCK":
|
||||||
|
case "ENDER_PEARL":
|
||||||
case "TRAP":
|
case "TRAP":
|
||||||
case "VILLAGE_DEFENSE":
|
case "VILLAGE_DEFENSE":
|
||||||
case "VILLAGE_INVASION":
|
case "VILLAGE_INVASION":
|
||||||
|
@ -196,6 +196,7 @@ public class PaperListener implements Listener {
|
|||||||
case "RAID":
|
case "RAID":
|
||||||
case "SHEARED":
|
case "SHEARED":
|
||||||
case "SILVERFISH_BLOCK":
|
case "SILVERFISH_BLOCK":
|
||||||
|
case "ENDER_PEARL":
|
||||||
case "TRAP":
|
case "TRAP":
|
||||||
case "VILLAGE_DEFENSE":
|
case "VILLAGE_DEFENSE":
|
||||||
case "VILLAGE_INVASION":
|
case "VILLAGE_INVASION":
|
||||||
|
@ -76,10 +76,11 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
private final int totalSize;
|
private final int totalSize;
|
||||||
private final AtomicInteger expectedSize;
|
private final AtomicInteger expectedSize;
|
||||||
private final AtomicInteger loadingChunks = new AtomicInteger();
|
private final AtomicInteger loadingChunks = new AtomicInteger();
|
||||||
|
private final boolean forceSync;
|
||||||
|
|
||||||
private int batchSize;
|
private int batchSize;
|
||||||
private PlotSquaredTask task;
|
private PlotSquaredTask task;
|
||||||
private boolean shouldCancel;
|
private volatile boolean shouldCancel;
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -92,7 +93,8 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
@Assisted final @NonNull Runnable whenDone,
|
@Assisted final @NonNull Runnable whenDone,
|
||||||
@Assisted final @NonNull Consumer<Throwable> throwableConsumer,
|
@Assisted final @NonNull Consumer<Throwable> throwableConsumer,
|
||||||
@Assisted final boolean unloadAfter,
|
@Assisted final boolean unloadAfter,
|
||||||
@Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers
|
@Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers,
|
||||||
|
@Assisted final boolean forceSync
|
||||||
) {
|
) {
|
||||||
this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks);
|
this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks);
|
||||||
this.availableChunks = new LinkedBlockingQueue<>();
|
this.availableChunks = new LinkedBlockingQueue<>();
|
||||||
@ -107,14 +109,27 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
this.plugin = JavaPlugin.getPlugin(BukkitPlatform.class);
|
this.plugin = JavaPlugin.getPlugin(BukkitPlatform.class);
|
||||||
this.bukkitWorld = Bukkit.getWorld(world.getName());
|
this.bukkitWorld = Bukkit.getWorld(world.getName());
|
||||||
this.progressSubscribers.addAll(progressSubscribers);
|
this.progressSubscribers.addAll(progressSubscribers);
|
||||||
|
this.forceSync = forceSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
if (!forceSync) {
|
||||||
// Request initial batch
|
// Request initial batch
|
||||||
this.requestBatch();
|
this.requestBatch();
|
||||||
// Wait until next tick to give the chunks a chance to be loaded
|
// Wait until next tick to give the chunks a chance to be loaded
|
||||||
TaskManager.runTaskLater(() -> task = TaskManager.runTaskRepeat(this, TaskTime.ticks(1)), TaskTime.ticks(1));
|
TaskManager.runTaskLater(() -> task = TaskManager.runTaskRepeat(this, TaskTime.ticks(1)), TaskTime.ticks(1));
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
while (!shouldCancel && !requestedChunks.isEmpty()) {
|
||||||
|
chunkConsumer.accept(requestedChunks.poll());
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throwableConsumer.accept(t);
|
||||||
|
} finally {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,7 +146,9 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
for (final ProgressSubscriber subscriber : this.progressSubscribers) {
|
for (final ProgressSubscriber subscriber : this.progressSubscribers) {
|
||||||
subscriber.notifyEnd();
|
subscriber.notifyEnd();
|
||||||
}
|
}
|
||||||
|
if (task != null) {
|
||||||
task.cancel();
|
task.cancel();
|
||||||
|
}
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -62,10 +63,27 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||||
|
|
||||||
private final SideEffectSet noSideEffectSet;
|
private static final SideEffectSet NO_SIDE_EFFECT_SET;
|
||||||
private final SideEffectSet lightingSideEffectSet;
|
private static final SideEffectSet EDGE_SIDE_EFFECT_SET;
|
||||||
private final SideEffectSet edgeSideEffectSet;
|
private static final SideEffectSet LIGHTING_SIDE_EFFECT_SET;
|
||||||
private final SideEffectSet edgeLightingSideEffectSet;
|
private static final SideEffectSet EDGE_LIGHTING_SIDE_EFFECT_SET;
|
||||||
|
|
||||||
|
static {
|
||||||
|
NO_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.OFF).with(
|
||||||
|
SideEffect.NEIGHBORS,
|
||||||
|
SideEffect.State.OFF
|
||||||
|
);
|
||||||
|
EDGE_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
|
||||||
|
SideEffect.NEIGHBORS,
|
||||||
|
SideEffect.State.ON
|
||||||
|
);
|
||||||
|
LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
|
||||||
|
EDGE_LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
|
||||||
|
SideEffect.NEIGHBORS,
|
||||||
|
SideEffect.State.ON
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private org.bukkit.World bukkitWorld;
|
private org.bukkit.World bukkitWorld;
|
||||||
@Inject
|
@Inject
|
||||||
private ChunkCoordinatorBuilderFactory chunkCoordinatorBuilderFactory;
|
private ChunkCoordinatorBuilderFactory chunkCoordinatorBuilderFactory;
|
||||||
@ -76,19 +94,6 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
@Inject
|
@Inject
|
||||||
public BukkitQueueCoordinator(@NonNull World world) {
|
public BukkitQueueCoordinator(@NonNull World world) {
|
||||||
super(world);
|
super(world);
|
||||||
noSideEffectSet = SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.OFF).with(
|
|
||||||
SideEffect.NEIGHBORS,
|
|
||||||
SideEffect.State.OFF
|
|
||||||
);
|
|
||||||
lightingSideEffectSet = SideEffectSet.none().with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
|
|
||||||
edgeSideEffectSet = noSideEffectSet.with(SideEffect.UPDATE, SideEffect.State.ON).with(
|
|
||||||
SideEffect.NEIGHBORS,
|
|
||||||
SideEffect.State.ON
|
|
||||||
);
|
|
||||||
edgeLightingSideEffectSet = noSideEffectSet.with(SideEffect.UPDATE, SideEffect.State.ON).with(
|
|
||||||
SideEffect.NEIGHBORS,
|
|
||||||
SideEffect.State.ON
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -201,7 +206,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
localChunk.getTiles().forEach((blockVector3, tag) -> {
|
localChunk.getTiles().forEach((blockVector3, tag) -> {
|
||||||
try {
|
try {
|
||||||
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
||||||
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
getWorld().setBlock(blockVector3, block, getSideEffectSet(SideEffectState.NONE));
|
||||||
} catch (WorldEditException ignored) {
|
} catch (WorldEditException ignored) {
|
||||||
StateWrapper sw = new StateWrapper(tag);
|
StateWrapper sw = new StateWrapper(tag);
|
||||||
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||||
@ -258,15 +263,21 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
SideEffectSet sideEffectSet;
|
SideEffectSet sideEffectSet;
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
sideEffectSet = edge ? edgeLightingSideEffectSet : lightingSideEffectSet;
|
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE_LIGHTING : SideEffectState.LIGHTING);
|
||||||
} else {
|
} else {
|
||||||
sideEffectSet = edge ? edgeSideEffectSet : noSideEffectSet;
|
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE : SideEffectState.NONE);
|
||||||
}
|
}
|
||||||
getWorld().setBlock(loc, block, sideEffectSet);
|
getWorld().setBlock(loc, block, sideEffectSet);
|
||||||
} catch (WorldEditException ignored) {
|
} catch (WorldEditException ignored) {
|
||||||
// Fallback to not so nice method
|
// Fallback to not so nice method
|
||||||
BlockData blockData = BukkitAdapter.adapt(block);
|
BlockData blockData = BukkitAdapter.adapt(block);
|
||||||
Block existing = getBukkitWorld().getBlockAt(x, y, z);
|
Block existing;
|
||||||
|
// Assume a chunk object has been given only when it should have been.
|
||||||
|
if (getChunkObject() instanceof Chunk chunkObject) {
|
||||||
|
existing = chunkObject.getBlock(x & 15, y, z & 15);
|
||||||
|
} else {
|
||||||
|
existing = getBukkitWorld().getBlockAt(x, y, z);
|
||||||
|
}
|
||||||
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
|
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
|
||||||
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
|
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
|
||||||
return;
|
return;
|
||||||
@ -282,7 +293,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
CompoundTag tag = block.getNbtData();
|
CompoundTag tag = block.getNbtData();
|
||||||
StateWrapper sw = new StateWrapper(tag);
|
StateWrapper sw = new StateWrapper(tag);
|
||||||
|
|
||||||
sw.restoreTag(getWorld().getName(), existing.getX(), existing.getY(), existing.getZ());
|
sw.restoreTag(existing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,4 +386,23 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SideEffectSet getSideEffectSet(SideEffectState state) {
|
||||||
|
if (getSideEffectSet() != null) {
|
||||||
|
return getSideEffectSet();
|
||||||
|
}
|
||||||
|
return switch (state) {
|
||||||
|
case NONE -> NO_SIDE_EFFECT_SET;
|
||||||
|
case EDGE -> EDGE_SIDE_EFFECT_SET;
|
||||||
|
case LIGHTING -> LIGHTING_SIDE_EFFECT_SET;
|
||||||
|
case EDGE_LIGHTING -> EDGE_LIGHTING_SIDE_EFFECT_SET;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum SideEffectState {
|
||||||
|
NONE,
|
||||||
|
EDGE,
|
||||||
|
LIGHTING,
|
||||||
|
EDGE_LIGHTING
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -166,14 +167,32 @@ public class StateWrapper {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
|
/**
|
||||||
|
* Restore the TileEntity data to the given world at the given coordinates.
|
||||||
|
*
|
||||||
|
* @param worldName World name
|
||||||
|
* @param x x position
|
||||||
|
* @param y y position
|
||||||
|
* @param z z position
|
||||||
|
* @return true if successful
|
||||||
|
*/
|
||||||
public boolean restoreTag(String worldName, int x, int y, int z) {
|
public boolean restoreTag(String worldName, int x, int y, int z) {
|
||||||
if (this.tag == null) {
|
World world = BukkitUtil.getWorld(worldName);
|
||||||
|
if (world == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
World world = BukkitUtil.getWorld(worldName);
|
return restoreTag(world.getBlockAt(x, y, z));
|
||||||
Block block = world.getBlockAt(x, y, z);
|
}
|
||||||
if (block == null) {
|
|
||||||
|
/**
|
||||||
|
* Restore the TileEntity data to the given block
|
||||||
|
*
|
||||||
|
* @param block Block to restore to
|
||||||
|
* @return true if successful
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
|
||||||
|
public boolean restoreTag(@NonNull Block block) {
|
||||||
|
if (this.tag == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
org.bukkit.block.BlockState state = block.getState();
|
org.bukkit.block.BlockState state = block.getState();
|
||||||
|
@ -278,7 +278,7 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
int minY = value.getMin().getY();
|
int minY = value.getMin().getY();
|
||||||
for (int yIndex = 0; yIndex < ids.length; yIndex++) {
|
for (int yIndex = 0; yIndex < ids.length; yIndex++) {
|
||||||
int y = yIndex + minY;
|
int y = yIndex + minY;
|
||||||
BaseBlock id = ids[y];
|
BaseBlock id = ids[yIndex];
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
value.setBlock(x1, y, z1, id);
|
value.setBlock(x1, y, z1, id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateGenerators(final boolean force) {
|
public void updateGenerators(final boolean force) {
|
||||||
if (!SetupUtils.generators.isEmpty() && !force) {
|
if (loaded && !SetupUtils.generators.isEmpty() && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String testWorld = "CheckingPlotSquaredGenerator";
|
String testWorld = "CheckingPlotSquaredGenerator";
|
||||||
@ -100,6 +100,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -249,6 +249,9 @@ public class Settings extends Config {
|
|||||||
public static int UUID_CACHE_SIZE = 100000;
|
public static int UUID_CACHE_SIZE = 100000;
|
||||||
@Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API")
|
@Comment("Rate limit (per 10 minutes) for background UUID fetching from the Mojang API")
|
||||||
public static int BACKGROUND_LIMIT = 200;
|
public static int BACKGROUND_LIMIT = 200;
|
||||||
|
@Comment("Whether the Mojang API service is enabled for impromptu api calls. If false only the Background task will use" +
|
||||||
|
" http requests to fill the UUID cache (requires restart)")
|
||||||
|
public static boolean IMPROMPTU_SERVICE_MOJANG_API = true;
|
||||||
@Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API")
|
@Comment("Rate limit (per 10 minutes) for random UUID fetching from the Mojang API")
|
||||||
public static int IMPROMPTU_LIMIT = 300;
|
public static int IMPROMPTU_LIMIT = 300;
|
||||||
@Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)")
|
@Comment("Timeout (in milliseconds) for non-blocking UUID requests (mostly commands)")
|
||||||
@ -691,6 +694,7 @@ public class Settings extends Config {
|
|||||||
@Comment({"If blocks at the edges of queued operations should be set causing updates",
|
@Comment({"If blocks at the edges of queued operations should be set causing updates",
|
||||||
" - Slightly slower, but prevents issues such as fences left connected to nothing"})
|
" - Slightly slower, but prevents issues such as fences left connected to nothing"})
|
||||||
public static boolean UPDATE_EDGES = true;
|
public static boolean UPDATE_EDGES = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Comment("Settings related to tab completion")
|
@Comment("Settings related to tab completion")
|
||||||
|
@ -54,12 +54,23 @@ public class AugmentedUtils {
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean generate(
|
/**
|
||||||
@Nullable Object chunkObject,
|
* Generate an augmented world chunk at the given location. If a queue is given, the data will be written to it, else a new
|
||||||
|
* queue will be created and written to world. Returns true if generation occurred.
|
||||||
|
*
|
||||||
|
* @param world World name to generate data for. Must be a PlotSquared world containing one or more areas else nothing will
|
||||||
|
* happen.
|
||||||
|
* @param chunkX Chunk X position
|
||||||
|
* @param chunkZ Chunk Z position
|
||||||
|
* @param queue Queue to write to, if desired.
|
||||||
|
* @return true if generation occurred.
|
||||||
|
* @since 6.8.0
|
||||||
|
*/
|
||||||
|
public static boolean generateChunk(
|
||||||
final @NonNull String world,
|
final @NonNull String world,
|
||||||
final int chunkX,
|
final int chunkX,
|
||||||
final int chunkZ,
|
final int chunkZ,
|
||||||
QueueCoordinator queue
|
@Nullable QueueCoordinator queue
|
||||||
) {
|
) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
return false;
|
return false;
|
||||||
@ -97,9 +108,6 @@ public class AugmentedUtils {
|
|||||||
.platform()
|
.platform()
|
||||||
.worldUtil()
|
.worldUtil()
|
||||||
.getWeWorld(world));
|
.getWeWorld(world));
|
||||||
if (chunkObject != null) {
|
|
||||||
queue.setChunkObject(chunkObject);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
QueueCoordinator primaryMask;
|
QueueCoordinator primaryMask;
|
||||||
// coordinates
|
// coordinates
|
||||||
@ -157,13 +165,9 @@ public class AugmentedUtils {
|
|||||||
}
|
}
|
||||||
generationResult = true;
|
generationResult = true;
|
||||||
}
|
}
|
||||||
if (chunkObject != null) {
|
|
||||||
primaryMask.setChunkObject(chunkObject);
|
|
||||||
}
|
|
||||||
if (chunkObject != null) {
|
|
||||||
secondaryMask.setChunkObject(chunkObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// This queue should not be enqueued as it is simply used to restrict block setting, and then delegate to the
|
||||||
|
// actual queue
|
||||||
ScopedQueueCoordinator scoped =
|
ScopedQueueCoordinator scoped =
|
||||||
new ScopedQueueCoordinator(
|
new ScopedQueueCoordinator(
|
||||||
secondaryMask,
|
secondaryMask,
|
||||||
@ -172,8 +176,6 @@ public class AugmentedUtils {
|
|||||||
);
|
);
|
||||||
generator.generateChunk(scoped, area);
|
generator.generateChunk(scoped, area);
|
||||||
generator.populateChunk(scoped, area);
|
generator.populateChunk(scoped, area);
|
||||||
scoped.setForceSync(true);
|
|
||||||
scoped.enqueue();
|
|
||||||
}
|
}
|
||||||
if (enqueue) {
|
if (enqueue) {
|
||||||
queue.enqueue();
|
queue.enqueue();
|
||||||
@ -181,4 +183,19 @@ public class AugmentedUtils {
|
|||||||
return generationResult;
|
return generationResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link AugmentedUtils#generateChunk(String, int, int, QueueCoordinator)} as chunkObject is not required
|
||||||
|
* in the above method
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||||
|
public static boolean generate(
|
||||||
|
@Nullable Object chunkObject,
|
||||||
|
final @NonNull String world,
|
||||||
|
final int chunkX,
|
||||||
|
final int chunkZ,
|
||||||
|
QueueCoordinator queue
|
||||||
|
) {
|
||||||
|
return generateChunk(world, chunkX, chunkZ, queue);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1420,15 +1420,7 @@ public class Plot {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Location location = Location
|
Location location = toHomeLocation(bottom, home);
|
||||||
.at(
|
|
||||||
bottom.getWorldName(),
|
|
||||||
bottom.getX() + home.getX(),
|
|
||||||
bottom.getY() + home.getY(),
|
|
||||||
bottom.getZ() + home.getZ(),
|
|
||||||
home.getYaw(),
|
|
||||||
home.getPitch()
|
|
||||||
);
|
|
||||||
if (!this.worldUtil.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
if (!this.worldUtil.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
||||||
location = location.withY(
|
location = location.withY(
|
||||||
Math.max(1 + this.worldUtil.getHighestBlockSynchronous(
|
Math.max(1 + this.worldUtil.getHighestBlockSynchronous(
|
||||||
@ -1461,15 +1453,7 @@ public class Plot {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location bottom = this.getBottomAbs();
|
Location bottom = this.getBottomAbs();
|
||||||
Location location = Location
|
Location location = toHomeLocation(bottom, home);
|
||||||
.at(
|
|
||||||
bottom.getWorldName(),
|
|
||||||
bottom.getX() + home.getX(),
|
|
||||||
home.getY(), // y is absolute
|
|
||||||
bottom.getZ() + home.getZ(),
|
|
||||||
home.getYaw(),
|
|
||||||
home.getPitch()
|
|
||||||
);
|
|
||||||
this.worldUtil.getBlock(location, block -> {
|
this.worldUtil.getBlock(location, block -> {
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||||
@ -1482,6 +1466,17 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Location toHomeLocation(Location bottom, BlockLoc relativeHome) {
|
||||||
|
return Location.at(
|
||||||
|
bottom.getWorldName(),
|
||||||
|
bottom.getX() + relativeHome.getX(),
|
||||||
|
relativeHome.getY(), // y is absolute
|
||||||
|
bottom.getZ() + relativeHome.getZ(),
|
||||||
|
relativeHome.getYaw(),
|
||||||
|
relativeHome.getPitch()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the home location
|
* Sets the home location
|
||||||
*
|
*
|
||||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -61,6 +62,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
private int lastX = Integer.MIN_VALUE;
|
private int lastX = Integer.MIN_VALUE;
|
||||||
private int lastZ = Integer.MIN_VALUE;
|
private int lastZ = Integer.MIN_VALUE;
|
||||||
private boolean settingBiomes = false;
|
private boolean settingBiomes = false;
|
||||||
|
private boolean disableBiomes = false;
|
||||||
private boolean settingTiles = false;
|
private boolean settingTiles = false;
|
||||||
private boolean regen = false;
|
private boolean regen = false;
|
||||||
private int[] regenStart;
|
private int[] regenStart;
|
||||||
@ -68,7 +70,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
private CuboidRegion regenRegion = null;
|
private CuboidRegion regenRegion = null;
|
||||||
private Consumer<BlockVector2> consumer = null;
|
private Consumer<BlockVector2> consumer = null;
|
||||||
private boolean unloadAfter = true;
|
private boolean unloadAfter = true;
|
||||||
private Runnable whenDone;
|
private Runnable whenDone = null;
|
||||||
|
private SideEffectSet sideEffectSet = null;
|
||||||
@Nullable
|
@Nullable
|
||||||
private LightingMode lightingMode = LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
|
private LightingMode lightingMode = LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
|
||||||
|
|
||||||
@ -120,6 +123,9 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
|
public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
|
||||||
|
if (disableBiomes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||||
for (int y = world.getMinY(); y <= world.getMaxY(); y++) {
|
for (int y = world.getMinY(); y <= world.getMaxY(); y++) {
|
||||||
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
||||||
@ -130,6 +136,9 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
|
public final boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
|
||||||
|
if (disableBiomes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||||
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
||||||
settingBiomes = true;
|
settingBiomes = true;
|
||||||
@ -141,6 +150,12 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
return this.settingBiomes;
|
return this.settingBiomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBiomesEnabled(boolean settingBiomes) {
|
||||||
|
this.settingBiomes = settingBiomes;
|
||||||
|
this.disableBiomes = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setTile(int x, int y, int z, @NonNull CompoundTag tag) {
|
public boolean setTile(int x, int y, int z, @NonNull CompoundTag tag) {
|
||||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||||
@ -315,6 +330,29 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
this.whenDone = whenDone;
|
this.whenDone = whenDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SideEffectSet getSideEffectSet() {
|
||||||
|
return sideEffectSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSideEffectSet(SideEffectSet sideEffectSet) {
|
||||||
|
this.sideEffectSet = sideEffectSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't ask about the @NonNull placement. That's how it needs to be else it errors.
|
||||||
|
@Override
|
||||||
|
public void setBiomeCuboid(
|
||||||
|
final com.plotsquared.core.location.@NonNull Location pos1,
|
||||||
|
final com.plotsquared.core.location.@NonNull Location pos2,
|
||||||
|
@NonNull final BiomeType biome
|
||||||
|
) {
|
||||||
|
if (disableBiomes) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.setBiomeCuboid(pos1, pos2, biome);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link LocalChunk} from the queue at the given chunk coordinates. Returns a new instance if one doesn't exist
|
* Get the {@link LocalChunk} from the queue at the given chunk coordinates. Returns a new instance if one doesn't exist
|
||||||
*/
|
*/
|
||||||
|
@ -64,7 +64,7 @@ public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinato
|
|||||||
*
|
*
|
||||||
* @param min Inclusive location of the minimum point to limit the scope to.
|
* @param min Inclusive location of the minimum point to limit the scope to.
|
||||||
* @param max Inclusive location of the maximum point to limit the scope to.
|
* @param max Inclusive location of the maximum point to limit the scope to.
|
||||||
* @since TODO
|
* @since 6.8.0
|
||||||
*/
|
*/
|
||||||
public BlockArrayCacheScopedQueueCoordinator(Location min, Location max) {
|
public BlockArrayCacheScopedQueueCoordinator(Location min, Location max) {
|
||||||
super(null, min, max);
|
super(null, min, max);
|
||||||
|
@ -36,8 +36,12 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue that is limited to a single chunk
|
* Queue that is limited to a single chunk. It does not allow a delegate queue and should be treated as a cache for changes to
|
||||||
|
* be set to. Does not support tile entities or entities.
|
||||||
|
*
|
||||||
|
* @deprecated This class is poorly designed and will no longer be used in P2
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||||
public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
|
public class ChunkQueueCoordinator extends ScopedQueueCoordinator {
|
||||||
|
|
||||||
public final BiomeType[][][] biomeResult;
|
public final BiomeType[][][] biomeResult;
|
||||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.entity.Entity;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -135,6 +136,13 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBiomesEnabled(final boolean enabled) {
|
||||||
|
if (parent != null) {
|
||||||
|
parent.setBiomesEnabled(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setEntity(@NonNull Entity entity) {
|
public boolean setEntity(@NonNull Entity entity) {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@ -248,6 +256,21 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SideEffectSet getSideEffectSet() {
|
||||||
|
if (parent != null) {
|
||||||
|
return parent.getSideEffectSet();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSideEffectSet(final SideEffectSet sideEffectSet) {
|
||||||
|
if (parent != null) {
|
||||||
|
parent.setSideEffectSet(sideEffectSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull List<BlockVector2> getReadChunks() {
|
public @NonNull List<BlockVector2> getReadChunks() {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
@ -35,6 +35,7 @@ import com.sk89q.worldedit.entity.Entity;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
@ -143,7 +144,8 @@ public abstract class QueueCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a chunk object (e.g. the Bukkit Chunk object) to the queue
|
* Set a chunk object (e.g. the Bukkit Chunk object) to the queue. This will be used as fallback in case of WNA failure.
|
||||||
|
* Should ONLY be used in specific cases (i.e. generation, where a chunk is being populated)
|
||||||
*
|
*
|
||||||
* @param chunkObject chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
|
* @param chunkObject chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
|
||||||
*/
|
*/
|
||||||
@ -247,6 +249,14 @@ public abstract class QueueCoordinator {
|
|||||||
*/
|
*/
|
||||||
public abstract boolean isSettingBiomes();
|
public abstract boolean isSettingBiomes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the queue should accept biome placement
|
||||||
|
*
|
||||||
|
* @param enabled If biomes should be enabled
|
||||||
|
* @since 6.8.0
|
||||||
|
*/
|
||||||
|
public abstract void setBiomesEnabled(boolean enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entities to be created
|
* Add entities to be created
|
||||||
*
|
*
|
||||||
@ -412,6 +422,20 @@ public abstract class QueueCoordinator {
|
|||||||
*/
|
*/
|
||||||
public abstract void setLightingMode(@Nullable LightingMode mode);
|
public abstract void setLightingMode(@Nullable LightingMode mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the overriding {@link SideEffectSet} to be used by the queue if it exists, else null
|
||||||
|
*
|
||||||
|
* @return Overriding {@link SideEffectSet} or null
|
||||||
|
*/
|
||||||
|
public abstract @Nullable SideEffectSet getSideEffectSet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the overriding {@link SideEffectSet} to be used by the queue. Null to use default side effects.
|
||||||
|
*
|
||||||
|
* @param sideEffectSet side effects to override with, or null to use default
|
||||||
|
*/
|
||||||
|
public abstract void setSideEffectSet(@Nullable SideEffectSet sideEffectSet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a cuboid between two positions with a BlockState
|
* Fill a cuboid between two positions with a BlockState
|
||||||
*
|
*
|
||||||
|
@ -35,22 +35,23 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue that only sets blocks with a designated area
|
* Queue that only sets blocks with a designated X-Z area, will accept any Y values. Requires all blocks be set normalized in
|
||||||
|
* the x and z directions, i.e. starting from 0,0. An offset of the minimum point of the region will then be applied to x and z.
|
||||||
|
*
|
||||||
|
* @deprecated This should be renamed to NormalizedScopedQueueCoordinator or something.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.8.0")
|
||||||
public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||||
|
|
||||||
private final Location min;
|
private final Location min;
|
||||||
private final Location max;
|
private final Location max;
|
||||||
private final int minX;
|
private final int minX;
|
||||||
private final int minY;
|
|
||||||
private final int minZ;
|
private final int minZ;
|
||||||
|
|
||||||
private final int maxX;
|
private final int maxX;
|
||||||
private final int maxY;
|
|
||||||
private final int maxZ;
|
private final int maxZ;
|
||||||
|
|
||||||
private final int dx;
|
private final int dx;
|
||||||
private final int dy;
|
|
||||||
private final int dz;
|
private final int dz;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,15 +62,12 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
|||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
this.minX = min.getX();
|
this.minX = min.getX();
|
||||||
this.minY = min.getY();
|
|
||||||
this.minZ = min.getZ();
|
this.minZ = min.getZ();
|
||||||
|
|
||||||
this.maxX = max.getX();
|
this.maxX = max.getX();
|
||||||
this.maxY = max.getY();
|
|
||||||
this.maxZ = max.getZ();
|
this.maxZ = max.getZ();
|
||||||
|
|
||||||
this.dx = maxX - minX;
|
this.dx = maxX - minX;
|
||||||
this.dy = maxY - minY;
|
|
||||||
this.dz = maxZ - minZ;
|
this.dz = maxZ - minZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,11 +78,11 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, @NonNull BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, @NonNull BiomeType biome) {
|
||||||
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBiome(x + minX, y + minY, z + minZ, biome);
|
return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBiome(x + minX, y, z + minZ, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillBiome(BiomeType biome) {
|
public void fillBiome(BiomeType biome) {
|
||||||
for (int y = 0; y <= dy; y++) {
|
for (int y = min.getY(); y <= max.getY(); y++) {
|
||||||
for (int x = 0; x <= dx; x++) {
|
for (int x = 0; x <= dx; x++) {
|
||||||
for (int z = 0; z < dz; z++) {
|
for (int z = 0; z < dz; z++) {
|
||||||
setBiome(x, y, z, biome);
|
setBiome(x, y, z, biome);
|
||||||
@ -95,27 +93,22 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, @NonNull BaseBlock id) {
|
public boolean setBlock(int x, int y, int z, @NonNull BaseBlock id) {
|
||||||
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(x + minX, y + minY, z + minZ, id);
|
return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, @NonNull BlockState id) {
|
public boolean setBlock(int x, int y, int z, @NonNull BlockState id) {
|
||||||
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(x + minX, y + minY, z + minZ, id);
|
return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
|
public boolean setBlock(int x, int y, int z, @NonNull Pattern pattern) {
|
||||||
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(
|
return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, pattern);
|
||||||
x + minX,
|
|
||||||
y + minY,
|
|
||||||
z + minZ,
|
|
||||||
pattern
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setTile(int x, int y, int z, @NonNull CompoundTag tag) {
|
public boolean setTile(int x, int y, int z, @NonNull CompoundTag tag) {
|
||||||
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setTile(x + minX, y + minY, z + minZ, tag);
|
return x >= 0 && x <= dx && z >= 0 && z <= dz && super.setTile(x + minX, y, z + minZ, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Location getMin() {
|
public @NonNull Location getMin() {
|
||||||
|
@ -34,6 +34,7 @@ import java.util.HashMap;
|
|||||||
public abstract class SetupUtils {
|
public abstract class SetupUtils {
|
||||||
|
|
||||||
public static HashMap<String, GeneratorWrapper<?>> generators = new HashMap<>();
|
public static HashMap<String, GeneratorWrapper<?>> generators = new HashMap<>();
|
||||||
|
protected boolean loaded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 6.1.0
|
* @since 6.1.0
|
||||||
|
@ -18,7 +18,7 @@ plugins {
|
|||||||
idea
|
idea
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "6.7.1-SNAPSHOT"
|
version = "6.8.0"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
|
Reference in New Issue
Block a user