mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 14:44:43 +02:00
Compare commits
2 Commits
6.8.0
...
feature/v6
Author | SHA1 | Date | |
---|---|---|---|
6aa3f7c1b7 | |||
9f3507ea85 |
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
|
- uses: release-drafter/release-drafter@v5.19.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -133,5 +133,3 @@ classes/
|
|||||||
*.bat
|
*.bat
|
||||||
docs/
|
docs/
|
||||||
build/
|
build/
|
||||||
|
|
||||||
.DS_Store
|
|
||||||
|
4
.lift.toml
Normal file
4
.lift.toml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
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,10 +513,8 @@ 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,11 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
@ -56,14 +52,7 @@ 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) {
|
||||||
QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(BukkitAdapter.adapt(world));
|
AugmentedUtils.generate(source, world.getName(), source.getX(), source.getZ(), null);
|
||||||
// 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,7 +168,6 @@ 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,7 +196,6 @@ 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,11 +76,10 @@ 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 volatile boolean shouldCancel;
|
private boolean shouldCancel;
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -93,8 +92,7 @@ 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<>();
|
||||||
@ -109,27 +107,14 @@ 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
|
||||||
@ -146,9 +131,7 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,27 +63,10 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||||
|
|
||||||
private static final SideEffectSet NO_SIDE_EFFECT_SET;
|
private final SideEffectSet noSideEffectSet;
|
||||||
private static final SideEffectSet EDGE_SIDE_EFFECT_SET;
|
private final SideEffectSet lightingSideEffectSet;
|
||||||
private static final SideEffectSet LIGHTING_SIDE_EFFECT_SET;
|
private final SideEffectSet edgeSideEffectSet;
|
||||||
private static final SideEffectSet EDGE_LIGHTING_SIDE_EFFECT_SET;
|
private final SideEffectSet edgeLightingSideEffectSet;
|
||||||
|
|
||||||
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;
|
||||||
@ -94,6 +77,19 @@ 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
|
||||||
@ -206,7 +202,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, getSideEffectSet(SideEffectState.NONE));
|
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
||||||
} 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());
|
||||||
@ -263,9 +259,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
|||||||
}
|
}
|
||||||
SideEffectSet sideEffectSet;
|
SideEffectSet sideEffectSet;
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE_LIGHTING : SideEffectState.LIGHTING);
|
sideEffectSet = edge ? edgeLightingSideEffectSet : lightingSideEffectSet;
|
||||||
} else {
|
} else {
|
||||||
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE : SideEffectState.NONE);
|
sideEffectSet = edge ? edgeSideEffectSet : noSideEffectSet;
|
||||||
}
|
}
|
||||||
getWorld().setBlock(loc, block, sideEffectSet);
|
getWorld().setBlock(loc, block, sideEffectSet);
|
||||||
} catch (WorldEditException ignored) {
|
} catch (WorldEditException ignored) {
|
||||||
@ -293,7 +289,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(existing);
|
sw.restoreTag(getWorld().getName(), existing.getX(), existing.getY(), existing.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,23 +382,4 @@ 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,7 +44,6 @@ 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;
|
||||||
@ -167,32 +166,14 @@ 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) {
|
||||||
World world = BukkitUtil.getWorld(worldName);
|
if (this.tag == null) {
|
||||||
if (world == null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return restoreTag(world.getBlockAt(x, y, z));
|
World world = BukkitUtil.getWorld(worldName);
|
||||||
}
|
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[yIndex];
|
BaseBlock id = ids[y];
|
||||||
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 (loaded && !SetupUtils.generators.isEmpty() && !force) {
|
if (!SetupUtils.generators.isEmpty() && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String testWorld = "CheckingPlotSquaredGenerator";
|
String testWorld = "CheckingPlotSquaredGenerator";
|
||||||
@ -100,7 +100,6 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loaded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.configuration.caption.Caption;
|
|||||||
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
||||||
import com.plotsquared.core.configuration.caption.Templates;
|
import com.plotsquared.core.configuration.caption.Templates;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -40,7 +39,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
@ -420,7 +418,7 @@ public class ListCmd extends SubCommand {
|
|||||||
Caption color;
|
Caption color;
|
||||||
if (plot.getOwner() == null) {
|
if (plot.getOwner() == null) {
|
||||||
color = TranslatableCaption.of("info.plot_list_no_owner");
|
color = TranslatableCaption.of("info.plot_list_no_owner");
|
||||||
} else if (plot.isOwner(player.getUUID()) || plot.getOwner().equals(DBFunc.EVERYONE)) {
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
color = TranslatableCaption.of("info.plot_list_owned_by");
|
color = TranslatableCaption.of("info.plot_list_owned_by");
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
color = TranslatableCaption.of("info.plot_list_added_to");
|
color = TranslatableCaption.of("info.plot_list_added_to");
|
||||||
@ -458,60 +456,37 @@ public class ListCmd extends SubCommand {
|
|||||||
String prefix = "";
|
String prefix = "";
|
||||||
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
||||||
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
||||||
String unknown = TranslatableCaption.of("info.plot_list_player_unknown").getComponent(player);
|
|
||||||
String server = TranslatableCaption.of("info.plot_list_player_server").getComponent(player);
|
|
||||||
String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
|
|
||||||
TextComponent.Builder builder = Component.text();
|
TextComponent.Builder builder = Component.text();
|
||||||
if (plot.getFlag(ServerPlotFlag.class)) {
|
try {
|
||||||
Template serverTemplate = Template.of(
|
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
||||||
"info.server",
|
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
TranslatableCaption.of("info.server").getComponent(player)
|
for (final UUIDMapping uuidMapping : names) {
|
||||||
);
|
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
||||||
builder.append(MINI_MESSAGE.parse(server, serverTemplate));
|
Template prefixTemplate = Template.of("prefix", prefix);
|
||||||
} else {
|
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
||||||
try {
|
if (pp != null) {
|
||||||
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
|
||||||
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
} else {
|
||||||
for (final UUIDMapping uuidMapping : names) {
|
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
|
||||||
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
|
||||||
Template prefixTemplate = Template.of("prefix", prefix);
|
|
||||||
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
|
||||||
if (pp != null) {
|
|
||||||
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
|
|
||||||
} else if (uuidMapping.getUsername().equalsIgnoreCase("unknown")) {
|
|
||||||
Template unknownTemplate = Template.of(
|
|
||||||
"info.unknown",
|
|
||||||
TranslatableCaption.of("info.unknown").getComponent(player)
|
|
||||||
);
|
|
||||||
builder.append(MINI_MESSAGE.parse(unknown, unknownTemplate));
|
|
||||||
} else if (uuidMapping.getUuid().equals(DBFunc.EVERYONE)) {
|
|
||||||
Template everyoneTemplate = Template.of(
|
|
||||||
"info.everyone",
|
|
||||||
TranslatableCaption.of("info.everyone").getComponent(player)
|
|
||||||
);
|
|
||||||
builder.append(MINI_MESSAGE.parse(everyone, everyoneTemplate));
|
|
||||||
} else {
|
|
||||||
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
|
|
||||||
}
|
|
||||||
prefix = ", ";
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
prefix = ", ";
|
||||||
final StringBuilder playerBuilder = new StringBuilder();
|
|
||||||
final Iterator<UUID> uuidIterator = plot.getOwners().iterator();
|
|
||||||
while (uuidIterator.hasNext()) {
|
|
||||||
final UUID uuid = uuidIterator.next();
|
|
||||||
playerBuilder.append(uuid);
|
|
||||||
if (uuidIterator.hasNext()) {
|
|
||||||
playerBuilder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.sendMessage(
|
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
|
||||||
Templates.of("value", playerBuilder.toString())
|
|
||||||
);
|
|
||||||
} catch (TimeoutException e) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
|
final StringBuilder playerBuilder = new StringBuilder();
|
||||||
|
final Iterator<UUID> uuidIterator = plot.getOwners().iterator();
|
||||||
|
while (uuidIterator.hasNext()) {
|
||||||
|
final UUID uuid = uuidIterator.next();
|
||||||
|
playerBuilder.append(uuid);
|
||||||
|
if (uuidIterator.hasNext()) {
|
||||||
|
playerBuilder.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Templates.of("value", playerBuilder.toString())
|
||||||
|
);
|
||||||
|
} catch (TimeoutException e) {
|
||||||
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
}
|
}
|
||||||
Template players = Template.of("players", builder.asComponent());
|
Template players = Template.of("players", builder.asComponent());
|
||||||
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
||||||
|
@ -249,9 +249,6 @@ 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)")
|
||||||
@ -694,7 +691,6 @@ 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,23 +54,12 @@ public class AugmentedUtils {
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static boolean generate(
|
||||||
* Generate an augmented world chunk at the given location. If a queue is given, the data will be written to it, else a new
|
@Nullable Object chunkObject,
|
||||||
* 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,
|
||||||
@Nullable QueueCoordinator queue
|
QueueCoordinator queue
|
||||||
) {
|
) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
return false;
|
return false;
|
||||||
@ -108,6 +97,9 @@ public class AugmentedUtils {
|
|||||||
.platform()
|
.platform()
|
||||||
.worldUtil()
|
.worldUtil()
|
||||||
.getWeWorld(world));
|
.getWeWorld(world));
|
||||||
|
if (chunkObject != null) {
|
||||||
|
queue.setChunkObject(chunkObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QueueCoordinator primaryMask;
|
QueueCoordinator primaryMask;
|
||||||
// coordinates
|
// coordinates
|
||||||
@ -165,9 +157,13 @@ 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,
|
||||||
@ -176,6 +172,8 @@ 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();
|
||||||
@ -183,19 +181,4 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.queue.BlockArrayCacheScopedQueueCoordinator;
|
import com.plotsquared.core.queue.ChunkQueueCoordinator;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.ChunkManager;
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
@ -83,7 +83,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public class HybridUtils {
|
public class HybridUtils {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
|
||||||
private static final BlockState AIR = BlockTypes.AIR.getDefaultState();
|
|
||||||
|
|
||||||
public static HybridUtils manager;
|
public static HybridUtils manager;
|
||||||
public static Set<BlockVector2> regions;
|
public static Set<BlockVector2> regions;
|
||||||
@ -137,11 +136,6 @@ public class HybridUtils {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
final PlotArea area = this.plotAreaManager.getPlotArea(world, null);
|
|
||||||
if (!(area instanceof HybridPlotWorld hpw)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final BlockVector3 bot = region.getMinimumPoint();
|
final BlockVector3 bot = region.getMinimumPoint();
|
||||||
final BlockVector3 top = region.getMaximumPoint();
|
final BlockVector3 top = region.getMaximumPoint();
|
||||||
|
|
||||||
@ -158,28 +152,37 @@ public class HybridUtils {
|
|||||||
final int height = area.getMaxGenHeight() - area.getMinGenHeight() + 1;
|
final int height = area.getMaxGenHeight() - area.getMinGenHeight() + 1;
|
||||||
final int minHeight = area.getMinGenHeight();
|
final int minHeight = area.getMinGenHeight();
|
||||||
|
|
||||||
|
final PlotArea area = this.plotAreaManager.getPlotArea(world, null);
|
||||||
|
|
||||||
|
if (!(area instanceof HybridPlotWorld hpw)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChunkQueueCoordinator chunk = new ChunkQueueCoordinator(worldUtil.getWeWorld(world), bot, top, false);
|
||||||
|
hpw.getGenerator().generateChunk(chunk, hpw);
|
||||||
|
|
||||||
|
final BlockState airBlock = BlockTypes.AIR.getDefaultState();
|
||||||
|
final BlockState[][][] oldBlocks = chunk.getBlocks();
|
||||||
final BlockState[][][] newBlocks = new BlockState[height][width][length];
|
final BlockState[][][] newBlocks = new BlockState[height][width][length];
|
||||||
|
for (final BlockState[][] newBlock : newBlocks) {
|
||||||
|
for (final BlockState[] blockStates : newBlock) {
|
||||||
|
Arrays.fill(blockStates, airBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final BlockState[][] oldBlock : oldBlocks) {
|
||||||
|
for (final BlockState[] blockStates : oldBlock) {
|
||||||
|
Arrays.fill(blockStates, airBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BlockArrayCacheScopedQueueCoordinator oldBlockQueue = new BlockArrayCacheScopedQueueCoordinator(
|
System.gc();
|
||||||
Location.at("", region.getMinimumPoint().withY(hpw.getMinGenHeight())),
|
System.gc();
|
||||||
Location.at("", region.getMaximumPoint().withY(hpw.getMaxGenHeight()))
|
|
||||||
);
|
|
||||||
|
|
||||||
region.getChunks().forEach(chunkPos -> {
|
|
||||||
int relChunkX = chunkPos.getX() - cbx;
|
|
||||||
int relChunkZ = chunkPos.getZ() - cbz;
|
|
||||||
oldBlockQueue.setOffsetX(relChunkX << 4);
|
|
||||||
oldBlockQueue.setOffsetZ(relChunkZ << 4);
|
|
||||||
hpw.getGenerator().generateChunk(oldBlockQueue, hpw);
|
|
||||||
});
|
|
||||||
|
|
||||||
final BlockState[][][] oldBlocks = oldBlockQueue.getBlockStates();
|
|
||||||
|
|
||||||
QueueCoordinator queue = area.getQueue();
|
QueueCoordinator queue = area.getQueue();
|
||||||
queue.addReadChunks(region.getChunks());
|
queue.addReadChunks(region.getChunks());
|
||||||
queue.setChunkConsumer(chunkPos -> {
|
queue.setChunkConsumer(blockVector2 -> {
|
||||||
int X = chunkPos.getX();
|
int X = blockVector2.getX();
|
||||||
int Z = chunkPos.getZ();
|
int Z = blockVector2.getZ();
|
||||||
int minX;
|
int minX;
|
||||||
if (X == cbx) {
|
if (X == cbx) {
|
||||||
minX = bx & 15;
|
minX = bx & 15;
|
||||||
@ -217,9 +220,6 @@ public class HybridUtils {
|
|||||||
for (int yIndex = 0; yIndex < height; yIndex++) {
|
for (int yIndex = 0; yIndex < height; yIndex++) {
|
||||||
int y = yIndex + minHeight;
|
int y = yIndex + minHeight;
|
||||||
BlockState block = queue.getBlock(xx, y, zz);
|
BlockState block = queue.getBlock(xx, y, zz);
|
||||||
if (block == null) {
|
|
||||||
block = AIR;
|
|
||||||
}
|
|
||||||
int xr = xb + x;
|
int xr = xb + x;
|
||||||
int zr = zb + z;
|
int zr = zb + z;
|
||||||
newBlocks[yIndex][xr][zr] = block;
|
newBlocks[yIndex][xr][zr] = block;
|
||||||
@ -240,10 +240,10 @@ public class HybridUtils {
|
|||||||
for (int z = 0; z < length; z++) {
|
for (int z = 0; z < length; z++) {
|
||||||
Set<BlockType> types = new HashSet<>();
|
Set<BlockType> types = new HashSet<>();
|
||||||
for (int yIndex = 0; yIndex < height; yIndex++) {
|
for (int yIndex = 0; yIndex < height; yIndex++) {
|
||||||
BlockState old = oldBlocks[yIndex][x][z]; // Nullable
|
BlockState old = oldBlocks[yIndex][x][z];
|
||||||
try {
|
try {
|
||||||
BlockState now = newBlocks[yIndex][x][z]; // Not null
|
BlockState now = newBlocks[yIndex][x][z];
|
||||||
if (!now.equals(old) && !(old == null && now.getBlockType().equals(BlockTypes.AIR))) {
|
if (!old.equals(now)) {
|
||||||
changes[i]++;
|
changes[i]++;
|
||||||
}
|
}
|
||||||
if (now.getBlockType().getMaterial().isAir()) {
|
if (now.getBlockType().getMaterial().isAir()) {
|
||||||
@ -301,6 +301,8 @@ public class HybridUtils {
|
|||||||
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100);
|
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100);
|
||||||
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100);
|
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100);
|
||||||
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100);
|
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100);
|
||||||
|
System.gc();
|
||||||
|
System.gc();
|
||||||
whenDone.value = analysis;
|
whenDone.value = analysis;
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
});
|
});
|
||||||
|
@ -1420,7 +1420,15 @@ public class Plot {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Location location = toHomeLocation(bottom, home);
|
Location location = Location
|
||||||
|
.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(
|
||||||
@ -1453,7 +1461,15 @@ public class Plot {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location bottom = this.getBottomAbs();
|
Location bottom = this.getBottomAbs();
|
||||||
Location location = toHomeLocation(bottom, home);
|
Location location = Location
|
||||||
|
.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(),
|
||||||
@ -1466,17 +1482,6 @@ 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
|
||||||
*
|
*
|
||||||
|
@ -75,9 +75,9 @@ public class ExpiryTask {
|
|||||||
plots = plots != null ? plots : getPlotsToCheck();
|
plots = plots != null ? plots : getPlotsToCheck();
|
||||||
int diff = settings.REQUIRED_PLOTS;
|
int diff = settings.REQUIRED_PLOTS;
|
||||||
boolean min = true;
|
boolean min = true;
|
||||||
if (plots.size() > settings.REQUIRED_PLOTS) {
|
if (settings.REQUIRED_PLOTS - plots.size() < settings.REQUIRED_PLOTS) {
|
||||||
min = false;
|
min = false;
|
||||||
diff = plots.size() - settings.REQUIRED_PLOTS;
|
diff = settings.REQUIRED_PLOTS - plots.size();
|
||||||
}
|
}
|
||||||
List<Long> entireList =
|
List<Long> entireList =
|
||||||
plots.stream().map(plot -> ExpireManager.IMP.getAge(plot, settings.DELETE_IF_OWNER_IS_UNKNOWN))
|
plots.stream().map(plot -> ExpireManager.IMP.getAge(plot, settings.DELETE_IF_OWNER_IS_UNKNOWN))
|
||||||
|
@ -34,7 +34,6 @@ 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;
|
||||||
@ -62,7 +61,6 @@ 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;
|
||||||
@ -70,8 +68,7 @@ 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 = null;
|
private Runnable whenDone;
|
||||||
private SideEffectSet sideEffectSet = null;
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LightingMode lightingMode = LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
|
private LightingMode lightingMode = LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
|
||||||
|
|
||||||
@ -123,9 +120,6 @@ 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);
|
||||||
@ -136,9 +130,6 @@ 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;
|
||||||
@ -150,12 +141,6 @@ 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);
|
||||||
@ -330,29 +315,6 @@ 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
|
||||||
*/
|
*/
|
||||||
|
@ -1,175 +0,0 @@
|
|||||||
/*
|
|
||||||
* _____ _ _ _____ _
|
|
||||||
* | __ \| | | | / ____| | |
|
|
||||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
|
||||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
|
||||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
|
||||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
|
||||||
* | |
|
|
||||||
* |_|
|
|
||||||
* PlotSquared plot management system for Minecraft
|
|
||||||
* Copyright (C) 2014 - 2022 IntellectualSites
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.core.queue;
|
|
||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
|
||||||
import com.plotsquared.core.util.AnnotationHelper;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link QueueCoordinator} that caches all blocks set to it in a given array of form BlockState[][][]. An offset can be
|
|
||||||
* applied to blocks set to it, and the scope limited. This should have blocks set to it one chunk at a time, based on the
|
|
||||||
* result of {@link BlockArrayCacheScopedQueueCoordinator#getMin()} and {@link BlockArrayCacheScopedQueueCoordinator#getMax()}.
|
|
||||||
* The min and max points of this queue are offset according to the minimum point given in the constructor, and the offsets set
|
|
||||||
* in {@link BlockArrayCacheScopedQueueCoordinator#setOffsetX(int)} and
|
|
||||||
* {@link BlockArrayCacheScopedQueueCoordinator#setOffsetZ(int)}
|
|
||||||
*/
|
|
||||||
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to change at any time and created for specific use cases.")
|
|
||||||
public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinator {
|
|
||||||
|
|
||||||
private final BlockState[][][] blockStates;
|
|
||||||
private final int height;
|
|
||||||
private final int width;
|
|
||||||
private final int length;
|
|
||||||
private final int minY;
|
|
||||||
private final int maxY;
|
|
||||||
private final int scopeMinX;
|
|
||||||
private final int scopeMinZ;
|
|
||||||
private final int scopeMaxX;
|
|
||||||
private final int scopeMaxZ;
|
|
||||||
private int offsetX = 0;
|
|
||||||
private int offsetZ = 0;
|
|
||||||
/**
|
|
||||||
* Construct a new instance
|
|
||||||
*
|
|
||||||
* @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.
|
|
||||||
* @since 6.8.0
|
|
||||||
*/
|
|
||||||
public BlockArrayCacheScopedQueueCoordinator(Location min, Location max) {
|
|
||||||
super(null, min, max);
|
|
||||||
this.width = max.getX() - min.getX() + 1;
|
|
||||||
this.length = max.getZ() - min.getZ() + 1;
|
|
||||||
this.minY = min.getY();
|
|
||||||
this.maxY = max.getY();
|
|
||||||
this.height = maxY - minY + 1;
|
|
||||||
|
|
||||||
this.scopeMinX = min.getX() & 15;
|
|
||||||
this.scopeMinZ = min.getZ() & 15;
|
|
||||||
this.scopeMaxX = scopeMinX + width;
|
|
||||||
this.scopeMaxZ = scopeMinZ + length;
|
|
||||||
this.blockStates = new BlockState[height][width][length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockState[][][] getBlockStates() {
|
|
||||||
return blockStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(int x, final int y, int z, final @NonNull BlockState id) {
|
|
||||||
x += offsetX;
|
|
||||||
z += offsetZ;
|
|
||||||
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
|
||||||
blockStates[y - minY][x - scopeMinX][z - scopeMinZ] = id;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(final int x, final int y, final int z, @NonNull final Pattern pattern) {
|
|
||||||
int rx = x + offsetX;
|
|
||||||
int rz = z + offsetZ;
|
|
||||||
if (rx >= scopeMinX && rx < scopeMaxX && y >= minY && y <= maxY && rz >= scopeMinZ && rz < scopeMaxZ) {
|
|
||||||
BlockState state = pattern
|
|
||||||
.applyBlock(super.getMin().getBlockVector3().add(BlockVector3.at(x, y, z)))
|
|
||||||
.toImmutableState();
|
|
||||||
blockStates[y - minY][rx - scopeMinX][rz - scopeMinZ] = state;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NonNull Location getMin() {
|
|
||||||
return super.getMin().add(offsetX - scopeMinX, 0, offsetZ - scopeMinZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NonNull Location getMax() {
|
|
||||||
return getMin().add(15, 0, 15).withY(maxY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(int x, int y, int z, final @NonNull BaseBlock id) {
|
|
||||||
x += offsetX;
|
|
||||||
z += offsetZ;
|
|
||||||
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
|
||||||
blockStates[y - minY][x][z] = id.toImmutableState();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable BlockState getBlock(final int x, final int y, final int z) {
|
|
||||||
if (x >= 0 && x < width && y >= minY && y <= maxY && z >= 0 && z < length) {
|
|
||||||
return blockStates[y - minY][x][z];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffsetX(final int offsetX) {
|
|
||||||
this.offsetX = offsetX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffsetZ(final int offsetZ) {
|
|
||||||
this.offsetZ = offsetZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
return height * width * length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBiome(final int x, final int z, @NonNull final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBiome(final int x, final int y, final int z, @NonNull final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillBiome(final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setTile(final int x, final int y, final int z, @NonNull final CompoundTag tag) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -36,12 +36,8 @@ 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. It does not allow a delegate queue and should be treated as a cache for changes to
|
* Queue that is limited to a single chunk
|
||||||
* 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,7 +32,6 @@ 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;
|
||||||
@ -136,13 +135,6 @@ 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) {
|
||||||
@ -256,21 +248,6 @@ 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,7 +35,6 @@ 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;
|
||||||
@ -249,14 +248,6 @@ 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
|
||||||
*
|
*
|
||||||
@ -422,20 +413,6 @@ 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,23 +35,22 @@ 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 X-Z area, will accept any Y values. Requires all blocks be set normalized in
|
* Queue that only sets blocks with a designated area
|
||||||
* 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,12 +61,15 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +80,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 && z >= 0 && z <= dz && super.setBiome(x + minX, y, z + minZ, biome);
|
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBiome(x + minX, y + minY, z + minZ, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillBiome(BiomeType biome) {
|
public void fillBiome(BiomeType biome) {
|
||||||
for (int y = min.getY(); y <= max.getY(); y++) {
|
for (int y = 0; y <= dy; 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);
|
||||||
@ -93,22 +95,27 @@ 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 && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, id);
|
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(x + minX, y + minY, 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 && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, id);
|
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(x + minX, y + minY, 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 && z >= 0 && z <= dz && super.setBlock(x + minX, y, z + minZ, pattern);
|
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setBlock(
|
||||||
|
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 && z >= 0 && z <= dz && super.setTile(x + minX, y, z + minZ, tag);
|
return x >= 0 && x <= dx && y >= 0 && y <= dy && z >= 0 && z <= dz && super.setTile(x + minX, y + minY, z + minZ, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull Location getMin() {
|
public @NonNull Location getMin() {
|
||||||
|
@ -34,7 +34,6 @@ 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
|
||||||
|
@ -381,9 +381,6 @@
|
|||||||
"info.plot_list_default": "<gold><plot></gold>",
|
"info.plot_list_default": "<gold><plot></gold>",
|
||||||
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_aqua>Online</dark_aqua>\"><gold><player></gold></hover>",
|
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_aqua>Online</dark_aqua>\"><gold><player></gold></hover>",
|
||||||
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_gray>Offline</dark_gray>\"><gold><player></gold></hover>",
|
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_gray>Offline</dark_gray>\"><gold><player></gold></hover>",
|
||||||
"info.plot_list_player_unknown": "<hover:show_text:\"<red>The owner of this plot is unknown</red>\"><white><info.unknown></white></hover>",
|
|
||||||
"info.plot_list_player_server": "<hover:show_text:\"<red>The plot is owned by the server</red>\"><white><info.server></white></hover>",
|
|
||||||
"info.plot_list_player_everyone": "<hover:show_text:\"<blue>The plot is owned by everyone</blue>\"><white><info.everyone></white></hover>",
|
|
||||||
"info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
|
"info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
|
||||||
"info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
|
"info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
|
||||||
"info.area_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:<command_info>><hover:show_text:\"<hover_info>\"><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
|
"info.area_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:<command_info>><hover:show_text:\"<hover_info>\"><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
|
||||||
|
@ -18,7 +18,7 @@ plugins {
|
|||||||
idea
|
idea
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "6.8.0"
|
version = "6.7.1-SNAPSHOT"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
|
Reference in New Issue
Block a user