Compare commits

..

9 Commits

Author SHA1 Message Date
70baca7145 Better naming for "legacy" block state populator 2022-06-11 16:32:54 +01:00
2a90015037 Address comments
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-06-11 16:04:38 +01:00
f17aa377b7 Better exception handling when setting data to LimitedRegion during chunk population 2022-06-11 13:29:57 +01:00
e159fa054d Clean up HybridGen
- There's no need for while loops acting as a modulo after we've already performed a modulo
 - Make the code-sections calculating if positions are in the wall/road more readable
 - Collaps duplicate if-elseif bodies
2022-06-11 13:24:03 +01:00
058c65e34c Ensure Location is still sealed, and add api description annotation to public methods in UncheckedWorldLocation 2022-06-11 13:04:05 +01:00
8608604306 Address comments regarding javadocs/comments 2022-06-11 13:03:09 +01:00
8d0cc68721 Don't do the big error if heads don't work 2022-06-09 22:00:51 +01:00
2a79c0a419 Javadocs 2022-06-09 21:07:49 +01:00
90d42b8b9f Implement tile entities to generation using Populators
- Fixes #3051
2022-06-09 20:49:43 +01:00
35 changed files with 102 additions and 185 deletions

View File

@ -27,12 +27,14 @@ body:
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false multiple: false
options: options:
- '1.19'
- '1.18.2' - '1.18.2'
- '1.18.1' - '1.18.1'
- '1.18' - '1.18'
- '1.17.1' - '1.17.1'
- '1.16.5' - '1.16.5'
- '1.15.2'
- '1.14.4'
- '1.13.2'
validations: validations:
required: true required: true

View File

@ -270,7 +270,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final PlotSquared plotSquared = new PlotSquared(this, "Bukkit"); final PlotSquared plotSquared = new PlotSquared(this, "Bukkit");
// FastAsyncWorldEdit // FAWE
if (Settings.FAWE_Components.FAWE_HOOK) { if (Settings.FAWE_Components.FAWE_HOOK) {
Plugin fawe = getServer().getPluginManager().getPlugin("FastAsyncWorldEdit"); Plugin fawe = getServer().getPluginManager().getPlugin("FastAsyncWorldEdit");
if (fawe != null) { if (fawe != null) {
@ -278,7 +278,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
Class.forName("com.fastasyncworldedit.bukkit.regions.plotsquared.FaweQueueCoordinator"); Class.forName("com.fastasyncworldedit.bukkit.regions.plotsquared.FaweQueueCoordinator");
faweHook = true; faweHook = true;
} catch (Exception ignored) { } catch (Exception ignored) {
LOGGER.error("Incompatible version of FastAsyncWorldEdit to enable hook, please upgrade: https://ci.athion" + LOGGER.error("Incompatible version of FAWE to enable hook, please upgrade: https://ci.athion" +
".net/job/FastAsyncWorldEdit/"); ".net/job/FastAsyncWorldEdit/");
} }
} }
@ -432,7 +432,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
plotSquared.startExpiryTasks(); plotSquared.startExpiryTasks();
// Once the server has loaded force updating all generators known to PlotSquared // Once the server has loaded force updating all generators known to P2
TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L)); TaskManager.runTaskLater(() -> PlotSquared.platform().setupUtils().updateGenerators(true), TaskTime.ticks(1L));
// Services are accessed in order // Services are accessed in order

View File

@ -46,7 +46,7 @@ final class BlockStatePopulator extends BlockPopulator {
private final IndependentPlotGenerator plotGenerator; private final IndependentPlotGenerator plotGenerator;
/** /**
* @since 6.9.0 * @since TODO
*/ */
public BlockStatePopulator( public BlockStatePopulator(
final @NonNull IndependentPlotGenerator plotGenerator final @NonNull IndependentPlotGenerator plotGenerator
@ -57,7 +57,7 @@ final class BlockStatePopulator extends BlockPopulator {
/** /**
* @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused * @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public BlockStatePopulator( public BlockStatePopulator(
final @NonNull IndependentPlotGenerator plotGenerator, final @NonNull IndependentPlotGenerator plotGenerator,
final @NonNull PlotAreaManager plotAreaManager final @NonNull PlotAreaManager plotAreaManager

View File

@ -116,7 +116,30 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
@Override @Override
public @NonNull List<BlockPopulator> getDefaultPopulators(@NonNull World world) { public @NonNull List<BlockPopulator> getDefaultPopulators(@NonNull World world) {
try { try {
checkLoaded(world); if (!this.loaded) {
String name = world.getName();
PlotSquared.get().loadWorld(name, this);
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(name);
if (!areas.isEmpty()) {
PlotArea area = areas.iterator().next();
if (!area.isMobSpawning()) {
if (!area.isSpawnEggs()) {
world.setSpawnFlags(false, false);
}
world.setAmbientSpawnLimit(0);
world.setAnimalSpawnLimit(0);
world.setMonsterSpawnLimit(0);
world.setWaterAnimalSpawnLimit(0);
} else {
world.setSpawnFlags(true, true);
world.setAmbientSpawnLimit(-1);
world.setAnimalSpawnLimit(-1);
world.setMonsterSpawnLimit(-1);
world.setWaterAnimalSpawnLimit(-1);
}
}
this.loaded = true;
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -135,39 +158,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
return toAdd; return toAdd;
} }
private synchronized void checkLoaded(@NonNull World world) {
// Do not attempt to load configurations until WorldEdit has a platform ready.
if (!PlotSquared.get().isWeInitialised()) {
return;
}
if (!this.loaded) {
String name = world.getName();
PlotSquared.get().loadWorld(name, this);
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(name);
if (!areas.isEmpty()) {
PlotArea area = areas.iterator().next();
if (!area.isMobSpawning()) {
if (!area.isSpawnEggs()) {
world.setSpawnFlags(false, false);
}
setSpawnLimits(world, 0);
} else {
world.setSpawnFlags(true, true);
setSpawnLimits(world, -1);
}
}
this.loaded = true;
}
}
@SuppressWarnings("deprecation")
private void setSpawnLimits(@NonNull World world, int limit) {
world.setAmbientSpawnLimit(limit);
world.setAnimalSpawnLimit(limit);
world.setMonsterSpawnLimit(limit);
world.setWaterAnimalSpawnLimit(limit);
}
@Override @Override
public @NonNull ChunkData generateChunkData( public @NonNull ChunkData generateChunkData(
@NonNull World world, @NonNull Random random, int x, int z, @NonNull World world, @NonNull Random random, int x, int z,
@ -214,7 +204,9 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) { private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
// Load if improperly loaded // Load if improperly loaded
if (!this.loaded) { if (!this.loaded) {
checkLoaded(world); String name = world.getName();
PlotSquared.get().loadWorld(name, this);
this.loaded = true;
} }
// Process the chunk // Process the chunk
if (ChunkManager.preProcessChunk(loc, result)) { if (ChunkManager.preProcessChunk(loc, result)) {

View File

@ -49,7 +49,7 @@ final class LegacyBlockStatePopulator extends BlockPopulator {
private final IndependentPlotGenerator plotGenerator; private final IndependentPlotGenerator plotGenerator;
/** /**
* @since 6.9.0 * @since TODO
*/ */
public LegacyBlockStatePopulator( public LegacyBlockStatePopulator(
final @NonNull IndependentPlotGenerator plotGenerator final @NonNull IndependentPlotGenerator plotGenerator

View File

@ -965,12 +965,7 @@ public class BlockEventListener implements Listener {
public void onBlockDispense(BlockDispenseEvent event) { public void onBlockDispense(BlockDispenseEvent event) {
Material type = event.getItem().getType(); Material type = event.getItem().getType();
switch (type.toString()) { switch (type.toString()) {
case "SHULKER_BOX", "WHITE_SHULKER_BOX", "ORANGE_SHULKER_BOX", "MAGENTA_SHULKER_BOX", "LIGHT_BLUE_SHULKER_BOX", case "SHULKER_BOX", "WHITE_SHULKER_BOX", "ORANGE_SHULKER_BOX", "MAGENTA_SHULKER_BOX", "LIGHT_BLUE_SHULKER_BOX", "YELLOW_SHULKER_BOX", "LIME_SHULKER_BOX", "PINK_SHULKER_BOX", "GRAY_SHULKER_BOX", "LIGHT_GRAY_SHULKER_BOX", "CYAN_SHULKER_BOX", "PURPLE_SHULKER_BOX", "BLUE_SHULKER_BOX", "BROWN_SHULKER_BOX", "GREEN_SHULKER_BOX", "RED_SHULKER_BOX", "BLACK_SHULKER_BOX", "CARVED_PUMPKIN", "WITHER_SKELETON_SKULL", "FLINT_AND_STEEL", "BONE_MEAL", "SHEARS", "GLASS_BOTTLE", "GLOWSTONE", "COD_BUCKET", "PUFFERFISH_BUCKET", "SALMON_BUCKET", "TROPICAL_FISH_BUCKET", "AXOLOTL_BUCKET", "BUCKET", "WATER_BUCKET", "LAVA_BUCKET" -> {
"YELLOW_SHULKER_BOX", "LIME_SHULKER_BOX", "PINK_SHULKER_BOX", "GRAY_SHULKER_BOX", "LIGHT_GRAY_SHULKER_BOX",
"CYAN_SHULKER_BOX", "PURPLE_SHULKER_BOX", "BLUE_SHULKER_BOX", "BROWN_SHULKER_BOX", "GREEN_SHULKER_BOX",
"RED_SHULKER_BOX", "BLACK_SHULKER_BOX", "CARVED_PUMPKIN", "WITHER_SKELETON_SKULL", "FLINT_AND_STEEL",
"BONE_MEAL", "SHEARS", "GLASS_BOTTLE", "GLOWSTONE", "COD_BUCKET", "PUFFERFISH_BUCKET", "SALMON_BUCKET",
"TROPICAL_FISH_BUCKET", "AXOLOTL_BUCKET", "BUCKET", "WATER_BUCKET", "LAVA_BUCKET", "TADPOLE_BUCKET" -> {
if (event.getBlock().getType() == Material.DROPPER) { if (event.getBlock().getType() == Material.DROPPER) {
return; return;
} }

View File

@ -208,7 +208,7 @@ public class EntityEventListener implements Listener {
} }
return; return;
} }
if (BukkitEntityUtil.checkEntity(entity, plot.getBasePlot(false))) { if (BukkitEntityUtil.checkEntity(entity, plot)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -92,9 +92,9 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
@Assisted final @NonNull Collection<BlockVector2> requestedChunks, @Assisted final @NonNull Collection<BlockVector2> requestedChunks,
@Assisted final @NonNull Runnable whenDone, @Assisted final @NonNull Runnable whenDone,
@Assisted final @NonNull Consumer<Throwable> throwableConsumer, @Assisted final @NonNull Consumer<Throwable> throwableConsumer,
@Assisted("unloadAfter") final boolean unloadAfter, @Assisted final boolean unloadAfter,
@Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers, @Assisted final @NonNull Collection<ProgressSubscriber> progressSubscribers,
@Assisted("forceSync") final boolean forceSync @Assisted final boolean forceSync
) { ) {
this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks); this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks);
this.availableChunks = new LinkedBlockingQueue<>(); this.availableChunks = new LinkedBlockingQueue<>();

View File

@ -235,7 +235,6 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
.withConsumer(consumer) .withConsumer(consumer)
.unloadAfter(isUnloadAfter()) .unloadAfter(isUnloadAfter())
.withProgressSubscribers(getProgressSubscribers()) .withProgressSubscribers(getProgressSubscribers())
.forceSync(isForceSync())
.build(); .build();
return super.enqueue(); return super.enqueue();
} }

View File

@ -110,7 +110,7 @@ public class GenChunk extends ScopedQueueCoordinator {
/** /**
* Set the world and XZ of the chunk being represented via {@link ChunkWrapper} * Set the world and XZ of the chunk being represented via {@link ChunkWrapper}
* *
* @param wrap PlotSquared ChunkWrapper * @param wrap P2 ChunkWrapper
*/ */
public void setChunk(@NonNull ChunkWrapper wrap) { public void setChunk(@NonNull ChunkWrapper wrap) {
chunk = null; chunk = null;

View File

@ -44,7 +44,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
* Wraps a {@link LimitedRegion} inside a {@link com.plotsquared.core.queue.QueueCoordinator} so it can be written to. * Wraps a {@link LimitedRegion} inside a {@link com.plotsquared.core.queue.QueueCoordinator} so it can be written to.
* *
* @since 6.9.0 * @since TODO
*/ */
public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator { public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
@ -53,7 +53,7 @@ public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
private final LimitedRegion limitedRegion; private final LimitedRegion limitedRegion;
/** /**
* @since 6.9.0 * @since TODO
*/ */
public LimitedRegionWrapperQueue(LimitedRegion limitedRegion) { public LimitedRegionWrapperQueue(LimitedRegion limitedRegion) {
super(null); super(null);

View File

@ -63,7 +63,7 @@ public class StateWrapper {
* @deprecated in favour of using WE methods for obtaining NBT, specifically by obtaining a * @deprecated in favour of using WE methods for obtaining NBT, specifically by obtaining a
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()} * {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public StateWrapper(org.bukkit.block.BlockState state) { public StateWrapper(org.bukkit.block.BlockState state) {
this.state = state; this.state = state;
} }
@ -267,7 +267,7 @@ public class StateWrapper {
* @deprecated in favour of using WorldEdit methods for obtaining NBT, specifically by obtaining a * @deprecated in favour of using WorldEdit methods for obtaining NBT, specifically by obtaining a
* {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()} * {@link com.sk89q.worldedit.world.block.BaseBlock} and then using {@link com.sk89q.worldedit.world.block.BaseBlock#getNbtData()}
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public CompoundTag getTag() { public CompoundTag getTag() {
if (this.tag != null) { if (this.tag != null) {
return this.tag; return this.tag;

View File

@ -359,9 +359,9 @@ public interface PlotPlatform<P> extends LocaleHolder {
@NonNull String toLegacyPlatformString(@NonNull Component component); @NonNull String toLegacyPlatformString(@NonNull Component component);
/** /**
* Returns if the FastAsyncWorldEdit-PlotSquared hook is active/enabled * Returns if the FAWE-P2 hook is active/enabled
* *
* @return status of FastAsyncWorldEdit-PlotSquared hook * @return status of FAWE-P2 hook
*/ */
default boolean isFaweHooking() { default boolean isFaweHooking() {
return false; return false;

View File

@ -72,10 +72,7 @@ import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDPipeline; import com.plotsquared.core.uuid.UUIDPipeline;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.util.eventbus.EventHandler;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@ -156,8 +153,6 @@ public class PlotSquared {
private EventDispatcher eventDispatcher; private EventDispatcher eventDispatcher;
private PlotListener plotListener; private PlotListener plotListener;
private boolean weInitialised;
/** /**
* Initialize PlotSquared with the desired Implementation class. * Initialize PlotSquared with the desired Implementation class.
* *
@ -228,7 +223,6 @@ public class PlotSquared {
} }
this.worldedit = WorldEdit.getInstance(); this.worldedit = WorldEdit.getInstance();
WorldEdit.getInstance().getEventBus().register(new WEPlatformReadyListener());
// Create Event utility class // Create Event utility class
this.eventDispatcher = new EventDispatcher(this.worldedit); this.eventDispatcher = new EventDispatcher(this.worldedit);
@ -1580,13 +1574,6 @@ public class PlotSquared {
return this.plotListener; return this.plotListener;
} }
/**
* Get if the {@link PlatformReadyEvent} has been sent by WorldEdit. There is no way to query this within WorldEdit itself.
*/
public boolean isWeInitialised() {
return weInitialised;
}
/** /**
* Different ways of sorting {@link Plot plots} * Different ways of sorting {@link Plot plots}
*/ */
@ -1609,15 +1596,4 @@ public class PlotSquared {
DISTANCE_FROM_ORIGIN DISTANCE_FROM_ORIGIN
} }
private final class WEPlatformReadyListener {
@SuppressWarnings("unused")
@Subscribe(priority = EventHandler.Priority.VERY_EARLY)
public void onPlatformReady(PlatformReadyEvent event) {
weInitialised = true;
WorldEdit.getInstance().getEventBus().unregister(WEPlatformReadyListener.this);
}
}
} }

View File

@ -62,7 +62,7 @@ public class Music extends SubCommand {
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp", .asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
"music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal", "music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal",
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_otherside", "music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_otherside",
"music_disc_pigstep", "music_disc_5" "music_disc_pigstep"
); );
private final InventoryUtil inventoryUtil; private final InventoryUtil inventoryUtil;

View File

@ -44,7 +44,7 @@ public class Settings extends Config {
@Comment("This value is not configurable. It shows the platform you are using.") // This is a comment @Comment("This value is not configurable. It shows the platform you are using.") // This is a comment
@Final @Final
public static String PLATFORM; // These values are set from PlotSquared before loading public static String PLATFORM; // These values are set from P2 before loading
@Comment({"Show additional information in console. It helps us at IntellectualSites to find out more about an issue.", @Comment({"Show additional information in console. It helps us at IntellectualSites to find out more about an issue.",
"Leave it off if you don't need it, it can spam your console."}) "Leave it off if you don't need it, it can spam your console."})
@ -634,10 +634,10 @@ public class Settings extends Config {
} }
@Comment("Enable or disable all of or parts of the FastAsyncWorldEdit-PlotSquared hook") @Comment("Enable or disable all of or parts of the FAWE-P2 hook")
public static final class FAWE_Components { public static final class FAWE_Components {
@Comment("Use FastAsyncWorldEdit for queue handling.") @Comment("Use FAWE for queue handling.")
public static boolean FAWE_HOOK = true; public static boolean FAWE_HOOK = true;
public static boolean CUBOIDS = true; public static boolean CUBOIDS = true;
public static boolean CLEAR = true; public static boolean CLEAR = true;

View File

@ -388,7 +388,7 @@ public class HybridGen extends IndependentPlotGenerator {
* Wrapper to allow a WorldEdit {@link Entity} to effectively have a mutable location as the location in its NBT should be changed * Wrapper to allow a WorldEdit {@link Entity} to effectively have a mutable location as the location in its NBT should be changed
* when set to the world. * when set to the world.
* *
* @since 6.9.0 * @since TODO
*/ */
private static final class PopulatingEntity implements Entity { private static final class PopulatingEntity implements Entity {
@ -396,7 +396,7 @@ public class HybridGen extends IndependentPlotGenerator {
private com.sk89q.worldedit.util.Location location; private com.sk89q.worldedit.util.Location location;
/** /**
* @since 6.9.0 * @since TODO
*/ */
private PopulatingEntity(Entity parent, com.sk89q.worldedit.util.Location location) { private PopulatingEntity(Entity parent, com.sk89q.worldedit.util.Location location) {
this.parent = parent; this.parent = parent;

View File

@ -75,7 +75,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
private static final AffineTransform transform = new AffineTransform().rotateY(90); private static final AffineTransform transform = new AffineTransform().rotateY(90);
public boolean ROAD_SCHEMATIC_ENABLED; public boolean ROAD_SCHEMATIC_ENABLED;
public boolean PLOT_SCHEMATIC = false; public boolean PLOT_SCHEMATIC = false;
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public int PLOT_SCHEMATIC_HEIGHT = -1; public int PLOT_SCHEMATIC_HEIGHT = -1;
public short PATH_WIDTH_LOWER; public short PATH_WIDTH_LOWER;
public short PATH_WIDTH_UPPER; public short PATH_WIDTH_UPPER;
@ -108,7 +108,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
PlotSquared.platform().injector().injectMembers(this); PlotSquared.platform().injector().injectMembers(this);
} }
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public static byte wrap(byte data, int start) { public static byte wrap(byte data, int start) {
if ((data >= start) && (data < (start + 4))) { if ((data >= start) && (data < (start + 4))) {
data = (byte) ((((data - start) + 2) & 3) + start); data = (byte) ((((data - start) + 2) & 3) + start);
@ -116,7 +116,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
return data; return data;
} }
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public static byte wrap2(byte data, int start) { public static byte wrap2(byte data, int start) {
if ((data >= start) && (data < (start + 2))) { if ((data >= start) && (data < (start + 2))) {
data = (byte) ((((data - start) + 1) & 1) + start); data = (byte) ((((data - start) + 1) & 1) + start);
@ -493,7 +493,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* Get the entities contained within the plot schematic for generation. Intended for internal use only. * Get the entities contained within the plot schematic for generation. Intended for internal use only.
* *
* @since 6.9.0 * @since TODO
*/ */
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.") @AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
public @Nullable List<Entity> getPlotSchematicEntities() { public @Nullable List<Entity> getPlotSchematicEntities() {
@ -503,7 +503,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* Get the minimum point of the plot schematic for generation. Intended for internal use only. * Get the minimum point of the plot schematic for generation. Intended for internal use only.
* *
* @since 6.9.0 * @since TODO
*/ */
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.") @AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
public @Nullable BlockVector3 getPlotSchematicMinPoint() { public @Nullable BlockVector3 getPlotSchematicMinPoint() {
@ -513,7 +513,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* Get if post-generation population of chunks with tiles/entities is needed for this world. Not for public API use. * Get if post-generation population of chunks with tiles/entities is needed for this world. Not for public API use.
* *
* @since 6.9.0 * @since TODO
*/ */
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.") @AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
public boolean populationNeeded() { public boolean populationNeeded() {
@ -523,7 +523,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
/** /**
* @deprecated in favour of {@link HybridPlotWorld#getSchematicRoot()} * @deprecated in favour of {@link HybridPlotWorld#getSchematicRoot()}
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public File getRoot() { public File getRoot() {
return this.root; return this.root;
} }
@ -532,7 +532,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
* Get the root folder for this world's generation schematics. May be null if schematics not initialised via * Get the root folder for this world's generation schematics. May be null if schematics not initialised via
* {@link HybridPlotWorld#setupSchematics()} * {@link HybridPlotWorld#setupSchematics()}
* *
* @since 6.9.0 * @since TODO
*/ */
public @Nullable File getSchematicRoot() { public @Nullable File getSchematicRoot() {
return this.root; return this.root;

View File

@ -53,7 +53,7 @@ public abstract class IndependentPlotGenerator {
* @param settings PlotArea (settings) * @param settings PlotArea (settings)
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings); public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
/** /**
@ -64,7 +64,7 @@ public abstract class IndependentPlotGenerator {
* @return True if any population occurred * @return True if any population occurred
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public boolean populateChunk(ScopedQueueCoordinator result, PlotArea settings) { public boolean populateChunk(ScopedQueueCoordinator result, PlotArea settings) {
return false; return false;
} }

View File

@ -25,7 +25,6 @@
*/ */
package com.plotsquared.core.inject.factory; package com.plotsquared.core.inject.factory;
import com.google.inject.assistedinject.Assisted;
import com.plotsquared.core.queue.ChunkCoordinator; import com.plotsquared.core.queue.ChunkCoordinator;
import com.plotsquared.core.queue.subscriber.ProgressSubscriber; import com.plotsquared.core.queue.subscriber.ProgressSubscriber;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
@ -45,9 +44,8 @@ public interface ChunkCoordinatorFactory {
final @NonNull Collection<BlockVector2> requestedChunks, final @NonNull Collection<BlockVector2> requestedChunks,
final @NonNull Runnable whenDone, final @NonNull Runnable whenDone,
final @NonNull Consumer<Throwable> throwableConsumer, final @NonNull Consumer<Throwable> throwableConsumer,
@Assisted("unloadAfter") final boolean unloadAfter, final boolean unloadAfter,
final @NonNull Collection<ProgressSubscriber> progressSubscribers, final @NonNull Collection<ProgressSubscriber> progressSubscribers
@Assisted("forceSync") final boolean forceSync
); );
} }

View File

@ -49,7 +49,7 @@ public sealed class Location extends BlockLoc implements Comparable<Location> pe
private final World<?> world; private final World<?> world;
/** /**
* @since 6.9.0 * @since TODO
*/ */
protected Location( protected Location(
final @NonNull World<?> world, final @NonNull BlockVector3 blockVector3, final @NonNull World<?> world, final @NonNull BlockVector3 blockVector3,

View File

@ -33,7 +33,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* Used internally for generation to reference locations in worlds that "don't exist yet". There is no guarantee that the world * Used internally for generation to reference locations in worlds that "don't exist yet". There is no guarantee that the world
* name provided by {@link UncheckedWorldLocation#getWorldName()} exists on the server. * name provided by {@link UncheckedWorldLocation#getWorldName()} exists on the server.
* *
* @since 6.9.0 * @since TODO
*/ */
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.") @AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
public final class UncheckedWorldLocation extends Location { public final class UncheckedWorldLocation extends Location {
@ -41,7 +41,7 @@ public final class UncheckedWorldLocation extends Location {
private final String worldName; private final String worldName;
/** /**
* @since 6.9.0 * @since TODO
*/ */
private UncheckedWorldLocation( private UncheckedWorldLocation(
final @NonNull String worldName, final int x, final int y, final int z final @NonNull String worldName, final int x, final int y, final int z
@ -59,7 +59,7 @@ public final class UncheckedWorldLocation extends Location {
* @param z Z coordinate * @param z Z coordinate
* @return New location * @return New location
* *
* @since 6.9.0 * @since TODO
*/ */
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.") @AnnotationHelper.ApiDescription(info = "Internal use only. Subject to changes at any time.")
public static @NonNull UncheckedWorldLocation at( public static @NonNull UncheckedWorldLocation at(

View File

@ -65,6 +65,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -964,31 +965,7 @@ public abstract class PlotArea {
return this.plots.remove(id) != null; return this.plots.remove(id) != null;
} }
/**
* Merge a list of plots together. This is non-blocking for the world-changes that will be made. To run a task when the
* world changes are complete, use {@link PlotArea#mergePlots(List, boolean, Runnable)};
*
* @param plotIds List of plot IDs to merge
* @param removeRoads If the roads between plots should be removed
* @return if merges were completed successfully.
*/
public boolean mergePlots(final @NonNull List<PlotId> plotIds, final boolean removeRoads) { public boolean mergePlots(final @NonNull List<PlotId> plotIds, final boolean removeRoads) {
return mergePlots(plotIds, removeRoads, null);
}
/**
* Merge a list of plots together. This is non-blocking for the world-changes that will be made.
*
* @param plotIds List of plot IDs to merge
* @param removeRoads If the roads between plots should be removed
* @param whenDone Task to run when any merge world changes are complete. Also runs if no changes were made. Does not
* run if there was an error or if too few plots IDs were supplied.
* @return if merges were completed successfully.
* @since 6.9.0
*/
public boolean mergePlots(
final @NonNull List<PlotId> plotIds, final boolean removeRoads, final @Nullable Runnable whenDone
) {
if (plotIds.size() < 2) { if (plotIds.size() < 2) {
return false; return false;
} }
@ -1051,9 +1028,6 @@ public abstract class PlotArea {
} }
} }
manager.finishPlotMerge(plotIds, queue); manager.finishPlotMerge(plotIds, queue);
if (whenDone != null) {
queue.setCompleteTask(whenDone);
}
queue.enqueue(); queue.enqueue();
return true; return true;
} }
@ -1405,7 +1379,7 @@ public abstract class PlotArea {
} }
/** /**
* Get the min height from which PlotSquared will generate blocks. Inclusive. * Get the min height from which P2 will generate blocks. Inclusive.
* *
* @since 6.6.0 * @since 6.6.0
*/ */
@ -1414,7 +1388,7 @@ public abstract class PlotArea {
} }
/** /**
* Get the max height to which PlotSquared will generate blocks. Inclusive. * Get the max height to which P2 will generate blocks. Inclusive.
* *
* @since 6.6.0 * @since 6.6.0
*/ */

View File

@ -44,7 +44,7 @@ public enum PlotAreaTerrainType {
ORE, ORE,
/** /**
* Generate everything using the vanilla generator but with PlotSquared roads. * Generate everything using the vanilla generator but with PS roads.
*/ */
ROAD, ROAD,

View File

@ -43,7 +43,7 @@ public abstract class ListFlag<V, F extends PlotFlag<List<V>, F>> extends PlotFl
@Override @Override
public F merge(@NonNull List<V> newValue) { public F merge(@NonNull List<V> newValue) {
final List<V> mergedList = new ArrayList<>(); final List<V> mergedList = new ArrayList<>();
// If a server already used PlotSquared before this fix, we remove all present duplicates on an eventual merge // If a server already used PS before this fix, we remove all present duplicates on an eventual merge
for (final V v : getValue()) { for (final V v : getValue()) {
if (!mergedList.contains(v)) { if (!mergedList.contains(v)) {
mergedList.add(v); mergedList.add(v);

View File

@ -58,7 +58,6 @@ public class ChunkCoordinatorBuilder {
private long maxIterationTime = Settings.QUEUE.MAX_ITERATION_TIME; // A little over 1 tick; private long maxIterationTime = Settings.QUEUE.MAX_ITERATION_TIME; // A little over 1 tick;
private int initialBatchSize = Settings.QUEUE.INITIAL_BATCH_SIZE; private int initialBatchSize = Settings.QUEUE.INITIAL_BATCH_SIZE;
private boolean unloadAfter = true; private boolean unloadAfter = true;
private boolean forceSync = false;
@Inject @Inject
public ChunkCoordinatorBuilder(@NonNull ChunkCoordinatorFactory chunkCoordinatorFactory) { public ChunkCoordinatorBuilder(@NonNull ChunkCoordinatorFactory chunkCoordinatorFactory) {
@ -198,18 +197,6 @@ public class ChunkCoordinatorBuilder {
return this; return this;
} }
/**
* Set whether the chunks coordinator should be forced to be synchronous. This is not necessarily synchronous to the server,
* and simply effectively makes {@link ChunkCoordinator#start()} ()} a blocking operation.
*
* @param forceSync force sync or not
* @since 6.9.0
*/
public @NonNull ChunkCoordinatorBuilder forceSync(final boolean forceSync) {
this.forceSync = forceSync;
return this;
}
public @NonNull ChunkCoordinatorBuilder withProgressSubscriber(ProgressSubscriber progressSubscriber) { public @NonNull ChunkCoordinatorBuilder withProgressSubscriber(ProgressSubscriber progressSubscriber) {
this.progressSubscribers.add(progressSubscriber); this.progressSubscribers.add(progressSubscriber);
return this; return this;
@ -240,8 +227,7 @@ public class ChunkCoordinatorBuilder {
this.whenDone, this.whenDone,
this.throwableConsumer, this.throwableConsumer,
this.unloadAfter, this.unloadAfter,
this.progressSubscribers, this.progressSubscribers
this.forceSync
); );
} }

View File

@ -39,7 +39,7 @@ 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. It does not allow a delegate queue and should be treated as a cache for changes to
* be set to. Does not support tile entities or entities. * be set to. Does not support tile entities or entities.
* *
* @deprecated This class is poorly designed and will no longer be used in PlotSquared * @deprecated This class is poorly designed and will no longer be used in P2
*/ */
@Deprecated(forRemoval = true, since = "6.8.0") @Deprecated(forRemoval = true, since = "6.8.0")
public class ChunkQueueCoordinator extends ScopedQueueCoordinator { public class ChunkQueueCoordinator extends ScopedQueueCoordinator {

View File

@ -40,12 +40,14 @@ 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;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import java.util.concurrent.atomic.AtomicBoolean;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer; import java.util.function.Consumer;
public abstract class QueueCoordinator { public abstract class QueueCoordinator {
@ -93,7 +95,7 @@ public abstract class QueueCoordinator {
* @since 6.6.0 * @since 6.6.0
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) { public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) {
int bx = x << 4; int bx = x << 4;
int bz = z << 4; int bz = z << 4;
@ -117,8 +119,7 @@ public abstract class QueueCoordinator {
public abstract void setModified(long modified); public abstract void setModified(long modified);
/** /**
* Returns true if the queue should be forced to be synchronous when enqueued. This is not necessarily synchronous to the * Returns true if the queue should be forced to be synchronous when enqueued.
* server, and simply effectively makes {@link QueueCoordinator#enqueue()} a blocking operation.
* *
* @return is force sync * @return is force sync
*/ */
@ -127,8 +128,7 @@ public abstract class QueueCoordinator {
} }
/** /**
* Set whether the queue should be forced to be synchronous. This is not necessarily synchronous to the server, and simply * Set whether the queue should be forced to be synchronous
* effectively makes {@link QueueCoordinator#enqueue()} a blocking operation.
* *
* @param forceSync force sync or not * @param forceSync force sync or not
*/ */

View File

@ -45,7 +45,7 @@ public abstract class ChunkManager {
/** /**
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public static void setChunkInPlotArea( public static void setChunkInPlotArea(
RunnableVal<ScopedQueueCoordinator> force, RunnableVal<ScopedQueueCoordinator> force,
RunnableVal<ScopedQueueCoordinator> add, RunnableVal<ScopedQueueCoordinator> add,
@ -86,7 +86,7 @@ public abstract class ChunkManager {
/** /**
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public static boolean preProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) { public static boolean preProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
final RunnableVal<ScopedQueueCoordinator> forceChunk = forceChunks.get(loc); final RunnableVal<ScopedQueueCoordinator> forceChunk = forceChunks.get(loc);
if (forceChunk != null) { if (forceChunk != null) {
@ -100,7 +100,7 @@ public abstract class ChunkManager {
/** /**
* @deprecated {@link ScopedQueueCoordinator} will be renamed in v7. * @deprecated {@link ScopedQueueCoordinator} will be renamed in v7.
*/ */
@Deprecated(forRemoval = true, since = "6.9.0") @Deprecated(forRemoval = true, since = "TODO")
public static boolean postProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) { public static boolean postProcessChunk(BlockVector2 loc, ScopedQueueCoordinator queue) {
final RunnableVal<ScopedQueueCoordinator> addChunk = forceChunks.get(loc); final RunnableVal<ScopedQueueCoordinator> addChunk = forceChunks.get(loc);
if (addChunk != null) { if (addChunk != null) {

View File

@ -174,7 +174,7 @@ public abstract class RegionManager {
* @param whenDone task to run when complete * @param whenDone task to run when complete
* @param manager plot manager * @param manager plot manager
* @param actor the player running the clear * @param actor the player running the clear
* @return {@code true} if the clear worked. {@code false} if someone went wrong so PlotSquared can then handle the clear * @return {@code true} if the clear worked. {@code false} if someone went wrong so P2 can then handle the clear
*/ */
public abstract boolean handleClear( public abstract boolean handleClear(
@NonNull Plot plot, @NonNull Plot plot,

View File

@ -109,7 +109,7 @@ public class RegionUtil {
return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ()); return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ());
} }
// Because WorldEdit (not FastAsyncWorldEdit) lack this for CuboidRegion // Because WE (not fawe) lack this for CuboidRegion
public static boolean intersects(CuboidRegion region, CuboidRegion other) { public static boolean intersects(CuboidRegion region, CuboidRegion other) {
BlockVector3 regionMin = region.getMinimumPoint(); BlockVector3 regionMin = region.getMinimumPoint();
BlockVector3 regionMax = region.getMaximumPoint(); BlockVector3 regionMax = region.getMaximumPoint();

View File

@ -167,7 +167,7 @@ public final class TabCompletions {
} }
/** /**
* Get a list of completions corresponding to WorldEdit(/FastAsyncWorldEdit) patterns. This uses * Get a list of completions corresponding to WorldEdit(/FAWE) patterns. This uses
* WorldEdit's pattern completer internally. * WorldEdit's pattern completer internally.
* *
* @param input Command input * @param input Command input

View File

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.svg" width="250"> <img src="https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.svg" width="300">
</p> </p>
--- ---
@ -41,20 +41,15 @@ is to provide a lag-free and smooth experience.
* [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/) * [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/)
* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/) * [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/)
* [PlotHider](https://www.spigotmc.org/resources/plot-hider.20701/) * [PlotHider](https://www.spigotmc.org/resources/plot-hider.20701/)
### Unmaintained or integrated into PlotSquared
* [AdvPlots](http://www.spigotmc.org/resources/advplots-%CE%B2.1500/)
* [PlotRankup](http://www.spigotmc.org/resources/plotrankup.1571/)
* [PlotZSux](https://www.spigotmc.org/resources/plotzsux.9563/)
* [IslandPlots](https://www.spigotmc.org/resources/islandplots.9421/)
* [BiomeGenerator](https://www.spigotmc.org/resources/biomegenerator.1663/)
* [PlotSquaredMG](https://www.spigotmc.org/resources/plotsquaredmg.8025/)
* [BasicPlots](https://www.spigotmc.org/resources/basicplots.6901/)
### Edit The Code # Sponsors
Our official sponsor list can be found [here](https://intellectualsites.github.io/download/sponsors.html). <br>
Want to add new features to PlotSquared or fix bugs yourself? You can get the game running, with PlotSquared, from the code here: If you are interested and want to be listed here, [contact us](https://intellectualsites.github.io/download/contact.html).
For additional information about compiling PlotSquared, see [CONTRIBUTING.md](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md)
### Submitting Your Changes
PlotSquared is open source (specifically licensed under GPL v3), so note that your contributions will also be open source. The best way to submit a change is to create a fork on GitHub, put your changes there, and then create a "pull request" on our PlotSquared repository.
<a href="https://yourkit.com/">
<img src="https://www.yourkit.com/images/yklogo.png">
</a>
Thank you to YourKit for supporting our product by providing us with their innovative and intelligent tools
for monitoring and profiling Java and .NET applications.
YourKit is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).

View File

@ -18,7 +18,7 @@ plugins {
idea idea
} }
version = "6.9.0" version = "6.8.2-SNAPSHOT"
allprojects { allprojects {
group = "com.plotsquared" group = "com.plotsquared"

View File

@ -13,7 +13,7 @@
], ],
"timezone": "Europe/Berlin", "timezone": "Europe/Berlin",
"schedule": [ "schedule": [
"every monday" "on monday after 9am"
], ],
"labels": ["Renovate"], "labels": ["Renovate"],
"commitMessagePrefix": "build: ", "commitMessagePrefix": "build: ",