mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-02 21:54:43 +02:00
Compare commits
1 Commits
fix/v6/aug
...
renovate/o
Author | SHA1 | Date | |
---|---|---|---|
ac600280b2 |
@ -25,11 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.bukkit.generator;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
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.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
@ -56,14 +52,7 @@ public class BukkitAugmentedGenerator extends BlockPopulator {
|
||||
|
||||
@Override
|
||||
public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
|
||||
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();
|
||||
AugmentedUtils.generate(source, world.getName(), source.getX(), source.getZ(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,8 +80,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||
}
|
||||
|
||||
//do not annotate with Override until we discontinue support for 1.4.4 (we no longer support 1.4.4)
|
||||
@Override
|
||||
//do not annotate with Override until we discontinue support for 1.4.4
|
||||
public void setBiome(int x, int y, int z, @NonNull Biome biome) {
|
||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||
|
||||
|
@ -44,7 +44,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
@ -353,15 +352,13 @@ public class PaperListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotHandler;
|
||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
@ -129,15 +128,13 @@ public class ProjectileEventListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||
);
|
||||
entity.remove();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +162,7 @@ public class ProjectileEventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag(ProjectilesFlag.class)) {
|
||||
.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||
return;
|
||||
}
|
||||
entity.remove();
|
||||
|
@ -76,11 +76,10 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||
private final int totalSize;
|
||||
private final AtomicInteger expectedSize;
|
||||
private final AtomicInteger loadingChunks = new AtomicInteger();
|
||||
private final boolean forceSync;
|
||||
|
||||
private int batchSize;
|
||||
private PlotSquaredTask task;
|
||||
private volatile boolean shouldCancel;
|
||||
private boolean shouldCancel;
|
||||
private boolean finished;
|
||||
|
||||
@Inject
|
||||
@ -93,8 +92,7 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||
@Assisted final @NonNull Runnable whenDone,
|
||||
@Assisted final @NonNull Consumer<Throwable> throwableConsumer,
|
||||
@Assisted final boolean unloadAfter,
|
||||
@Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers,
|
||||
@Assisted final boolean forceSync
|
||||
@Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers
|
||||
) {
|
||||
this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks);
|
||||
this.availableChunks = new LinkedBlockingQueue<>();
|
||||
@ -109,27 +107,14 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||
this.plugin = JavaPlugin.getPlugin(BukkitPlatform.class);
|
||||
this.bukkitWorld = Bukkit.getWorld(world.getName());
|
||||
this.progressSubscribers.addAll(progressSubscribers);
|
||||
this.forceSync = forceSync;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (!forceSync) {
|
||||
// Request initial batch
|
||||
this.requestBatch();
|
||||
// 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));
|
||||
} else {
|
||||
try {
|
||||
while (!shouldCancel && !requestedChunks.isEmpty()) {
|
||||
chunkConsumer.accept(requestedChunks.poll());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
throwableConsumer.accept(t);
|
||||
} finally {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
// Request initial batch
|
||||
this.requestBatch();
|
||||
// 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));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -146,9 +131,7 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
||||
for (final ProgressSubscriber subscriber : this.progressSubscribers) {
|
||||
subscriber.notifyEnd();
|
||||
}
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
}
|
||||
task.cancel();
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
|
@ -62,27 +62,10 @@ import java.util.function.Consumer;
|
||||
|
||||
public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
|
||||
private static final SideEffectSet NO_SIDE_EFFECT_SET;
|
||||
private static final SideEffectSet EDGE_SIDE_EFFECT_SET;
|
||||
private static final SideEffectSet LIGHTING_SIDE_EFFECT_SET;
|
||||
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 final SideEffectSet noSideEffectSet;
|
||||
private final SideEffectSet lightingSideEffectSet;
|
||||
private final SideEffectSet edgeSideEffectSet;
|
||||
private final SideEffectSet edgeLightingSideEffectSet;
|
||||
private org.bukkit.World bukkitWorld;
|
||||
@Inject
|
||||
private ChunkCoordinatorBuilderFactory chunkCoordinatorBuilderFactory;
|
||||
@ -93,6 +76,19 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
@Inject
|
||||
public BukkitQueueCoordinator(@NonNull World 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
|
||||
@ -205,7 +201,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
localChunk.getTiles().forEach((blockVector3, tag) -> {
|
||||
try {
|
||||
BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag);
|
||||
getWorld().setBlock(blockVector3, block, getSideEffectSet(SideEffectState.NONE));
|
||||
getWorld().setBlock(blockVector3, block, noSideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
StateWrapper sw = new StateWrapper(tag);
|
||||
sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
@ -262,9 +258,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
}
|
||||
SideEffectSet sideEffectSet;
|
||||
if (lighting) {
|
||||
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE_LIGHTING : SideEffectState.LIGHTING);
|
||||
sideEffectSet = edge ? edgeLightingSideEffectSet : lightingSideEffectSet;
|
||||
} else {
|
||||
sideEffectSet = getSideEffectSet(edge ? SideEffectState.EDGE : SideEffectState.NONE);
|
||||
sideEffectSet = edge ? edgeSideEffectSet : noSideEffectSet;
|
||||
}
|
||||
getWorld().setBlock(loc, block, sideEffectSet);
|
||||
} catch (WorldEditException ignored) {
|
||||
@ -379,23 +375,4 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -889,8 +889,8 @@ public class PlotSquared {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
|
||||
LOGGER.info("| plot world: {}", pa.getClass().getCanonicalName());
|
||||
LOGGER.info("| manager: {}", pa.getPlotManager().getClass().getCanonicalName());
|
||||
LOGGER.info("| plot world: {}", pa);
|
||||
LOGGER.info("| manager: {}", pa);
|
||||
LOGGER.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
@ -906,13 +906,6 @@ public class PlotSquared {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
}
|
||||
PlotArea pa = areaGen.getPlotGenerator().getNewPlotArea(world, null, null, null);
|
||||
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
|
||||
LOGGER.info("- plot world: {}", pa.getClass().getCanonicalName());
|
||||
LOGGER.info("- plot area manager: {}", pa.getPlotManager().getClass().getCanonicalName());
|
||||
if (!this.worldConfiguration.contains(path)) {
|
||||
this.worldConfiguration.createSection(path);
|
||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
||||
}
|
||||
pa.saveConfiguration(worldSection);
|
||||
pa.loadDefaultConfiguration(worldSection);
|
||||
try {
|
||||
@ -920,6 +913,9 @@ public class PlotSquared {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
|
||||
LOGGER.info("- plot world: {}", pa);
|
||||
LOGGER.info("- plot area manager: {}", pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
|
@ -54,23 +54,12 @@ public class AugmentedUtils {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 TODO
|
||||
*/
|
||||
public static boolean generateChunk(
|
||||
public static boolean generate(
|
||||
@Nullable Object chunkObject,
|
||||
final @NonNull String world,
|
||||
final int chunkX,
|
||||
final int chunkZ,
|
||||
@Nullable QueueCoordinator queue
|
||||
QueueCoordinator queue
|
||||
) {
|
||||
if (!enabled) {
|
||||
return false;
|
||||
@ -108,6 +97,9 @@ public class AugmentedUtils {
|
||||
.platform()
|
||||
.worldUtil()
|
||||
.getWeWorld(world));
|
||||
if (chunkObject != null) {
|
||||
queue.setChunkObject(chunkObject);
|
||||
}
|
||||
}
|
||||
QueueCoordinator primaryMask;
|
||||
// coordinates
|
||||
@ -165,9 +157,13 @@ public class AugmentedUtils {
|
||||
}
|
||||
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 =
|
||||
new ScopedQueueCoordinator(
|
||||
secondaryMask,
|
||||
@ -176,6 +172,8 @@ public class AugmentedUtils {
|
||||
);
|
||||
generator.generateChunk(scoped, area);
|
||||
generator.populateChunk(scoped, area);
|
||||
scoped.setForceSync(true);
|
||||
scoped.enqueue();
|
||||
}
|
||||
if (enqueue) {
|
||||
queue.enqueue();
|
||||
@ -183,19 +181,4 @@ public class AugmentedUtils {
|
||||
return generationResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link AugmentedUtils#generateChunk(String, int, int, QueueCoordinator)} as chunkObject is not required
|
||||
* in the above method
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "TODO")
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ import com.plotsquared.core.plot.flag.implementations.PlayerInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PveFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PvpFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.RedstoneFlag;
|
||||
@ -199,7 +198,6 @@ public final class GlobalFlagContainer extends FlagContainer {
|
||||
this.addFlag(VehicleUseFlag.VEHICLE_USE_FALSE);
|
||||
this.addFlag(VillagerInteractFlag.VILLAGER_INTERACT_FALSE);
|
||||
this.addFlag(VineGrowFlag.VINE_GROW_TRUE);
|
||||
this.addFlag(ProjectilesFlag.PROJECTILES_FALSE);
|
||||
|
||||
// Double flags
|
||||
this.addFlag(PriceFlag.PRICE_NOT_BUYABLE);
|
||||
|
@ -1,46 +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.plot.flag.implementations;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ProjectilesFlag extends BooleanFlag<ProjectilesFlag> {
|
||||
|
||||
public static final ProjectilesFlag PROJECTILES_TRUE = new ProjectilesFlag(true);
|
||||
public static final ProjectilesFlag PROJECTILES_FALSE = new ProjectilesFlag(false);
|
||||
|
||||
private ProjectilesFlag(boolean value){
|
||||
super(value, TranslatableCaption.of("flags.flag_description_projectiles"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProjectilesFlag flagOf(@NonNull final Boolean value) {
|
||||
return value ? PROJECTILES_TRUE : PROJECTILES_FALSE;
|
||||
}
|
||||
|
||||
}
|
@ -34,7 +34,6 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
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 lastZ = Integer.MIN_VALUE;
|
||||
private boolean settingBiomes = false;
|
||||
private boolean disableBiomes = false;
|
||||
private boolean settingTiles = false;
|
||||
private boolean regen = false;
|
||||
private int[] regenStart;
|
||||
@ -70,8 +68,7 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
private CuboidRegion regenRegion = null;
|
||||
private Consumer<BlockVector2> consumer = null;
|
||||
private boolean unloadAfter = true;
|
||||
private Runnable whenDone = null;
|
||||
private SideEffectSet sideEffectSet = null;
|
||||
private Runnable whenDone;
|
||||
@Nullable
|
||||
private LightingMode lightingMode = LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
|
||||
|
||||
@ -123,9 +120,6 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public boolean setBiome(int x, int z, @NonNull BiomeType biomeType) {
|
||||
if (disableBiomes) {
|
||||
return false;
|
||||
}
|
||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||
for (int y = world.getMinY(); y <= world.getMaxY(); y++) {
|
||||
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
||||
@ -136,9 +130,6 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
|
||||
@Override
|
||||
public final boolean setBiome(int x, int y, int z, @NonNull BiomeType biomeType) {
|
||||
if (disableBiomes) {
|
||||
return false;
|
||||
}
|
||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||
chunk.setBiome(x & 15, y, z & 15, biomeType);
|
||||
settingBiomes = true;
|
||||
@ -150,12 +141,6 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
return this.settingBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiomesEnabled(boolean settingBiomes) {
|
||||
this.settingBiomes = settingBiomes;
|
||||
this.disableBiomes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTile(int x, int y, int z, @NonNull CompoundTag tag) {
|
||||
LocalChunk chunk = getChunk(x >> 4, z >> 4);
|
||||
@ -330,29 +315,6 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
||||
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
|
||||
*/
|
||||
|
@ -32,7 +32,6 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -136,13 +135,6 @@ public class DelegateQueueCoordinator extends QueueCoordinator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiomesEnabled(final boolean enabled) {
|
||||
if (parent != null) {
|
||||
parent.setBiomesEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setEntity(@NonNull Entity entity) {
|
||||
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
|
||||
public @NonNull List<BlockVector2> getReadChunks() {
|
||||
if (parent != null) {
|
||||
|
@ -35,7 +35,6 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.util.SideEffectSet;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -248,14 +247,6 @@ public abstract class QueueCoordinator {
|
||||
*/
|
||||
public abstract boolean isSettingBiomes();
|
||||
|
||||
/**
|
||||
* If the queue should accept biome placement
|
||||
*
|
||||
* @param enabled If biomes should be enabled
|
||||
* @since TODO
|
||||
*/
|
||||
public abstract void setBiomesEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Add entities to be created
|
||||
*
|
||||
@ -421,20 +412,6 @@ public abstract class QueueCoordinator {
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
@ -35,20 +35,22 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
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
|
||||
* 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.
|
||||
* Queue that only sets blocks with a designated area
|
||||
*/
|
||||
public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
|
||||
private final Location min;
|
||||
private final Location max;
|
||||
private final int minX;
|
||||
private final int minY;
|
||||
private final int minZ;
|
||||
|
||||
private final int maxX;
|
||||
private final int maxY;
|
||||
private final int maxZ;
|
||||
|
||||
private final int dx;
|
||||
private final int dy;
|
||||
private final int dz;
|
||||
|
||||
/**
|
||||
@ -59,12 +61,15 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.minX = min.getX();
|
||||
this.minY = min.getY();
|
||||
this.minZ = min.getZ();
|
||||
|
||||
this.maxX = max.getX();
|
||||
this.maxY = max.getY();
|
||||
this.maxZ = max.getZ();
|
||||
|
||||
this.dx = maxX - minX;
|
||||
this.dy = maxY - minY;
|
||||
this.dz = maxZ - minZ;
|
||||
}
|
||||
|
||||
@ -75,11 +80,11 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
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 z = 0; z < dz; z++) {
|
||||
setBiome(x, y, z, biome);
|
||||
@ -90,22 +95,27 @@ public class ScopedQueueCoordinator extends DelegateQueueCoordinator {
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
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
|
||||
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() {
|
||||
|
@ -613,7 +613,6 @@
|
||||
"flags.flag_description_lectern_read_book": "<gray>Prevent players taking books from lecterns.</gray>",
|
||||
"flags.flag_description_prevent_creative_copy": "<gray>Prevents people from copying item NBT data in the plot unless they're added as members.</gray>",
|
||||
"flags.flag_description_leaf_decay": "<gray>Set to `false` to prevent leaves from decaying.",
|
||||
"flags.flag_description_projectiles": "<gray>Prevents guests from shooting projectiles on the plot when set to false.</gray>",
|
||||
"flags.flag_error_boolean": "Flag value must be a boolean (true | false).",
|
||||
"flags.flag_error_enum": "Must be one of: <list>",
|
||||
"flags.flag_error_integer": "Flag value must be a whole positive number.",
|
||||
|
@ -18,7 +18,7 @@ plugins {
|
||||
idea
|
||||
}
|
||||
|
||||
version = "6.7.1-SNAPSHOT"
|
||||
version = "6.6.4-SNAPSHOT"
|
||||
|
||||
allprojects {
|
||||
group = "com.plotsquared"
|
||||
@ -140,7 +140,7 @@ allprojects {
|
||||
}
|
||||
developer {
|
||||
id.set("NotMyFault")
|
||||
name.set("Alexander Brandes")
|
||||
name.set("NotMyFault")
|
||||
organization.set("IntellectualSites")
|
||||
email.set("contact@notmyfault.dev")
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ guava = "31.0.1-jre" # Version set by Minecraft
|
||||
paper = "1.18.1-R0.1-SNAPSHOT"
|
||||
checker-qual = "3.22.0"
|
||||
guice = "5.1.0"
|
||||
spotbugs = "4.7.0"
|
||||
spotbugs = "4.6.0"
|
||||
snakeyaml = "1.30" # Version set by Bukkit
|
||||
|
||||
# Adventure & MiniMessage
|
||||
|
Reference in New Issue
Block a user