diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d75377ab6..9c915669a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,9 +5,6 @@ Thank you for your interest in contributing to FastAsyncWorldEdit! We appreciate effort, but to make sure that the inclusion of your patch is a smooth process, we ask that you make note of the following guidelines. -* **Follow the [Oracle coding conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html).** - We can't stress this enough; if your code has notable issues, it may delay - the process significantly. * **Target Java 11 for source and compilation.** Make sure to mark methods with ` @Override` that override methods of parent classes, or that implement methods of interfaces. @@ -24,6 +21,8 @@ ask that you make note of the following guidelines. around ten minutes to think about what the code is doing and whether it seems awfully roundabout. If you had to copy the same large piece of code in several places, that's bad. +* **Annotate modified upstream (WorldEdit) code.** Doing so makes it easier to differentiate + between modifications. Take a look at the [Examples](#example) how that's been done. * **Keep commit summaries under 70 characters.** For more details, place two new lines after the summary line and write away! * **Test your code.** We're not interested in broken code, for the obvious reasons. @@ -60,15 +59,33 @@ adjust past changes. Example ------- +### Code style This is **GOOD:** +```java if (var.func(param1, param2)) { // do things } +``` This is **VERY BAD:** - +```java if(var.func( param1, param2 )) { // do things } +``` + +### Diff Annotations +```java +//FAWE start +public Region[] getCurrentRegions(FaweMaskManager.MaskType type) { + return WEManager.IMP.getMask(this, type); +} +//FAWE end +``` +```java +//FAWE start - extends PassthroughExtent > implements Extent +public class EditSession extends PassthroughExtent implements AutoCloseable { +//FAWE end +``` diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index b64b6e3ce..ed73c93fc 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -99,6 +99,8 @@ dependencies { api("com.intellectualsites.paster:Paster:1.0.1-SNAPSHOT") api("org.lz4:lz4-java:1.8.0") api("net.jpountz:lz4-java-stream:1.0.0") { isTransitive = false } + api("com.zaxxer:SparseBitSet:1.2") { isTransitive = false } + api("org.anarres:parallelgzip:1.0.5") { isTransitive = false } // Third party implementation("org.bstats:bstats-bukkit:2.2.1") implementation("org.bstats:bstats-base:2.2.1") @@ -179,7 +181,14 @@ tasks.named("shadowJar") { relocate("net.kyori", "com.fastasyncworldedit.core.adventure") { include(dependency("net.kyori:adventure-nbt:4.8.1")) } + relocate("com.zaxxer", "com.fastasyncworldedit.core.math") { + include(dependency("com.zaxxer:SparseBitSet:1.2")) + } + relocate("org.anarres", "com.fastasyncworldedit.core.internal.io") { + include(dependency("org.anarres:parallelgzip:1.0.5")) + } } + minimize() } tasks.named("assemble").configure { diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index dc2dff706..3b97d5140 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -4,9 +4,9 @@ import com.fastasyncworldedit.bukkit.util.image.BukkitImageViewer; import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.IFawe; -import com.fastasyncworldedit.core.beta.implementation.preloader.AsyncPreloader; -import com.fastasyncworldedit.core.beta.implementation.preloader.Preloader; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.preloader.AsyncPreloader; +import com.fastasyncworldedit.core.queue.implementation.preloader.Preloader; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.bukkit.adapter.BukkitQueueHandler; import com.fastasyncworldedit.bukkit.adapter.NMSAdapter; import com.fastasyncworldedit.bukkit.listener.BrushListener; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java index 1170acf56..a843ec0d5 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.bukkit.adapter; import co.aikar.timings.Timings; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.bukkit.listener.ChunkListener; import com.sk89q.worldedit.internal.util.LogManagerCompat; import org.apache.logging.log4j.Logger; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java index b6f3c1a34..5ef39ed05 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.bukkit.adapter; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; -import com.sk89q.jnbt.CompoundTag; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/MapChunkUtil.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/MapChunkUtil.java index 4841771ee..48a22340e 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/MapChunkUtil.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/MapChunkUtil.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.bukkit.adapter; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java index 2b6f736f2..bed4f7e80 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java @@ -1,11 +1,11 @@ package com.fastasyncworldedit.bukkit.adapter; import com.fastasyncworldedit.core.FAWEPlatformAdapterImpl; -import com.fastasyncworldedit.core.beta.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkGet; import com.fastasyncworldedit.core.configuration.Settings; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockID; +import com.fastasyncworldedit.core.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSRelighterFactory.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSRelighterFactory.java index ff436f235..5a81211f5 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSRelighterFactory.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSRelighterFactory.java @@ -1,12 +1,12 @@ package com.fastasyncworldedit.bukkit.adapter; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.lighting.NMSRelighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.Relighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelighterFactory; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RelightMode; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; import com.sk89q.worldedit.world.World; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java index 65ce4ff07..a0c75720e 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java @@ -1,8 +1,8 @@ package com.fastasyncworldedit.bukkit.adapter; -import com.fastasyncworldedit.core.beta.IChunkCache; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.queue.SingleThreadQueueExtent; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.SingleThreadQueueExtent; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefDefenderFilter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefDefenderFilter.java index 9679af1c6..5f4e79629 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefDefenderFilter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefDefenderFilter.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.bukkit.filter; -import com.fastasyncworldedit.core.regions.general.CuboidRegionFilter; +import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.math.BlockVector2; import com.griefdefender.api.claim.Claim; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefPreventionFilter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefPreventionFilter.java index 3087e01cc..e95b83310 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefPreventionFilter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/GriefPreventionFilter.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.bukkit.filter; -import com.fastasyncworldedit.core.regions.general.CuboidRegionFilter; +import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.math.BlockVector2; import me.ryanhamshire.GriefPrevention.Claim; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/WorldGuardFilter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/WorldGuardFilter.java index eff5c6864..1838c8fc1 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/WorldGuardFilter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/filter/WorldGuardFilter.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.bukkit.filter; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.regions.general.CuboidRegionFilter; +import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/BrushListener.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/BrushListener.java index 888f59924..c2f5100fe 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/BrushListener.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/BrushListener.java @@ -1,8 +1,8 @@ package com.fastasyncworldedit.bukkit.listener; -import com.fastasyncworldedit.core.object.brush.MovableTool; -import com.fastasyncworldedit.core.object.brush.ResettableTool; -import com.fastasyncworldedit.core.object.brush.scroll.ScrollTool; +import com.fastasyncworldedit.core.command.tool.MovableTool; +import com.fastasyncworldedit.core.command.tool.ResettableTool; +import com.fastasyncworldedit.core.command.tool.scroll.ScrollTool; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitPlayer; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefDefenderFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefDefenderFeature.java index ae7634cf6..50078c63c 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefDefenderFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefDefenderFeature.java @@ -2,7 +2,7 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.bukkit.filter.GriefDefenderFilter; import com.fastasyncworldedit.core.regions.FaweMask; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.flowpowered.math.vector.Vector3i; import com.griefdefender.api.GriefDefender; import com.griefdefender.api.claim.Claim; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java index cde423567..fd741d0e9 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java @@ -2,7 +2,7 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.bukkit.filter.GriefPreventionFilter; import com.fastasyncworldedit.core.regions.FaweMask; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java index b49bceb13..3b833954d 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/WorldGuardFeature.java @@ -1,9 +1,9 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.bukkit.filter.WorldGuardFilter; -import com.fastasyncworldedit.core.object.RegionWrapper; +import com.fastasyncworldedit.core.regions.RegionWrapper; import com.fastasyncworldedit.core.regions.FaweMask; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java index ea6abd83c..63750e071 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; import com.fastasyncworldedit.core.FaweAPI; -import com.fastasyncworldedit.core.object.RelightMode; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.TaskManager; import com.plotsquared.core.configuration.Settings; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java index c14032e58..91ed24a7e 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java @@ -3,7 +3,6 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.object.io.PGZIPOutputStream; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.IOUtil; import com.plotsquared.core.PlotSquared; @@ -16,22 +15,23 @@ import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.TaskManager; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.CompressedCompoundTag; +import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; -import com.sk89q.jnbt.fawe.CompressedSchematicTag; +import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.FastSchematicReader; -import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter; import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader; import com.sk89q.worldedit.extent.clipboard.io.SpongeSchematicReader; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import net.jpountz.lz4.LZ4BlockInputStream; +import org.anarres.parallelgzip.ParallelGZIPOutputStream; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -136,19 +136,19 @@ public class FaweDelegateSchematicHandler { Clipboard clipboard = (Clipboard) cTag.getSource(); try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream( - new BufferedOutputStream(new PGZIPOutputStream(stream)))) { + new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) { new FastSchematicWriter(output).write(clipboard); } } else { try (OutputStream stream = new FileOutputStream(tmp); - BufferedOutputStream output = new BufferedOutputStream(new PGZIPOutputStream(stream))) { + BufferedOutputStream output = new BufferedOutputStream(new ParallelGZIPOutputStream(stream))) { LZ4BlockInputStream is = cTag.adapt(cTag.getSource()); IOUtil.copy(is, output); } } } else { try (OutputStream stream = new FileOutputStream(tmp); - NBTOutputStream output = new NBTOutputStream(new PGZIPOutputStream(stream))) { + NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(stream))) { Map map = tag.getValue(); output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag)); } @@ -177,7 +177,7 @@ public class FaweDelegateSchematicHandler { BuiltInClipboardFormat.SPONGE_SCHEMATIC.write(output, clipboard); } try { - try (PGZIPOutputStream gzip = new PGZIPOutputStream(output)) { + try (ParallelGZIPOutputStream gzip = new ParallelGZIPOutputStream(output)) { try (NBTOutputStream nos = new NBTOutputStream(gzip)) { Map map = weTag.getValue(); nos.writeNamedTag("Schematic", map.getOrDefault("Schematic", weTag)); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweQueueCoordinator.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweQueueCoordinator.java index 22802403d..7946af39f 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweQueueCoordinator.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweQueueCoordinator.java @@ -2,8 +2,8 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; import com.plotsquared.core.queue.LightingMode; import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.queue.subscriber.ProgressSubscriber; @@ -12,7 +12,7 @@ import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotRegionFilter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotRegionFilter.java index f343401a4..9eeb549b4 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotRegionFilter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotRegionFilter.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; -import com.fastasyncworldedit.core.regions.general.CuboidRegionFilter; +import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter; import com.plotsquared.core.location.Location; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index 0f35e54ee..984b4d6b4 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -3,7 +3,7 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.FaweMaskManager; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.command.MainCommand; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweLocalBlockQueue.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweLocalBlockQueue.java index 62e63f214..1e8e3531d 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweLocalBlockQueue.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweLocalBlockQueue.java @@ -3,13 +3,13 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweSchematicHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweSchematicHandler.java index f67b62009..02a87e35b 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweSchematicHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/FaweSchematicHandler.java @@ -2,8 +2,7 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4; import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.object.clipboard.ReadOnlyClipboard; -import com.fastasyncworldedit.core.object.io.PGZIPOutputStream; +import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.IOUtil; import com.fastasyncworldedit.core.util.TaskManager; @@ -14,8 +13,8 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler; import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.CompressedCompoundTag; -import com.sk89q.jnbt.fawe.CompressedSchematicTag; +import com.fastasyncworldedit.core.jnbt.CompressedCompoundTag; +import com.fastasyncworldedit.core.jnbt.CompressedSchematicTag; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.EditSession; @@ -23,11 +22,12 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.World; import net.jpountz.lz4.LZ4BlockInputStream; +import org.anarres.parallelgzip.ParallelGZIPOutputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -84,17 +84,17 @@ public class FaweSchematicHandler extends SchematicHandler { CompressedCompoundTag cTag = (CompressedCompoundTag) tag; if (cTag instanceof CompressedSchematicTag) { Clipboard clipboard = (Clipboard) cTag.getSource(); - try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new BufferedOutputStream(new PGZIPOutputStream(stream)))) { + try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new BufferedOutputStream(new ParallelGZIPOutputStream(stream)))) { new FastSchematicWriter(output).write(clipboard); } } else { - try (OutputStream stream = new FileOutputStream(tmp); BufferedOutputStream output = new BufferedOutputStream(new PGZIPOutputStream(stream))) { + try (OutputStream stream = new FileOutputStream(tmp); BufferedOutputStream output = new BufferedOutputStream(new ParallelGZIPOutputStream(stream))) { LZ4BlockInputStream is = cTag.adapt(cTag.getSource()); IOUtil.copy(is, stream); } } } else { - try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new PGZIPOutputStream(stream))) { + try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new ParallelGZIPOutputStream(stream))) { Map map = tag.getValue(); output.writeNamedTag("Schematic", map.getOrDefault("Schematic", tag)); } @@ -126,7 +126,7 @@ public class FaweSchematicHandler extends SchematicHandler { @Override public void run(OutputStream output) { try { - try (PGZIPOutputStream gzip = new PGZIPOutputStream(output)) { + try (ParallelGZIPOutputStream gzip = new ParallelGZIPOutputStream(output)) { try (NBTOutputStream nos = new NBTOutputStream(gzip)) { Map map = weTag.getValue(); nos.writeNamedTag("Schematic", map.getOrDefault("Schematic", weTag)); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotRegionFilter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotRegionFilter.java index 403f28fc4..5043e1b1f 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotRegionFilter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotRegionFilter.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4; -import com.fastasyncworldedit.core.regions.general.CuboidRegionFilter; +import com.fastasyncworldedit.core.regions.filter.CuboidRegionFilter; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java index 9b31c0c3b..9c25b5076 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquaredv4/PlotSquaredFeature.java @@ -1,10 +1,10 @@ package com.fastasyncworldedit.bukkit.regions.plotsquaredv4; import com.fastasyncworldedit.core.FaweAPI; -import com.fastasyncworldedit.core.object.RegionWrapper; +import com.fastasyncworldedit.core.regions.RegionWrapper; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.FaweMaskManager; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.commands.MainCommand; import com.github.intellectualsites.plotsquared.plot.config.Settings; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/WorldUnloadedException.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/WorldUnloadedException.java index 5c36e6716..606da898d 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/WorldUnloadedException.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/WorldUnloadedException.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - package com.fastasyncworldedit.bukkit.util; import com.fastasyncworldedit.core.configuration.Caption; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index fd3a8c816..2c6f3e063 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -62,7 +62,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Adapts between Bukkit and WorldEdit equivalent objects. */ -// FAWE start - enum-ized +//FAWE start - enum-ized public enum BukkitAdapter { INSTANCE; @@ -77,7 +77,7 @@ public enum BukkitAdapter { return INSTANCE.adapter; } - // FAWE end + //FAWE end private static final ParserContext TO_BLOCK_CONTEXT = new ParserContext(); @@ -93,9 +93,9 @@ public enum BukkitAdapter { * @return If they are equal */ public static boolean equals(BlockType blockType, Material type) { - // FAWE start - swapped reference to getAdapter + //FAWE start - swapped reference to getAdapter return getAdapter().equals(blockType, type); - // FAWE end + //FAWE end } /** @@ -108,9 +108,9 @@ public enum BukkitAdapter { * @return a wrapped Bukkit world */ public static BukkitWorld asBukkitWorld(World world) { - // FAWE start - logic moved to IBukkitAdapter + //FAWE start - logic moved to IBukkitAdapter return getAdapter().asBukkitWorld(world); - // FAWE end + //FAWE end } /** @@ -120,9 +120,9 @@ public enum BukkitAdapter { * @return a WorldEdit world */ public static World adapt(org.bukkit.World world) { - // FAWE start - logic moved to IBukkitAdapter + //FAWE start - logic moved to IBukkitAdapter return getAdapter().adapt(world); - // FAWE end + //FAWE end } /** diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java index b2350aa1c..f8c73ca8a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -146,7 +146,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry { } } - // FAWE start + //FAWE start @Override public Collection values() { ArrayList blocks = new ArrayList<>(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 6b483b3ff..bb0b3aaa7 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.bukkit; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RunnableVal; +import com.fastasyncworldedit.core.util.task.RunnableVal; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.util.StringUtil; import com.sk89q.wepif.VaultResolver; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java index 1b054ceff..ecac5bc43 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayerBlockBag.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBagException; import com.sk89q.worldedit.extent.inventory.OutOfBlocksException; import com.sk89q.worldedit.extent.inventory.OutOfSpaceException; -import com.sk89q.worldedit.extent.inventory.SlottableBlockBag; +import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BlockState; import org.bukkit.entity.Player; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 9426b29bc..b16b75330 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.bukkit; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelighterFactory; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; import com.google.common.collect.Sets; import com.sk89q.bukkit.util.CommandInfo; import com.sk89q.bukkit.util.CommandRegistration; @@ -218,12 +218,12 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser return plugin.getDescription().getVersion(); } - // FAWE start + //FAWE start @Override public String getId() { return "intellectualsites:bukkit"; } - // FAWE end + //FAWE end @Override public Map getCapabilities() { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 8dfb39b2a..5ee117033 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.bukkit; import com.fastasyncworldedit.bukkit.util.WorldUnloadedException; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.sk89q.jnbt.CompoundTag; @@ -311,11 +311,11 @@ public class BukkitWorld extends AbstractWorld { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { if (treeTypeMapping.get(type) == null) { LOGGER.error("No TreeType mapping for TreeGenerator.TreeType." + type); - // FAWE start + //FAWE start LOGGER.warn("Your FAWE version is newer than " + Bukkit.getVersion() + " and contains features of future minecraft versions which do not exist in " + Bukkit.getVersion() + ", hence the tree type " + type + " is not available."); - // FAWE end + //FAWE end } } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index ca3233385..4de9ee2c6 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -112,7 +112,7 @@ public class WorldEditPlugin extends JavaPlugin { @Override public void onLoad() { - // FAWE start + //FAWE start // This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt. Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); for (Plugin p : plugins) { @@ -122,7 +122,7 @@ public class WorldEditPlugin extends JavaPlugin { "Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder."); } } - // FAWE end + //FAWE end INSTANCE = this; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index c84613c80..5994fc68f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -23,9 +23,9 @@ import com.fastasyncworldedit.bukkit.FaweBukkit; import com.fastasyncworldedit.bukkit.adapter.IBukkitAdapter; import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelighterFactory; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.sk89q.jnbt.AdventureNBTConverter; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.blocks.BaseItem; @@ -67,9 +67,9 @@ import javax.annotation.Nullable; /** * An interface for adapters of various Bukkit implementations. */ -// FAWE start - Generic & extends IBukkitAdapter +//FAWE start - Generic & extends IBukkitAdapter public interface BukkitImplAdapter extends IBukkitAdapter { -// FAWE end +//FAWE end /** * Get a data fixer, or null if not supported. @@ -225,10 +225,10 @@ public interface BukkitImplAdapter extends IBukkitAdapter { Set getSupportedSideEffects(); default OptionalInt getInternalBlockStateId(BlockData data) { - // FAWE start + //FAWE start // return OptionalInt.empty(); return getInternalBlockStateId(BukkitAdapter.adapt(data)); - // FAWE end + //FAWE end } /** @@ -253,7 +253,7 @@ public interface BukkitImplAdapter extends IBukkitAdapter { throw new UnsupportedOperationException("This adapter does not support regeneration."); } - // FAWE start + //FAWE start default BlockMaterial getMaterial(BlockType blockType) { return getMaterial(blockType.getDefaultState()); } @@ -306,5 +306,5 @@ public interface BukkitImplAdapter extends IBukkitAdapter { default RelighterFactory getRelighterFactory() { return new NMSRelighterFactory(); // TODO implement in adapters instead } - // FAWE end + //FAWE end } diff --git a/worldedit-bukkit/src/main/resources/worldedit-adapters.jar b/worldedit-bukkit/src/main/resources/worldedit-adapters.jar index 4869bbdd6..c06d25efa 100644 Binary files a/worldedit-bukkit/src/main/resources/worldedit-adapters.jar and b/worldedit-bukkit/src/main/resources/worldedit-adapters.jar differ diff --git a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIPlatform.java b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIPlatform.java index d343530ef..ca0f9efed 100644 --- a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIPlatform.java +++ b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIPlatform.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.cli; -import com.fastasyncworldedit.core.beta.implementation.lighting.NullRelighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelighterFactory; +import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; import com.google.common.collect.ImmutableSet; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.AbstractPlatform; diff --git a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java index f751e377b..4b602102e 100644 --- a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java +++ b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/schematic/ClipboardWorld.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.cli.schematic; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.google.common.collect.ImmutableSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index b746b5724..23bff3acb 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -51,6 +51,8 @@ dependencies { api("com.intellectualsites.paster:Paster:1.0.1-SNAPSHOT") compileOnly("net.jpountz:lz4-java-stream:1.0.0") { isTransitive = false } compileOnly("org.lz4:lz4-java:1.8.0") + compileOnly("com.zaxxer:SparseBitSet:1.2") + compileOnly("org.anarres:parallelgzip:1.0.5") } tasks.named("test") { diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java index 82db080fe..d4084ccfd 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java @@ -40,7 +40,7 @@ import java.util.Map; * @deprecated WorldEdit does not handle interpreting NBT, * deprecated for removal without replacement */ -@Deprecated +@Deprecated(forRemoval = true) public class MobSpawnerBlock extends BaseBlock { private String mobType; diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java index 184a673a6..3b54302fc 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java @@ -35,7 +35,7 @@ import java.util.Map; * @deprecated WorldEdit does not handle interpreting NBT, * deprecated for removal without replacement */ -@Deprecated +@Deprecated(forRemoval = true) public class SignBlock extends BaseBlock { private String[] text; diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java index 88d0fe593..e5ea3da6f 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SkullBlock.java @@ -35,7 +35,7 @@ import java.util.Map; * @deprecated WorldEdit does not handle interpreting NBT, * deprecated for removal without replacement */ -@Deprecated +@Deprecated(forRemoval = true) public class SkullBlock extends BaseBlock { private String owner = ""; // notchian diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FAWEPlatformAdapterImpl.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FAWEPlatformAdapterImpl.java index b1f09f1c4..9f9e175e7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FAWEPlatformAdapterImpl.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FAWEPlatformAdapterImpl.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.core; -import com.fastasyncworldedit.core.beta.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkGet; public interface FAWEPlatformAdapterImpl { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index 04a30772b..eff0ac4a4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.core; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.util.CachedTextureUtil; import com.fastasyncworldedit.core.util.CleanTextureUtil; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java index cc9bdc76b..463f024f1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweAPI.java @@ -1,15 +1,15 @@ package com.fastasyncworldedit.core; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.lighting.Relighter; -import com.fastasyncworldedit.core.beta.implementation.queue.ParallelQueueExtent; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.queue.implementation.ParallelQueueExtent; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.RelightMode; -import com.fastasyncworldedit.core.object.changeset.DiskStorageHistory; -import com.fastasyncworldedit.core.object.changeset.SimpleChangeSetSummary; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; +import com.fastasyncworldedit.core.history.DiskStorageHistory; +import com.fastasyncworldedit.core.history.changeset.SimpleChangeSetSummary; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.MainUtil; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java index 507519dff..67089b862 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java @@ -1,17 +1,17 @@ package com.fastasyncworldedit.core; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.Trimable; -import com.fastasyncworldedit.core.beta.implementation.queue.Pool; -import com.fastasyncworldedit.core.beta.implementation.queue.QueuePool; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.Trimable; +import com.fastasyncworldedit.core.queue.Pool; +import com.fastasyncworldedit.core.queue.implementation.QueuePool; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.collection.BitArray; -import com.fastasyncworldedit.core.object.collection.BitArrayUnstretched; -import com.fastasyncworldedit.core.object.collection.CleanableThreadLocal; -import com.fastasyncworldedit.core.object.exception.FaweBlockBagException; -import com.fastasyncworldedit.core.object.exception.FaweChunkLoadException; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.math.BitArray; +import com.fastasyncworldedit.core.math.BitArrayUnstretched; +import com.fastasyncworldedit.core.util.collection.CleanableThreadLocal; +import com.fastasyncworldedit.core.internal.exception.FaweBlockBagException; +import com.fastasyncworldedit.core.internal.exception.FaweChunkLoadException; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.util.MathMan; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -31,8 +31,8 @@ import com.sk89q.jnbt.ShortTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.MutableBlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.world.block.BlockTypesCache; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/IFawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/IFawe.java index b1f8d084c..345009367 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/IFawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/IFawe.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.core; -import com.fastasyncworldedit.core.beta.implementation.preloader.Preloader; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.preloader.Preloader; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.image.ImageViewer; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/FilterBlockMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/FilterBlockMask.java deleted file mode 100644 index ba5d84478..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/FilterBlockMask.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.fastasyncworldedit.core.beta; - -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; - -public interface FilterBlockMask { - - boolean applyBlock(FilterBlock block); -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/ListFilters.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/ListFilters.java index 27c292987..61fd874c5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ListFilters.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/ListFilters.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.command; +package com.fastasyncworldedit.core.command; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.util.StringMan; @@ -13,7 +13,6 @@ import java.util.UUID; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -//TODO This class breaks compilation //@CommandContainer public class ListFilters { public class Filter { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MaskCommands.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MaskCommands.java index f4424f1dd..019e309ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MaskCommands.java @@ -1,5 +1,5 @@ // TODO: Ping @MattBDev to reimplement (or remove because this class is stupid) 2020-02-04 -//package com.sk89q.worldedit.command; +//package com.fastasyncworldedit.core.command; // //import com.boydti.fawe.object.mask.AdjacentAnyMask; //import com.boydti.fawe.object.mask.AdjacentMask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MethodCommands.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MethodCommands.java index 8e781b075..ca0c5ee9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/MethodCommands.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.command; +package com.fastasyncworldedit.core.command; import com.sk89q.worldedit.command.argument.Arguments; import org.enginehub.piston.inject.InjectedValueAccess; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/PatternCommands.java similarity index 100% rename from worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/PatternCommands.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/TransformCommands.java similarity index 100% rename from worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/TransformCommands.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/MovableTool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/MovableTool.java similarity index 68% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/MovableTool.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/MovableTool.java index 2e7eed451..8e4d8904b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/MovableTool.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/MovableTool.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool; import com.sk89q.worldedit.entity.Player; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ResettableTool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/ResettableTool.java similarity index 53% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ResettableTool.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/ResettableTool.java index b8f7655b5..f2a431f27 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ResettableTool.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/ResettableTool.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool; public interface ResettableTool { boolean reset(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/TargetMode.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/TargetMode.java similarity index 71% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/TargetMode.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/TargetMode.java index 43318187e..22287894b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/TargetMode.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/TargetMode.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool; public enum TargetMode { TARGET_BLOCK_RANGE, diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/AngleBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/AngleBrush.java similarity index 82% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/AngleBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/AngleBrush.java index a93027316..6a033afa2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/AngleBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/AngleBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.mask.RadiusMask; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.function.mask.RadiusMask; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlendBall.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlendBall.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java index a09066a58..4e5fa9acb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlendBall.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlendBall.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlobBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlobBrush.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlobBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlobBrush.java index c0b93707f..260047483 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BlobBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BlobBrush.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.random.SimplexNoise; +import com.fastasyncworldedit.core.math.random.SimplexNoise; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.AffineTransform; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BrushSettings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BrushSettings.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BrushSettings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BrushSettings.java index e30642f87..d77d1f3e8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/BrushSettings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/BrushSettings.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.scroll.Scroll; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; +import com.fastasyncworldedit.core.command.tool.scroll.Scroll; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.mask.Mask; @@ -15,7 +15,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import static com.fastasyncworldedit.core.object.brush.BrushSettings.SettingType.BRUSH; +import static com.fastasyncworldedit.core.command.tool.brush.BrushSettings.SettingType.BRUSH; import static com.google.common.base.Preconditions.checkNotNull; public class BrushSettings { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CatenaryBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CatenaryBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java index 343cd4bad..11b81be66 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CatenaryBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CatenaryBrush.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; +import com.fastasyncworldedit.core.command.tool.ResettableTool; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CircleBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CircleBrush.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CircleBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CircleBrush.java index 718a12785..7a547b059 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CircleBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CircleBrush.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CommandBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CommandBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java index d2002b941..ffad2cdee 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CommandBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.util.StringMan; import com.fastasyncworldedit.core.wrappers.AsyncPlayer; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CopyPastaBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CopyPastaBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java index 7ed301f49..4a9e93957 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/CopyPastaBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CopyPastaBrush.java @@ -1,9 +1,10 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; +import com.fastasyncworldedit.core.command.tool.ResettableTool; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.clipboard.ResizableClipboardBuilder; -import com.fastasyncworldedit.core.object.function.NullRegionFunction; -import com.fastasyncworldedit.core.object.function.mask.AbstractDelegateMask; +import com.fastasyncworldedit.core.extent.clipboard.ResizableClipboardBuilder; +import com.fastasyncworldedit.core.function.NullRegionFunction; +import com.fastasyncworldedit.core.function.mask.AbstractDelegateMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ErodeBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ErodeBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java index 31929f721..03cd09d6d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ErodeBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ErodeBrush.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.clipboard.CPUOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.CPUOptimizedClipboard; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FallingSphere.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FallingSphere.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java index 6bea6a95f..e4796cd3c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FallingSphere.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FallingSphere.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.EditSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FlattenBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FlattenBrush.java similarity index 84% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FlattenBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FlattenBrush.java index 3740137dc..4eacf1e2e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/FlattenBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/FlattenBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.heightmap.HeightMap; -import com.fastasyncworldedit.core.object.brush.heightmap.ScalableHeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.ScalableHeightMap; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.extent.clipboard.Clipboard; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/HeightBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/HeightBrush.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/HeightBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/HeightBrush.java index 8400e0f7d..b5a2c8c5a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/HeightBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/HeightBrush.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.brush.heightmap.HeightMap; -import com.fastasyncworldedit.core.object.brush.heightmap.RotatableHeightMap; -import com.fastasyncworldedit.core.object.brush.heightmap.ScalableHeightMap; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.RotatableHeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.ScalableHeightMap; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ImageBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ImageBrush.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ImageBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ImageBrush.java index 5216f04a7..37003ba68 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ImageBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ImageBrush.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.mask.ImageBrushMask; -import com.fastasyncworldedit.core.object.collection.SummedColorTable; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.function.mask.ImageBrushMask; +import com.fastasyncworldedit.core.util.collection.SummedColorTable; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.fastasyncworldedit.core.util.TextureUtil; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/InspectBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/InspectBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java index ac6b74bcb..6d2cc4d4b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/InspectBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/InspectBrush.java @@ -1,12 +1,12 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.database.DBHandler; import com.fastasyncworldedit.core.database.RollbackDatabase; -import com.fastasyncworldedit.core.logging.RollbackOptimizedHistory; -import com.fastasyncworldedit.core.object.change.MutableFullBlockChange; +import com.fastasyncworldedit.core.history.RollbackOptimizedHistory; +import com.fastasyncworldedit.core.history.change.MutableFullBlockChange; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LayerBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LayerBrush.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LayerBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LayerBrush.java index f71d93941..64d82f5b7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LayerBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LayerBrush.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.mask.LayerBrushMask; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; -import com.fastasyncworldedit.core.object.mask.AdjacentAnyMask; -import com.fastasyncworldedit.core.object.mask.RadiusMask; +import com.fastasyncworldedit.core.function.mask.LayerBrushMask; +import com.fastasyncworldedit.core.math.BlockVectorSet; +import com.fastasyncworldedit.core.function.mask.AdjacentAnyMask; +import com.fastasyncworldedit.core.function.mask.RadiusMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LineBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LineBrush.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LineBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LineBrush.java index 6e2658b76..fc6606044 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/LineBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/LineBrush.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; +import com.fastasyncworldedit.core.command.tool.ResettableTool; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/PopulateSchem.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/PopulateSchem.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/PopulateSchem.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/PopulateSchem.java index 766dbb91d..c6254a404 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/PopulateSchem.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/PopulateSchem.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.util.MaskTraverser; import com.fastasyncworldedit.core.util.MathMan; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RaiseBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RaiseBrush.java similarity index 81% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RaiseBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RaiseBrush.java index 0852e76ab..f4f5ac6e3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RaiseBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RaiseBrush.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; public class RaiseBrush extends ErodeBrush { public RaiseBrush() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RecurseBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RecurseBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java index f046321a7..0019833ac 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RecurseBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RecurseBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.mask.RadiusMask; -import com.fastasyncworldedit.core.object.visitor.DFSRecursiveVisitor; +import com.fastasyncworldedit.core.function.mask.RadiusMask; +import com.fastasyncworldedit.core.function.visitor.DFSRecursiveVisitor; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RockBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RockBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java index 6c8ac2ac7..52704d1bb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/RockBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/RockBrush.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.random.SimplexNoise; +import com.fastasyncworldedit.core.math.random.SimplexNoise; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java index 54e8ca37f..78183387d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterBrush.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; -import com.fastasyncworldedit.core.object.mask.AdjacentAnyMask; -import com.fastasyncworldedit.core.object.mask.RadiusMask; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.math.BlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; +import com.fastasyncworldedit.core.function.mask.AdjacentAnyMask; +import com.fastasyncworldedit.core.function.mask.RadiusMask; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterCommand.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterCommand.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java index 623f8604d..de8c94e79 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterCommand.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterOverlayBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterOverlayBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java index bbed13b2e..d9efc25f6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ScatterOverlayBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterOverlayBrush.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ShatterBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ShatterBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java index dee338dc6..7a8629933 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/ShatterBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ShatterBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.mask.Mask; @@ -9,7 +9,7 @@ import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.BreadthFirstSearch; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import java.util.concurrent.ThreadLocalRandom; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplatterBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplatterBrush.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplatterBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplatterBrush.java index b4c7337e4..d5d63fbfd 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplatterBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplatterBrush.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.mask.SplatterBrushMask; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.function.mask.SplatterBrushMask; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.function.operation.Operations; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplineBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplineBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java index 54292ab51..f1ff105ac 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SplineBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SplineBrush.java @@ -1,9 +1,10 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.command.tool.ResettableTool; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.mask.IdMask; -import com.fastasyncworldedit.core.object.visitor.DFSRecursiveVisitor; +import com.fastasyncworldedit.core.function.mask.IdMask; +import com.fastasyncworldedit.core.function.visitor.DFSRecursiveVisitor; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.tool.brush.Brush; @@ -13,7 +14,7 @@ import com.sk89q.worldedit.function.mask.MaskIntersection; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.interpolation.Node; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/StencilBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/StencilBrush.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/StencilBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/StencilBrush.java index 62dc8e970..b2d185653 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/StencilBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/StencilBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.brush.heightmap.HeightMap; -import com.fastasyncworldedit.core.object.brush.mask.StencilBrushMask; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMap; +import com.fastasyncworldedit.core.function.mask.StencilBrushMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.extent.clipboard.Clipboard; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSphereBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSphereBrush.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSphereBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSphereBrush.java index 99c7776ed..9de687268 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSphereBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSphereBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; -import com.fastasyncworldedit.core.object.mask.RadiusMask; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.function.mask.RadiusMask; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSpline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSpline.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java index c3c3d660b..9b9c0350a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/SurfaceSpline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/SurfaceSpline.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush; +package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; @@ -9,7 +9,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.tool.brush.Brush; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation; import com.sk89q.worldedit.math.interpolation.Node; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/Scroll.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/Scroll.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/Scroll.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/Scroll.java index baeb3e6bb..9de9615a8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/Scroll.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/Scroll.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.tool.BrushTool; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollClipboard.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollClipboard.java index e5e1cd6d1..4699611e1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollClipboard.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollMask.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollMask.java index a35cc4f2c..037fb7ef7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.command.tool.BrushTool; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollPattern.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollPattern.java index d7ba467a3..4aca2ff21 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.command.tool.BrushTool; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollRange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollRange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java index 31d9cbb07..9afaf84c4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollRange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollRange.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollSize.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollSize.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java index 0c191e99c..448a72271 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollSize.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollSize.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.tool.BrushTool; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTarget.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTarget.java similarity index 84% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTarget.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTarget.java index 6c8dbf6a1..475e162e0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTarget.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTarget.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; -import com.fastasyncworldedit.core.object.brush.TargetMode; +import com.fastasyncworldedit.core.command.tool.TargetMode; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.entity.Player; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTargetOffset.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTargetOffset.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTargetOffset.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTargetOffset.java index ef959e7b3..f6612b68f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTargetOffset.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTargetOffset.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.scroll; +package com.fastasyncworldedit.core.command.tool.scroll; import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.entity.Player; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTool.java new file mode 100644 index 000000000..7300a2846 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/scroll/ScrollTool.java @@ -0,0 +1,7 @@ +package com.fastasyncworldedit.core.command.tool.scroll; + +import com.sk89q.worldedit.entity.Player; + +public interface ScrollTool { + boolean increment(Player player, int amount); +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/ClipboardSpline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/ClipboardSpline.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java index 090af0a43..acd41f34e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/ClipboardSpline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/ClipboardSpline.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush.sweep; +package com.fastasyncworldedit.core.command.tool.sweep; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -11,7 +11,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.interpolation.Interpolation; import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.math.transform.RoundedTransform; +import com.fastasyncworldedit.core.math.transform.RoundedTransform; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/Spline.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/Spline.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java index 65ac995e2..27566d6c0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/Spline.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/Spline.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.sweep; +package com.fastasyncworldedit.core.command.tool.sweep; import com.google.common.base.Preconditions; import com.sk89q.worldedit.EditSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/SweepBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/SweepBrush.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java index 87d5689f7..87287e639 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/sweep/SweepBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/sweep/SweepBrush.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush.sweep; +package com.fastasyncworldedit.core.command.tool.sweep; +import com.fastasyncworldedit.core.command.tool.ResettableTool; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.brush.ResettableTool; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/DBHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/DBHandler.java index bbb39bfba..d160c24c8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/DBHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/DBHandler.java @@ -13,7 +13,7 @@ public class DBHandler { public static final DBHandler IMP = new DBHandler(); - private Map databases = new ConcurrentHashMap<>(8, 0.9f, 1); + private final Map databases = new ConcurrentHashMap<>(8, 0.9f, 1); public RollbackDatabase getDatabase(World world) { RollbackDatabase database = databases.get(world); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java index ed0b680f6..f0f142171 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/database/RollbackDatabase.java @@ -2,9 +2,9 @@ package com.fastasyncworldedit.core.database; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.logging.RollbackOptimizedHistory; -import com.fastasyncworldedit.core.object.collection.YieldIterable; -import com.fastasyncworldedit.core.object.task.AsyncNotifyQueue; +import com.fastasyncworldedit.core.history.RollbackOptimizedHistory; +import com.fastasyncworldedit.core.util.collection.YieldIterable; +import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/LazyBaseEntity.java similarity index 90% rename from worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/LazyBaseEntity.java index 768b3fa77..4d510b713 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/LazyBaseEntity.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/LazyBaseEntity.java @@ -1,8 +1,9 @@ -package com.sk89q.worldedit.entity; +package com.fastasyncworldedit.core.entity; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.world.entity.EntityType; import java.util.function.Supplier; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/MapMetadatable.java similarity index 96% rename from worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/MapMetadatable.java index 6cedcb415..adbd68cf5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/MapMetadatable.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/MapMetadatable.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.entity; +package com.fastasyncworldedit.core.entity; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Metadatable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/Metadatable.java similarity index 97% rename from worldedit-core/src/main/java/com/sk89q/worldedit/entity/Metadatable.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/Metadatable.java index 1062a3f39..9903b43cd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Metadatable.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/entity/Metadatable.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.entity; +package com.fastasyncworldedit.core.entity; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/ActorSaveClipboardEvent.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/ActorSaveClipboardEvent.java index fdc84e369..4507d9c75 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/ActorSaveClipboardEvent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/ActorSaveClipboardEvent.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.event.extent; +package com.fastasyncworldedit.core.event.extent; import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Event; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/PasteEvent.java similarity index 66% rename from worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/PasteEvent.java index 00fa8b829..c4928b587 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/PasteEvent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/event/extent/PasteEvent.java @@ -1,23 +1,4 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.event.extent; +package com.fastasyncworldedit.core.event.extent; import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Event; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/DefaultTransformParser.java similarity index 100% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/DefaultTransformParser.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/RichParser.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/RichParser.java index 9d281e87c..1ceefd959 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/RichParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/RichParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser; +package com.fastasyncworldedit.core.extension.factory.parser; import com.fastasyncworldedit.core.configuration.Caption; import com.google.common.base.Preconditions; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AdjacentMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AdjacentMaskParser.java similarity index 85% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AdjacentMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AdjacentMaskParser.java index 71fc4b628..c20b0c78f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AdjacentMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AdjacentMaskParser.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.AdjacentAnyMask; -import com.fastasyncworldedit.core.object.mask.AdjacentMask; +import com.fastasyncworldedit.core.function.mask.AdjacentAnyMask; +import com.fastasyncworldedit.core.function.mask.AdjacentMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AngleMaskParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AngleMaskParser.java index 0b144e5f0..7bca15398 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/AngleMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/AngleMaskParser.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.mask.AngleMask; +import com.fastasyncworldedit.core.function.mask.AngleMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/DefaultMaskParser.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/DefaultMaskParser.java index 82685458f..17075b403 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/DefaultMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/DefaultMaskParser.java @@ -1,24 +1,6 @@ // TODO: Ping @MattBDev to reimplement 2020-02-04 -///* -// * WorldEdit, a Minecraft world manipulation toolkit -// * Copyright (C) sk89q -// * Copyright (C) WorldEdit team and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU Lesser 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 Lesser General Public License -// * for more details. -// * -// * You should have received a copy of the GNU Lesser General Public License -// * along with this program. If not, see . -// */ -// -//package com.sk89q.worldedit.extension.factory.parser.mask; +//* +//package com.fastasyncworldedit.core.extension.factory.parser.mask; // //import com.boydti.fawe.command.FaweParser; //import com.boydti.fawe.command.SuggestInputParseException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExtremaMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ExtremaMaskParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExtremaMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ExtremaMaskParser.java index 3b04e5ff0..2b1371fe5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ExtremaMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ExtremaMaskParser.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.mask.ExtremaMask; +import com.fastasyncworldedit.core.function.mask.ExtremaMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FalseMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/FalseMaskParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FalseMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/FalseMaskParser.java index 50b93fcb7..64e8780d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FalseMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/FalseMaskParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/LiquidMaskParser.java similarity index 85% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/LiquidMaskParser.java index 77fe732fb..fcf54ae93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/LiquidMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/LiquidMaskParser.java @@ -1,6 +1,6 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.LiquidMask; +import com.fastasyncworldedit.core.function.mask.LiquidMask; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.ParserContext; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ROCAngleMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ROCAngleMaskParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ROCAngleMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ROCAngleMaskParser.java index e2af7862f..8bf85f178 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ROCAngleMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ROCAngleMaskParser.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.mask.ROCAngleMask; +import com.fastasyncworldedit.core.function.mask.ROCAngleMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RadiusMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RadiusMaskParser.java similarity index 84% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RadiusMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RadiusMaskParser.java index 4c3f8e274..609663629 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RadiusMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RadiusMaskParser.java @@ -1,9 +1,9 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.RadiusMask; +import com.fastasyncworldedit.core.function.mask.RadiusMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RichOffsetMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichOffsetMaskParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RichOffsetMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichOffsetMaskParser.java index 0139dd224..52f501519 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/RichOffsetMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichOffsetMaskParser.java @@ -1,8 +1,8 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SimplexMaskParser.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SimplexMaskParser.java index 17bce6c2f..f5941fb07 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SimplexMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SimplexMaskParser.java @@ -1,9 +1,9 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.SimplexMask; +import com.fastasyncworldedit.core.function.mask.SimplexMask; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SurfaceMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SurfaceMaskParser.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SurfaceMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SurfaceMaskParser.java index 8407b650e..ad8a2b9d1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/SurfaceMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/SurfaceMaskParser.java @@ -1,6 +1,6 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.SurfaceMask; +import com.fastasyncworldedit.core.function.mask.SurfaceMask; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/TrueMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/TrueMaskParser.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/TrueMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/TrueMaskParser.java index 90a51315c..17a5da720 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/TrueMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/TrueMaskParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/WallMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/WallMaskParser.java similarity index 90% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/WallMaskParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/WallMaskParser.java index e9000b212..7c81b996f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/WallMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/WallMaskParser.java @@ -1,6 +1,6 @@ -package com.sk89q.worldedit.extension.factory.parser.mask; +package com.fastasyncworldedit.core.extension.factory.parser.mask; -import com.fastasyncworldedit.core.object.mask.WallMask; +import com.fastasyncworldedit.core.function.mask.WallMask; import com.google.common.collect.ImmutableList; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/XAxisMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/XAxisMaskParser.java new file mode 100644 index 000000000..a2a9b04d8 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/XAxisMaskParser.java @@ -0,0 +1,29 @@ +package com.fastasyncworldedit.core.extension.factory.parser.mask; + +import com.fastasyncworldedit.core.function.mask.XAxisMask; +import com.google.common.collect.ImmutableList; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; + +import java.util.List; + +public class XAxisMaskParser extends SimpleInputParser { + + private final List aliases = ImmutableList.of("#xaxis"); + + public XAxisMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return aliases; + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) { + return new XAxisMask(context.getExtent()); + } +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/YAxisMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/YAxisMaskParser.java new file mode 100644 index 000000000..d37fbbe4a --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/YAxisMaskParser.java @@ -0,0 +1,29 @@ +package com.fastasyncworldedit.core.extension.factory.parser.mask; + +import com.fastasyncworldedit.core.function.mask.YAxisMask; +import com.google.common.collect.ImmutableList; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; + +import java.util.List; + +public class YAxisMaskParser extends SimpleInputParser { + + private final List aliases = ImmutableList.of("#yaxis"); + + public YAxisMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return aliases; + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) { + return new YAxisMask(context.getExtent()); + } +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ZAxisMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ZAxisMaskParser.java new file mode 100644 index 000000000..015a5ff9d --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/ZAxisMaskParser.java @@ -0,0 +1,29 @@ +package com.fastasyncworldedit.core.extension.factory.parser.mask; + +import com.fastasyncworldedit.core.function.mask.ZAxisMask; +import com.google.common.collect.ImmutableList; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; + +import java.util.List; + +public class ZAxisMaskParser extends SimpleInputParser { + + private final List aliases = ImmutableList.of("#zaxis"); + + public ZAxisMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return aliases; + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) { + return new ZAxisMask(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BiomePatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BiomePatternParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BiomePatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BiomePatternParser.java index 9c36f4a04..85eb3d8f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BiomePatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BiomePatternParser.java @@ -1,9 +1,9 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.pattern.BiomeApplyingPattern; +import com.fastasyncworldedit.core.function.pattern.BiomeApplyingPattern; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BufferedPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BufferedPatternParser.java similarity index 87% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BufferedPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BufferedPatternParser.java index 5e1c6e3a3..3d1b3a735 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BufferedPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/BufferedPatternParser.java @@ -1,9 +1,9 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.pattern.BufferedPattern; +import com.fastasyncworldedit.core.function.pattern.BufferedPattern; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/DefaultPatternParser.java similarity index 90% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/DefaultPatternParser.java index fb67973b1..60f8cc94d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/DefaultPatternParser.java @@ -1,24 +1,6 @@ // TODO: Ping @MattBDev to reimplement (or remove because this class is stupid) 2020-02-04 ///* -// * WorldEdit, a Minecraft world manipulation toolkit -// * Copyright (C) sk89q -// * Copyright (C) WorldEdit team and contributors -// * -// * This program is free software: you can redistribute it and/or modify it -// * under the terms of the GNU Lesser 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 Lesser General Public License -// * for more details. -// * -// * You should have received a copy of the GNU Lesser General Public License -// * along with this program. If not, see . -// */ -// -//package com.sk89q.worldedit.extension.factory.parser.pattern; +//package com.fastasyncworldedit.core.extension.factory.parser.pattern; // //import com.boydti.fawe.command.FaweParser; //import com.boydti.fawe.command.SuggestInputParseException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ExistingPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/ExistingPatternParser.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ExistingPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/ExistingPatternParser.java index 838bf3819..c1c6d618b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ExistingPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/ExistingPatternParser.java @@ -1,6 +1,6 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; -import com.fastasyncworldedit.core.object.pattern.ExistingPattern; +import com.fastasyncworldedit.core.function.pattern.ExistingPattern; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear2DPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear2DPatternParser.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear2DPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear2DPatternParser.java index 0d9d58eb1..14c082a9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear2DPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear2DPatternParser.java @@ -1,11 +1,11 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.pattern.Linear2DBlockPattern; +import com.fastasyncworldedit.core.function.pattern.Linear2DBlockPattern; import com.google.common.base.Preconditions; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear3DPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear3DPatternParser.java similarity index 93% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear3DPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear3DPatternParser.java index 51eef6f57..8db342b7a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/Linear3DPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/Linear3DPatternParser.java @@ -1,11 +1,11 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.pattern.Linear3DBlockPattern; +import com.fastasyncworldedit.core.function.pattern.Linear3DBlockPattern; import com.google.common.base.Preconditions; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/NoisePatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/NoisePatternParser.java similarity index 93% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/NoisePatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/NoisePatternParser.java index 40c3bbb46..d90df8a32 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/NoisePatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/NoisePatternParser.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.random.NoiseRandom; +import com.fastasyncworldedit.core.math.random.NoiseRandom; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.command.util.SuggestionHelper; -import com.sk89q.worldedit.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/PerlinPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/PerlinPatternParser.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/PerlinPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/PerlinPatternParser.java index 1d968c8b7..8bd9e2987 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/PerlinPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/PerlinPatternParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.noise.PerlinNoise; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomPatternParser.java similarity index 77% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomPatternParser.java index 76045e1be..16ace2476 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RandomPatternParser.java @@ -1,23 +1,4 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.util.StringUtil; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java similarity index 88% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java index 969acc1e6..1ac5fa62e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RidgedMultiFractalPatternParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.noise.RidgedMultiFractalNoise; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/SimplexPatternParser.java similarity index 67% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/SimplexPatternParser.java index d408c031f..1f5fe17c1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/SimplexPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/SimplexPatternParser.java @@ -1,7 +1,7 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.math.noise.SimplexNoiseGenerator; +import com.fastasyncworldedit.core.math.random.SimplexNoiseGenerator; public class SimplexPatternParser extends NoisePatternParser { private static final String SIMPLEX_NAME = "simplex"; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/VoronoiPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/VoronoiPatternParser.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/VoronoiPatternParser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/VoronoiPatternParser.java index 5afbf53fd..9cc3b185d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/VoronoiPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/VoronoiPatternParser.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.factory.parser.pattern; +package com.fastasyncworldedit.core.extension.factory.parser.pattern; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.noise.VoronoiNoise; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Binding.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Binding.java similarity index 74% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Binding.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Binding.java index f6a27e276..c40c6aabe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Binding.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Binding.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Bindings.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Bindings.java index bf18cc3c6..c383cc82d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/Bindings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/Bindings.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/CommandBindings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/CommandBindings.java similarity index 72% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/CommandBindings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/CommandBindings.java index 54dfbc5d5..fa359fb48 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/CommandBindings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/CommandBindings.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ConsumeBindings.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ConsumeBindings.java index 4150967b0..bf13f657b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ConsumeBindings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ConsumeBindings.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; @@ -14,7 +14,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.PlatformCommandManager; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.annotation.Selection; -import com.sk89q.worldedit.internal.annotation.Time; +import com.sk89q.worldedit.command.util.annotation.Time; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/PrimitiveBindings.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/PrimitiveBindings.java index 6110cdd30..8d4859bbc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/PrimitiveBindings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/PrimitiveBindings.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ProvideBindings.java similarity index 97% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ProvideBindings.java index 933ba7883..009658dbd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/binding/ProvideBindings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/platform/binding/ProvideBindings.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extension.platform.binding; +package com.fastasyncworldedit.core.extension.platform.binding; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.database.DBHandler; @@ -14,7 +14,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.annotation.AllowedRegion; +import com.sk89q.worldedit.command.util.annotation.AllowedRegion; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.request.Request; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/BlockTranslateExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/BlockTranslateExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java index 609c90461..977d8c19e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/BlockTranslateExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/BlockTranslateExtent.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ExtentHeightCacher.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ExtentHeightCacher.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ExtentHeightCacher.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ExtentHeightCacher.java index 135a31a11..a2b98d4be 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ExtentHeightCacher.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ExtentHeightCacher.java @@ -1,7 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.PassthroughExtent; import java.util.Arrays; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/FaweRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/FaweRegionExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java index 088d8a854..4382f7d37 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/FaweRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.object.FaweLimit; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.WEManager; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/HeightBoundExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HeightBoundExtent.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/HeightBoundExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HeightBoundExtent.java index 6cae172c6..1e13912c3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/HeightBoundExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HeightBoundExtent.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.RegionWrapper; +import com.fastasyncworldedit.core.regions.RegionWrapper; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/HistoryExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/HistoryExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java index 87402445f..ce6f7265b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/HistoryExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/HistoryExtent.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.extent; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MemoryCheckingExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MemoryCheckingExtent.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MemoryCheckingExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MemoryCheckingExtent.java index 8191cca1f..1114a67d7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MemoryCheckingExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MemoryCheckingExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Caption; @@ -7,7 +7,6 @@ import com.fastasyncworldedit.core.util.Permission; import com.fastasyncworldedit.core.util.WEManager; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.PassthroughExtent; public class MemoryCheckingExtent extends PassthroughExtent { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiRegionExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java index 6a3fa5cf5..f74af24d9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.object.FaweLimit; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/NullExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/NullExtent.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/NullExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/NullExtent.java index 9981eccb9..98b1384a9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/NullExtent.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; @@ -15,8 +15,8 @@ import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.function.generator.GenBase; -import com.sk89q.worldedit.function.generator.Resource; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.Resource; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/OffsetExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OffsetExtent.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/OffsetExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OffsetExtent.java index 95a76f2ef..165c783b4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/OffsetExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/OffsetExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PassthroughExtent.java similarity index 96% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PassthroughExtent.java index 7f3155997..b088710ca 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/PassthroughExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PassthroughExtent.java @@ -1,12 +1,14 @@ -package com.sk89q.worldedit.extent; +package com.fastasyncworldedit.core.extent; -import com.fastasyncworldedit.core.beta.Filter; +import com.fastasyncworldedit.core.queue.Filter; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.AbstractDelegateExtent; +import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.generator.GenBase; -import com.sk89q.worldedit.function.generator.Resource; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.Resource; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PositionTransformExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PositionTransformExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java index 6ec74f6ad..77c50db98 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PositionTransformExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/PositionTransformExtent.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ProcessedWEExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ProcessedWEExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java index aa144a437..95617a5ee 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ProcessedWEExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ProcessedWEExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.object.FaweLimit; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomOffsetTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/RandomOffsetTransform.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomOffsetTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/RandomOffsetTransform.java index 3b0c27caa..f13c8f2eb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomOffsetTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/RandomOffsetTransform.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ResettableExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ResettableExtent.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ResettableExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ResettableExtent.java index dd2b1b141..50f19a99a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ResettableExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/ResettableExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.ReflectionUtils; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SingleRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SingleRegionExtent.java similarity index 86% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SingleRegionExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SingleRegionExtent.java index cd763c3a8..2a848305c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SingleRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SingleRegionExtent.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.object.FaweLimit; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SlowExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SlowExtent.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SlowExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SlowExtent.java index dec8429e5..4e83befd0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SlowExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SlowExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.fastasyncworldedit.core.Fawe; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SourceMaskExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SourceMaskExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java index 5ff3e7fb9..53589b5f6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SourceMaskExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SourceMaskExtent.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/StripNBTExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/StripNBTExtent.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/StripNBTExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/StripNBTExtent.java index c48cc469b..e01ee063c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/StripNBTExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/StripNBTExtent.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.Tag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SupplyingExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SupplyingExtent.java similarity index 83% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SupplyingExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SupplyingExtent.java index c944b5300..3be2937ee 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SupplyingExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/SupplyingExtent.java @@ -1,7 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.PassthroughExtent; import java.util.function.Supplier; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TemporalExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TemporalExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java index c0aff255e..41953d966 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TemporalExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TemporalExtent.java @@ -1,7 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.PassthroughExtent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TransformExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TransformExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java index 42ca894b9..057c6ce27 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/TransformExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/TransformExtent.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.transform.BlockTransformExtent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/CPUOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/CPUOptimizedClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java index dd5770c3e..ccfba4f6e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/CPUOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader; -import com.fastasyncworldedit.core.object.IntTriple; +import com.fastasyncworldedit.core.math.IntTriple; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.Tag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/DiskOptimizedClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index 012b8def8..5c282af12 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader; -import com.fastasyncworldedit.core.object.IntTriple; +import com.fastasyncworldedit.core.math.IntTriple; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.UnsafeUtility; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/EmptyClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/EmptyClipboard.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/EmptyClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/EmptyClipboard.java index 6c4917dec..26e57b414 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/EmptyClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/EmptyClipboard.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Entity; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LazyClipboardHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LazyClipboardHolder.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LazyClipboardHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LazyClipboardHolder.java index 7c2ed2af3..508af1efd 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LazyClipboardHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LazyClipboardHolder.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.google.common.io.ByteSource; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LinearClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LinearClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java index 8ee9e8c90..d0854837a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/LinearClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/LinearClipboard.java @@ -1,12 +1,12 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; -import com.fastasyncworldedit.core.beta.implementation.filter.block.AbstractFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.AbstractFilterBlock; import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader; import com.google.common.collect.ForwardingIterator; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard.ClipboardEntity; -import com.sk89q.worldedit.function.visitor.Order; +import com.fastasyncworldedit.core.function.visitor.Order; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MemoryOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MemoryOptimizedClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java index c7d061a0e..6836c9790 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MemoryOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader; -import com.fastasyncworldedit.core.object.IntTriple; +import com.fastasyncworldedit.core.math.IntTriple; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MultiClipboardHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MultiClipboardHolder.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MultiClipboardHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MultiClipboardHolder.java index 598d3a974..9f83a4a89 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/MultiClipboardHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MultiClipboardHolder.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.session.ClipboardHolder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ReadOnlyClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ReadOnlyClipboard.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ReadOnlyClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ReadOnlyClipboard.java index af29eecd6..801cae39c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ReadOnlyClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ReadOnlyClipboard.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.fastasyncworldedit.core.Fawe; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ResizableClipboardBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ResizableClipboardBuilder.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ResizableClipboardBuilder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ResizableClipboardBuilder.java index 0510d6ed4..b32216070 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/ResizableClipboardBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/ResizableClipboardBuilder.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; -import com.fastasyncworldedit.core.object.change.MutableBlockChange; -import com.fastasyncworldedit.core.object.change.MutableTileChange; -import com.fastasyncworldedit.core.object.changeset.MemoryOptimizedHistory; +import com.fastasyncworldedit.core.history.change.MutableBlockChange; +import com.fastasyncworldedit.core.history.change.MutableTileChange; +import com.fastasyncworldedit.core.history.MemoryOptimizedHistory; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/SimpleClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/SimpleClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java index 0410743c4..94956c161 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/SimpleClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/SimpleClipboard.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/URIClipboardHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/URIClipboardHolder.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/URIClipboardHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/URIClipboardHolder.java index 1f6486b37..a3bd02bb0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/URIClipboardHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/URIClipboardHolder.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.session.ClipboardHolder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/WorldCopyClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/WorldCopyClipboard.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java index 3610dfc13..cdd4ae8df 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/clipboard/WorldCopyClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/WorldCopyClipboard.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.clipboard; +package com.fastasyncworldedit.core.extent.clipboard; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java similarity index 93% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java index 9f10aa19e..f637f8cbb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicReader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicReader.java @@ -1,32 +1,13 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extent.clipboard.io; +package com.fastasyncworldedit.core.extent.clipboard.io; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.jnbt.streamer.StreamDelegate; import com.fastasyncworldedit.core.jnbt.streamer.ValueReader; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.clipboard.LinearClipboard; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArraysInputStream; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.extent.clipboard.LinearClipboard; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream; import com.sk89q.jnbt.AdventureNBTConverter; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; @@ -40,6 +21,7 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader; import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; @@ -75,7 +57,7 @@ public class FastSchematicReader extends NBTSchematicReader { private static final Logger LOGGER = LogManagerCompat.getLogger(); private final NBTInputStream inputStream; - private DataFixer fixer; + private final DataFixer fixer; private int dataVersion = -1; private int version = -1; private int faweWritten = -1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java index 322b620f5..b8c02d12a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java @@ -1,27 +1,8 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extent.clipboard.io; +package com.fastasyncworldedit.core.extent.clipboard.io; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.jnbt.streamer.IntValueReader; -import com.fastasyncworldedit.core.object.FaweOutputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; import com.fastasyncworldedit.core.util.IOUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntArrayTag; @@ -36,7 +17,8 @@ import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.visitor.Order; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; +import com.fastasyncworldedit.core.function.visitor.Order; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/MinecraftStructure.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/MinecraftStructure.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java index dd859eaa6..403c8399d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/MinecraftStructure.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/MinecraftStructure.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.schematic; +package com.fastasyncworldedit.core.extent.clipboard.io.schematic; import com.fastasyncworldedit.core.FaweCache; import com.sk89q.jnbt.CompoundTag; @@ -17,7 +17,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.registry.state.AbstractProperty; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/PNGWriter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/PNGWriter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java index 6a21c578e..d14b14353 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/PNGWriter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/PNGWriter.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.schematic; +package com.fastasyncworldedit.core.extent.clipboard.io.schematic; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.util.TextureUtil; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/visualizer/SchemVis.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/visualizer/SchemVis.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/visualizer/SchemVis.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/visualizer/SchemVis.java index 93295efae..76674758e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/schematic/visualizer/SchemVis.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/schematic/visualizer/SchemVis.java @@ -1,4 +1,4 @@ -//package com.boydti.fawe.object.schematic.visualizer; +//package com.fastasyncworldedit.core.extent.clipboard.io.schematic.visualizer; // //import com.boydti.fawe.FaweCache; //import com.boydti.fawe.beta.IBlocks; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ArrayImageMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java similarity index 76% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ArrayImageMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java index bb1a01092..a9e46a792 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ArrayImageMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ArrayImageMask.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.FilterBlockMask; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.FilterBlockMask; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import java.awt.image.BufferedImage; import java.util.concurrent.ThreadLocalRandom; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/CountFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/CountFilter.java similarity index 79% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/CountFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/CountFilter.java index a0ee6f8a2..375cdb8e3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/CountFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/CountFilter.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; public class CountFilter extends ForkedFilter { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/DistrFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/DistrFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java index 6e4429eb2..681c9b23d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/DistrFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.function.mask.ABlockMask; +import com.fastasyncworldedit.core.function.mask.ABlockMask; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ForkedFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ForkedFilter.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ForkedFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ForkedFilter.java index acc00b8d9..9bff8deab 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/ForkedFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/ForkedFilter.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.Filter; +import com.fastasyncworldedit.core.queue.Filter; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/LinkedFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/LinkedFilter.java similarity index 73% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/LinkedFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/LinkedFilter.java index 8db003a6c..776b74da7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/LinkedFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/LinkedFilter.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.DelegateFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.block.DelegateFilter; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; /** * Filter which links two Filters together for single-filter-input operations. diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/MaskFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/MaskFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java index ea5eac268..bccd3e07f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/MaskFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/MaskFilter.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.beta.implementation.filter; +package com.fastasyncworldedit.core.extent.filter; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.DelegateFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.block.DelegateFilter; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.function.mask.AbstractExtentMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractExtentFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractExtentFilterBlock.java similarity index 83% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractExtentFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractExtentFilterBlock.java index 813888dc8..00110fbdd 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractExtentFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractExtentFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java index b6aa81ffb..0c08aa0bc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractSingleFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractSingleFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java index 01a6c259e..6e8cf181c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/AbstractSingleFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/AbstractSingleFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ArrayFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ArrayFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java index 9758c8bde..ea117f69a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ArrayFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ArrayFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/CharFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/CharFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java index 1e873cec6..919cb32aa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/CharFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.FilterBlockMask; -import com.fastasyncworldedit.core.beta.Flood; -import com.fastasyncworldedit.core.beta.IBlocks; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.blocks.CharGetBlocks; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.FilterBlockMask; +import com.fastasyncworldedit.core.queue.implementation.Flood; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ChunkFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ChunkFilterBlock.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ChunkFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ChunkFilterBlock.java index 6a059d960..121bad7f4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ChunkFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ChunkFilterBlock.java @@ -1,12 +1,12 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.FilterBlockMask; -import com.fastasyncworldedit.core.beta.Flood; -import com.fastasyncworldedit.core.beta.IBlocks; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.FilterBlockMask; +import com.fastasyncworldedit.core.queue.implementation.Flood; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/DelegateFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/DelegateFilter.java similarity index 61% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/DelegateFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/DelegateFilter.java index f9e033d38..88d10753c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/DelegateFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/DelegateFilter.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IDelegateFilter; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IDelegateFilter; public abstract class DelegateFilter implements IDelegateFilter { @@ -15,4 +15,4 @@ public abstract class DelegateFilter implements IDelegateFilte public final T getParent() { return (T) parent; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ExtentFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ExtentFilterBlock.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ExtentFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ExtentFilterBlock.java index 326ac742b..c94119a6d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/ExtentFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/ExtentFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/FilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/FilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java index 83f254432..3b3e89ebb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/FilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/FilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/SingleFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/SingleFilterBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java index 65e8e764c..899fd3d66 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/filter/block/SingleFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/SingleFilterBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.filter.block; +package com.fastasyncworldedit.core.extent.filter.block; import com.sk89q.worldedit.world.block.BaseBlock; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/SlottableBlockBag.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/inventory/SlottableBlockBag.java similarity index 83% rename from worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/SlottableBlockBag.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/inventory/SlottableBlockBag.java index 410adf328..f3f8940de 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/SlottableBlockBag.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/inventory/SlottableBlockBag.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.extent.inventory; +package com.fastasyncworldedit.core.extent.inventory; import com.sk89q.worldedit.blocks.BaseItem; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/BatchProcessorHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/BatchProcessorHolder.java similarity index 83% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/BatchProcessorHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/BatchProcessorHolder.java index 12d018d0c..55be0618a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/BatchProcessorHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/BatchProcessorHolder.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import java.util.concurrent.Future; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/EmptyBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EmptyBatchProcessor.java similarity index 82% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/EmptyBatchProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EmptyBatchProcessor.java index dae055df1..42bb8cd13 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/EmptyBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EmptyBatchProcessor.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.extent.Extent; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ExtentBatchProcessorHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ExtentBatchProcessorHolder.java similarity index 81% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ExtentBatchProcessorHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ExtentBatchProcessorHolder.java index 77793a4f5..e7938da79 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ExtentBatchProcessorHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ExtentBatchProcessorHolder.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.sk89q.worldedit.extent.Extent; public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder implements Extent { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/HeightmapProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/HeightmapProcessor.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/HeightmapProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/HeightmapProcessor.java index bac8f1a12..e4956343c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/HeightmapProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/HeightmapProcessor.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/IBatchProcessorHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/IBatchProcessorHolder.java similarity index 84% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/IBatchProcessorHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/IBatchProcessorHolder.java index 026027187..0dd75f8b4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/IBatchProcessorHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/IBatchProcessorHolder.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.extent.Extent; import java.util.concurrent.Future; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/LimitExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/LimitExtent.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/LimitExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/LimitExtent.java index d4d90bc4b..ff98949f4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/LimitExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/LimitExtent.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ExtentFilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.block.ExtentFilterBlock; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; @@ -12,8 +12,8 @@ import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.generator.GenBase; -import com.sk89q.worldedit.function.generator.Resource; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.Resource; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/MultiBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/MultiBatchProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java index 793f246d7..84ecc7c28 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/MultiBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.util.StringMan; import com.google.common.cache.LoadingCache; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/NullProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/NullProcessor.java similarity index 78% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/NullProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/NullProcessor.java index 776e482e5..9dd296460 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/NullProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/NullProcessor.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ProcessorScope.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ProcessorScope.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java index 93c97e91b..4314a0be7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/processors/ProcessorScope.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.processors; +package com.fastasyncworldedit.core.extent.processor; /** * The scope of a processor. diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AbstractDelegateHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AbstractDelegateHeightMap.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AbstractDelegateHeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AbstractDelegateHeightMap.java index c174bf4bb..9c3d86b4b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AbstractDelegateHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AbstractDelegateHeightMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; public class AbstractDelegateHeightMap implements HeightMap { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ArrayHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ArrayHeightMap.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ArrayHeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ArrayHeightMap.java index 16ae614d7..292aff20c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ArrayHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ArrayHeightMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; public class ArrayHeightMap extends ScalableHeightMap { // The heights diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AverageHeightMapFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AverageHeightMapFilter.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AverageHeightMapFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AverageHeightMapFilter.java index 34e7af512..d1e891115 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/AverageHeightMapFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/AverageHeightMapFilter.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; public class AverageHeightMapFilter { private int[] inData; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/FlatScalableHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/FlatScalableHeightMap.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/FlatScalableHeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/FlatScalableHeightMap.java index 39014cf7a..b1839acff 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/FlatScalableHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/FlatScalableHeightMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; public class FlatScalableHeightMap extends ScalableHeightMap { public FlatScalableHeightMap() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/HeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMap.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/HeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMap.java index c344700d0..1f6d28bc2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/HeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/HeightMapType.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMapType.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/HeightMapType.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMapType.java index 75de71f59..ce458a6f5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/HeightMapType.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightMapType.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.heightmap; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/RotatableHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/RotatableHeightMap.java similarity index 86% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/RotatableHeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/RotatableHeightMap.java index 0087db2a0..633b02507 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/RotatableHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/RotatableHeightMap.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.transform.AffineTransform; public class RotatableHeightMap extends AbstractDelegateHeightMap { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ScalableHeightMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ScalableHeightMap.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ScalableHeightMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ScalableHeightMap.java index 1b999487e..f795a8eb7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/heightmap/ScalableHeightMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/ScalableHeightMap.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.brush.heightmap; +package com.fastasyncworldedit.core.extent.processor.heightmap; -import com.fastasyncworldedit.core.object.IntPair; +import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BlockState; import java.awt.image.BufferedImage; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NMSRelighter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NMSRelighter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java index a98fde58e..21e8dfe2c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NMSRelighter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NMSRelighter.java @@ -1,17 +1,15 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.lighting; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.chunk.ChunkHolder; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.queue.implementation.chunk.ChunkHolder; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RelightMode; -import com.fastasyncworldedit.core.object.RunnableVal; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.fastasyncworldedit.core.math.BlockVectorSet; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.TaskManager; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.registry.state.DirectionalProperty; import com.sk89q.worldedit.registry.state.EnumProperty; import com.sk89q.worldedit.registry.state.Property; @@ -20,7 +18,6 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.BlockMaterial; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import org.apache.logging.log4j.Logger; import java.util.ArrayDeque; import java.util.ArrayList; @@ -39,7 +36,6 @@ import java.util.concurrent.locks.ReentrantLock; public class NMSRelighter implements Relighter { - private static final Logger LOGGER = LogManagerCompat.getLogger(); private static final int DISPATCH_SIZE = 64; private static final DirectionalProperty stairDirection; private static final EnumProperty stairHalf; @@ -58,7 +54,7 @@ public class NMSRelighter implements Relighter { private final Map skyToRelight; private final Object present = new Object(); private final Map chunksToSend; - private final ConcurrentLinkedQueue extentdSkyToRelight = new ConcurrentLinkedQueue<>(); + private final ConcurrentLinkedQueue extendSkyToRelight = new ConcurrentLinkedQueue<>(); private final Map lightQueue; private final AtomicBoolean lightLock = new AtomicBoolean(false); private final ConcurrentHashMap concurrentLightQueue; @@ -84,7 +80,7 @@ public class NMSRelighter implements Relighter { } @Override public boolean isEmpty() { - return skyToRelight.isEmpty() && lightQueue.isEmpty() && extentdSkyToRelight.isEmpty() && concurrentLightQueue.isEmpty(); + return skyToRelight.isEmpty() && lightQueue.isEmpty() && extendSkyToRelight.isEmpty() && concurrentLightQueue.isEmpty(); } @Override @@ -149,7 +145,7 @@ public class NMSRelighter implements Relighter { } public synchronized void clear() { - extentdSkyToRelight.clear(); + extendSkyToRelight.clear(); skyToRelight.clear(); chunksToSend.clear(); lightQueue.clear(); @@ -157,13 +153,13 @@ public class NMSRelighter implements Relighter { public boolean addChunk(int cx, int cz, byte[] fix, int bitmask) { RelightSkyEntry toPut = new RelightSkyEntry(cx, cz, fix, bitmask); - extentdSkyToRelight.add(toPut); + extendSkyToRelight.add(toPut); return true; } private synchronized Map getSkyMap() { RelightSkyEntry entry; - while ((entry = extentdSkyToRelight.poll()) != null) { + while ((entry = extendSkyToRelight.poll()) != null) { long pair = MathMan.pairInt(entry.x, entry.z); RelightSkyEntry existing = skyToRelight.put(pair, entry); if (existing != null) { @@ -242,7 +238,7 @@ public class NMSRelighter implements Relighter { int x = lx + bx; int y = yStart + j; int z = lz + bz; - int oldLevel = iChunk.getEmmittedLight(lx, y, lz); + int oldLevel = iChunk.getEmittedLight(lx, y, lz); int newLevel = iChunk.getBrightness(lx, y, lz); if (oldLevel != newLevel) { iChunk.setBlockLight(lx, y, lz, newLevel); @@ -293,7 +289,7 @@ public class NMSRelighter implements Relighter { if (!iChunk.isInit()) { iChunk.init(queue, node.getX() >> 4, node.getZ() >> 4); } - int lightLevel = iChunk.getEmmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15); + int lightLevel = iChunk.getEmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15); BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ()); String id = state.getBlockType().getId().toLowerCase(Locale.ROOT); if (lightLevel <= 1) { @@ -724,7 +720,7 @@ public class NMSRelighter implements Relighter { if (!iChunk.isInit()) { iChunk.init(this.queue, x >> 4, z >> 4); } - int current = iChunk.getEmmittedLight(x & 15, y, z & 15); + int current = iChunk.getEmittedLight(x & 15, y, z & 15); if (current != 0 && current < currentLight) { iChunk.setBlockLight(x, y, z, 0); if (current > 1) { @@ -758,7 +754,7 @@ public class NMSRelighter implements Relighter { if (!iChunk.isInit()) { iChunk.init(this.queue, x >> 4, z >> 4); } - int current = iChunk.getEmmittedLight(x & 15, y, z & 15); + int current = iChunk.getEmittedLight(x & 15, y, z & 15); if (currentLight > current) { iChunk.setBlockLight(x & 15, y, z & 15, currentLight); mutableBlockPos.setComponents(x, y, z); @@ -831,8 +827,9 @@ public class NMSRelighter implements Relighter { queue.flush(); finished.set(true); } else { - TaskManager.IMP.sync(new RunnableVal() { - @Override public void run(Object value) { + TaskManager.IMP.sync(new RunnableVal<>() { + @Override + public void run(Object value) { queue.flush(); finished.set(true); } @@ -849,7 +846,7 @@ public class NMSRelighter implements Relighter { } public synchronized void sendChunks() { - RunnableVal runnable = new RunnableVal() { + RunnableVal runnable = new RunnableVal<>() { @Override public void run(Object value) { Iterator> iter = chunksToSend.entrySet().iterator(); @@ -973,7 +970,7 @@ public class NMSRelighter implements Relighter { BlockMaterial material = state.getMaterial(); int opacity = material.getLightOpacity(); int brightness = material.getLightValue(); - if (brightness > 0 && brightness != iChunk.getEmmittedLight(x, y, z)) { + if (brightness > 0 && brightness != iChunk.getEmittedLight(x, y, z)) { addLightUpdate(bx + x, y, bz + z); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NullRelighter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NullRelighter.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NullRelighter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NullRelighter.java index 2396fbbf0..63ebe2f44 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/NullRelighter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/NullRelighter.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.lighting; import java.util.concurrent.locks.ReentrantLock; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RelightMode.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightMode.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RelightMode.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightMode.java index 8822526c8..a54bb4d58 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RelightMode.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightMode.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.extent.processor.lighting; import java.util.HashMap; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelightProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightProcessor.java similarity index 83% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelightProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightProcessor.java index 4f3bb2bc6..e4fafa9d3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelightProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelightProcessor.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.lighting; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.configuration.Settings; import com.sk89q.worldedit.extent.Extent; import org.jetbrains.annotations.Nullable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/Relighter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/Relighter.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/Relighter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/Relighter.java index cd9c9cdd8..9ee72350e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/Relighter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/Relighter.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.lighting; import java.util.concurrent.locks.ReentrantLock; @@ -10,7 +10,7 @@ public interface Relighter extends AutoCloseable { * @param cx chunk x * @param cz chunk z * @param skipReason byte array of {@link SkipReason} for each chunksection in the chunk. Use case? No idea. - * @param bitmask Initial bitmask of the chunk (if being editited beforehand) + * @param bitmask Initial bitmask of the chunk (if being edited beforehand) * @return Was the chunk added */ boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelighterFactory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelighterFactory.java similarity index 81% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelighterFactory.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelighterFactory.java index 48f03fab9..28913177e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/lighting/RelighterFactory.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/lighting/RelighterFactory.java @@ -1,8 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.lighting; +package com.fastasyncworldedit.core.extent.processor.lighting; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.object.RelightMode; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; import com.sk89q.worldedit.world.World; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/Linear3DTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/Linear3DTransform.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/Linear3DTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/Linear3DTransform.java index f2c007b4a..d8b7db502 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/Linear3DTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/Linear3DTransform.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/LinearTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/LinearTransform.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/LinearTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/LinearTransform.java index 55018bdf1..5a469dc5d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/LinearTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/LinearTransform.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/MultiTransform.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/MultiTransform.java index 43e08144c..4a63b9a86 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/MultiTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/MultiTransform.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PatternTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/PatternTransform.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PatternTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/PatternTransform.java index 2fd2be0ce..746cf8323 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/PatternTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/PatternTransform.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomTransform.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomTransform.java index 6f41dd8a9..58b41ede7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/RandomTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/RandomTransform.java @@ -1,8 +1,9 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; -import com.fastasyncworldedit.core.object.collection.RandomCollection; -import com.fastasyncworldedit.core.object.random.SimpleRandom; -import com.fastasyncworldedit.core.object.random.TrueRandom; +import com.fastasyncworldedit.core.extent.ResettableExtent; +import com.fastasyncworldedit.core.util.collection.RandomCollection; +import com.fastasyncworldedit.core.math.random.SimpleRandom; +import com.fastasyncworldedit.core.math.random.TrueRandom; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ScaleTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ScaleTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java index 2c0490a9e..b38e064de 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/ScaleTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/ScaleTransform.java @@ -1,11 +1,12 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SelectTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SelectTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java index 3114392b3..3686502fe 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/extent/SelectTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/transform/SelectTransform.java @@ -1,5 +1,6 @@ -package com.fastasyncworldedit.core.object.extent; +package com.fastasyncworldedit.core.extent.transform; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/NullRegionFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/NullRegionFunction.java similarity index 86% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/NullRegionFunction.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/NullRegionFunction.java index ba7ca4847..1df94ed7e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/NullRegionFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/NullRegionFunction.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.function; +package com.fastasyncworldedit.core.function; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/QuadFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/QuadFunction.java similarity index 65% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/QuadFunction.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/QuadFunction.java index ab7bba08c..4c1e3bb0f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/QuadFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/QuadFunction.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.function; +package com.fastasyncworldedit.core.function; @FunctionalInterface public interface QuadFunction { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/RegionMaskTestFunction.java similarity index 56% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/RegionMaskTestFunction.java index d4f13aeb7..629597463 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskTestFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/RegionMaskTestFunction.java @@ -1,25 +1,7 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.function; +package com.fastasyncworldedit.core.function; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; @@ -34,7 +16,7 @@ public class RegionMaskTestFunction implements RegionFunction { private final RegionFunction pass; private final RegionFunction fail; - private Mask mask; + private final Mask mask; /** * Create a new masking filter. diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/SurfaceRegionFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/SurfaceRegionFunction.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java index 02e3345b2..fce9734c3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/SurfaceRegionFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/SurfaceRegionFunction.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.function; +package com.fastasyncworldedit.core.function; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.FlatRegionFunction; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; public class SurfaceRegionFunction implements FlatRegionFunction { private final Extent extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/BiomeCopy.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/BiomeCopy.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java index c8d3ef390..31d9b5e86 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/BiomeCopy.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/BiomeCopy.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.function.block; +package com.fastasyncworldedit.core.function.block; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; public class BiomeCopy implements RegionFunction { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/CombinedBlockCopy.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/CombinedBlockCopy.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/CombinedBlockCopy.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/CombinedBlockCopy.java index 7e5826525..995c33080 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/CombinedBlockCopy.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/CombinedBlockCopy.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.function.block; +package com.fastasyncworldedit.core.function.block; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/SimpleBlockCopy.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/SimpleBlockCopy.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/SimpleBlockCopy.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/SimpleBlockCopy.java index 116e38dcb..10ce56173 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/block/SimpleBlockCopy.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/block/SimpleBlockCopy.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.function.block; +package com.fastasyncworldedit.core.function.block; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/CavesGen.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/CavesGen.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java index fce236ee3..325a33143 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/CavesGen.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/CavesGen.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.function.generator; +package com.fastasyncworldedit.core.function.generator; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.world.block.BlockID; +import com.fastasyncworldedit.core.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GenBase.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GenBase.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java index 3f723022a..ef55c0550 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GenBase.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/GenBase.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.function.generator; +package com.fastasyncworldedit.core.function.generator; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/OreGen.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/OreGen.java similarity index 97% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/OreGen.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/OreGen.java index 858019623..924453513 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/OreGen.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/OreGen.java @@ -1,11 +1,11 @@ -package com.sk89q.worldedit.function.generator; +package com.fastasyncworldedit.core.function.generator; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import java.util.Random; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/Resource.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/Resource.java similarity index 76% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/Resource.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/Resource.java index b37a6790f..9e7c15cba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/Resource.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/Resource.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.function.generator; +package com.fastasyncworldedit.core.function.generator; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java similarity index 90% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java index 630090c94..7f6c1fdf8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/SchemGen.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/generator/SchemGen.java @@ -1,10 +1,10 @@ -package com.sk89q.worldedit.function.generator; +package com.fastasyncworldedit.core.function.generator; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.session.ClipboardHolder; @@ -20,7 +20,7 @@ public class SchemGen implements Resource { private final boolean randomRotate; private final Mask mask; - private MutableBlockVector3 mutable = new MutableBlockVector3(); + private final MutableBlockVector3 mutable = new MutableBlockVector3(); public SchemGen(Mask mask, Extent extent, List clipboards, boolean randomRotate) { this.mask = mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ABlockMask.java similarity index 93% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ABlockMask.java index 651cf97b2..8761538fd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ABlockMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ABlockMask.java @@ -1,7 +1,10 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.AbstractExtentMask; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/mask/AbstractDelegateMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AbstractDelegateMask.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/mask/AbstractDelegateMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AbstractDelegateMask.java index d416b9fe0..7fd489927 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/function/mask/AbstractDelegateMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AbstractDelegateMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.function.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentAnyMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentAnyMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java index b5d826b3e..e66f23af1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentAnyMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentAnyMask.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; /** * Just an optimized version of the Adjacent Mask for single adjacency. diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java index 5df583d6d..02366d474 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AdjacentMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AdjacentMask.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; public class AdjacentMask extends AbstractMask { private final int min; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AirMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AirMask.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AirMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AirMask.java index ba2d34290..227426921 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AirMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AirMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AngleMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AngleMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java index fa555d524..80201b021 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/AngleMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.SolidBlockMask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import java.util.Arrays; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java index d18e52a4c..e34615451 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMaskBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java @@ -1,16 +1,17 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; import com.fastasyncworldedit.core.command.SuggestInputParseException; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.collection.FastBitSet; -import com.fastasyncworldedit.core.object.string.MutableCharSequence; +import com.fastasyncworldedit.core.math.FastBitSet; +import com.fastasyncworldedit.core.util.MutableCharSequence; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; -import com.sk89q.worldedit.registry.state.PropertyKeySet; +import com.fastasyncworldedit.core.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKeySet; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/CachedMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/CachedMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java index 5bb0ad108..145a99282 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/CachedMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/CachedMask.java @@ -1,10 +1,9 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; -import com.fastasyncworldedit.core.object.function.mask.AbstractDelegateMask; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; public class CachedMask extends AbstractDelegateMask implements ResettableMask { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/DataMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DataMask.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/DataMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DataMask.java index 7479a2a16..2b3ad7edb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/DataMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DataMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/DirectionMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DirectionMask.java similarity index 69% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/DirectionMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DirectionMask.java index 844e7b324..e443e7e56 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/DirectionMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/DirectionMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.function.mask; public interface DirectionMask { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ExtremaMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ExtremaMask.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ExtremaMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ExtremaMask.java index 2ce78b371..63c43b784 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ExtremaMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ExtremaMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdDataMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdDataMask.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdDataMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdDataMask.java index 74cae871e..6f3fa6d15 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdDataMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdDataMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java index b9a279374..e76c78a89 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/IdMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/ImageBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/ImageBrushMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java index 2682f6491..9c3c80d59 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/ImageBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ImageBrushMask.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.object.brush.mask; +package com.fastasyncworldedit.core.function.mask; -import com.fastasyncworldedit.core.object.brush.ImageBrush; +import com.fastasyncworldedit.core.command.tool.brush.ImageBrush; import com.fastasyncworldedit.core.util.TextureUtil; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/InverseMask.java similarity index 76% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/InverseMask.java index 2389eb981..3054bd6c3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/InverseMask.java @@ -1,5 +1,9 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; +import com.sk89q.worldedit.function.mask.AbstractMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Mask2D; +import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.math.BlockVector3; import javax.annotation.Nullable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/LayerBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/LayerBrushMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java index ade248f7e..43400959d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/LayerBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LayerBrushMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.brush.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; @@ -7,7 +7,7 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.visitor.BreadthFirstSearch; import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BlockState; public class LayerBrushMask extends AbstractExtentMask { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/LiquidMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LiquidMask.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/LiquidMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LiquidMask.java index 6f4232ec7..1895dfb2d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/LiquidMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/LiquidMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.BlockMask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion.java similarity index 76% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion.java index 4adf197de..5a5ca9b23 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion.java @@ -1,24 +1,9 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Mask2D; +import com.sk89q.worldedit.function.mask.MaskIntersection; +import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.math.BlockVector3; import java.util.ArrayList; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion2D.java similarity index 55% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion2D.java index 28073e2d4..53edf2c45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskUnion2D.java @@ -1,24 +1,7 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; +import com.sk89q.worldedit.function.mask.Mask2D; +import com.sk89q.worldedit.function.mask.MaskIntersection2D; import com.sk89q.worldedit.math.BlockVector2; import java.util.Collection; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/MaskedTargetBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskedTargetBlock.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/MaskedTargetBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskedTargetBlock.java index 575276d3b..6e136e9e9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/MaskedTargetBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/MaskedTargetBlock.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/PlaneMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/PlaneMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java index 6fe28fed9..e668d0a5b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/PlaneMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/PlaneMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ROCAngleMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ROCAngleMask.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ROCAngleMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ROCAngleMask.java index 1d6430839..beb9e799f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ROCAngleMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ROCAngleMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RadiusMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RadiusMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java index 78d8e2d46..66746f5f7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RadiusMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RadiusMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RandomMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RandomMask.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RandomMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RandomMask.java index bc29a43b4..5aab4c497 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/RandomMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/RandomMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ResettableMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ResettableMask.java similarity index 72% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ResettableMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ResettableMask.java index e72277300..05d6bb88a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ResettableMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ResettableMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.fastasyncworldedit.core.Resettable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SimplexMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SimplexMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java index 3eef3d4f3..9dc8fcb21 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SimplexMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SimplexMask.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; -import com.fastasyncworldedit.core.object.random.SimplexNoise; +import com.fastasyncworldedit.core.math.random.SimplexNoise; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockStateMask.java similarity index 88% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockStateMask.java index 5810a28ef..89c7fa236 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockStateMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockStateMask.java @@ -1,6 +1,9 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.InverseSingleBlockStateMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockTypeMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockTypeMask.java similarity index 89% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockTypeMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockTypeMask.java index 29a017c11..30261217b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SingleBlockTypeMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SingleBlockTypeMask.java @@ -1,6 +1,8 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.function.mask.InverseSingleBlockTypeMask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/SplatterBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SplatterBrushMask.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/SplatterBrushMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SplatterBrushMask.java index fc0dded7e..a85ab448b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/SplatterBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SplatterBrushMask.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush.mask; +package com.fastasyncworldedit.core.function.mask; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/StencilBrushMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/StencilBrushMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java index adbdaf324..a6cc4edd1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/mask/StencilBrushMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/StencilBrushMask.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.brush.mask; +package com.fastasyncworldedit.core.function.mask; -import com.fastasyncworldedit.core.object.brush.heightmap.HeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMap; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; @@ -8,7 +8,7 @@ import com.sk89q.worldedit.function.mask.AbstractExtentMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SurfaceMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceMask.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SurfaceMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceMask.java index 0dbf0dff3..2680feea7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/SurfaceMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/SurfaceMask.java @@ -1,8 +1,7 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; -import com.sk89q.worldedit.function.mask.BlockMaskBuilder; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/WallMakeMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/WallMakeMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java index 5834a1fb8..b2ef0cd9a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/WallMakeMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMakeMask.java @@ -1,5 +1,6 @@ -package com.sk89q.worldedit.function.mask; +package com.fastasyncworldedit.core.function.mask; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/WallMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/WallMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java index f8bee3ff4..24e560971 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/WallMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/WallMask.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; public class WallMask extends AbstractMask { private final int min; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/XAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/XAxisMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java index 0d80b09e9..7531d1465 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/XAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/XAxisMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/YAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/YAxisMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java index e99e099df..8dace5fee 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/YAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/YAxisMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractMask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ZAxisMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ZAxisMask.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java index 2daf4ddcb..269fc5dd8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/mask/ZAxisMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/ZAxisMask.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.mask; +package com.fastasyncworldedit.core.function.mask; import com.sk89q.worldedit.function.mask.AbstractMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AbstractExtentPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AbstractExtentPattern.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AbstractExtentPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AbstractExtentPattern.java index 7a04d1028..ccb4251e7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AbstractExtentPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AbstractExtentPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AngleColorPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AngleColorPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java index 154e9f942..b98dfb526 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AngleColorPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AngleColorPattern.java @@ -1,6 +1,5 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; -import com.fastasyncworldedit.core.object.DataAnglePattern; import com.fastasyncworldedit.core.util.TextureHolder; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AverageColorPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AverageColorPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AverageColorPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AverageColorPattern.java index 2cf4400d4..384e53009 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/AverageColorPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/AverageColorPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.util.TextureHolder; import com.fastasyncworldedit.core.util.TextureUtil; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BiomeApplyingPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BiomeApplyingPattern.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BiomeApplyingPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BiomeApplyingPattern.java index 0206cc8a8..6f6ba379a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BiomeApplyingPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BiomeApplyingPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern.java index 9a62d502a..b964a94c5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.fastasyncworldedit.core.util.FaweTimer; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extension.platform.Actor; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern2D.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern2D.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java index d14b9f640..f96b670d5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/BufferedPattern2D.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/BufferedPattern2D.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/DataAnglePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataAnglePattern.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/DataAnglePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataAnglePattern.java index 9d4636bb4..0e3354108 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/DataAnglePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataAnglePattern.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.function.pattern; -import com.fastasyncworldedit.core.object.extent.ExtentHeightCacher; +import com.fastasyncworldedit.core.extent.ExtentHeightCacher; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DataPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DataPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataPattern.java index 3db455fb0..687edc890 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DataPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DataPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DesaturatePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DesaturatePattern.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DesaturatePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DesaturatePattern.java index 9a8ed5b32..020d3277b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/DesaturatePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/DesaturatePattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.util.TextureHolder; import com.fastasyncworldedit.core.util.TextureUtil; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExistingPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExistingPattern.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExistingPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExistingPattern.java index a598eff71..cd4411331 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExistingPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExistingPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExpressionPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExpressionPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java index 08d9fb860..4244f9207 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ExpressionPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ExpressionPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.internal.expression.EvaluationException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdDataMaskPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdDataMaskPattern.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdDataMaskPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdDataMaskPattern.java index 93cd8fb9b..d5155bebb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdDataMaskPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdDataMaskPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdPattern.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdPattern.java index 4adf1c7e7..ccaa25097 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/IdPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/IdPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.Pattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear2DBlockPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear2DBlockPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java index 31023b9c1..4cc4dc037 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear2DBlockPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear2DBlockPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear3DBlockPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear3DBlockPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java index 6bcc929f5..b36132a62 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/Linear3DBlockPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/Linear3DBlockPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/LinearBlockPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/LinearBlockPattern.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/LinearBlockPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/LinearBlockPattern.java index b852e4fb2..be1a25c69 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/LinearBlockPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/LinearBlockPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/MaskedPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/MaskedPattern.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/MaskedPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/MaskedPattern.java index 3fbfb17ce..e08aa6bd0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/MaskedPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/MaskedPattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoXPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoXPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java index d20945ea7..c75b70f18 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoXPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoXPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; public class NoXPattern extends AbstractPattern { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoYPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoYPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java index b0de8e0f7..18d22e4b2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoYPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoYPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; public class NoYPattern extends AbstractPattern { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoZPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoZPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java index a53466caa..ee33f5cc6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/NoZPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/NoZPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; public class NoZPattern extends AbstractPattern { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/OffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/OffsetPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java index 47d319441..e7c4ef416 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/OffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/OffsetPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; public class OffsetPattern extends AbstractPattern { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PatternTraverser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PatternTraverser.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PatternTraverser.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PatternTraverser.java index 6d0b824e2..e284dc9dc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PatternTraverser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PatternTraverser.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.Resettable; import com.sk89q.worldedit.extent.Extent; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PropertyPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PropertyPattern.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PropertyPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PropertyPattern.java index f82594ada..131414683 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/PropertyPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/PropertyPattern.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; -import com.fastasyncworldedit.core.object.string.MutableCharSequence; +import com.fastasyncworldedit.core.util.MutableCharSequence; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.jnbt.CompoundTag; @@ -10,7 +10,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.IntegerProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomFullClipboardPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomFullClipboardPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java index b606fdd47..3ce6fc3fb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomFullClipboardPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomFullClipboardPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.Transform; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomOffsetPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java index 08de59796..9ae88cd16 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RandomOffsetPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import java.util.SplittableRandom; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RelativePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RelativePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java index 25be48c49..52be69e90 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/RelativePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/RelativePattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; public class RelativePattern extends AbstractPattern implements ResettablePattern { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ResettablePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ResettablePattern.java similarity index 72% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ResettablePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ResettablePattern.java index 1107dbf5c..fd4be743d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ResettablePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ResettablePattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.Resettable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SaturatePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SaturatePattern.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SaturatePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SaturatePattern.java index c06e295a9..e79d649d9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SaturatePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SaturatePattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.util.TextureHolder; import com.fastasyncworldedit.core.util.TextureUtil; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ShadePattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ShadePattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ShadePattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ShadePattern.java index f5d2c780b..a6f6a5899 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/ShadePattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/ShadePattern.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.fastasyncworldedit.core.util.TextureUtil; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SolidRandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SolidRandomOffsetPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java index d0ca1d7fb..dad91f91d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SolidRandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SolidRandomOffsetPattern.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SurfaceRandomOffsetPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SurfaceRandomOffsetPattern.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java index 4919229ea..8d5f4d964 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/pattern/SurfaceRandomOffsetPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/SurfaceRandomOffsetPattern.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.pattern; +package com.fastasyncworldedit.core.function.pattern; import com.sk89q.worldedit.function.pattern.AbstractPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.visitor.BreadthFirstSearch; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import java.util.concurrent.ThreadLocalRandom; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/AboveVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/AboveVisitor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java index 044acfc4e..24fbcb72c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/AboveVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/AboveVisitor.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSRecursiveVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSRecursiveVisitor.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSRecursiveVisitor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSRecursiveVisitor.java index 5d013c2d3..8e32c56b2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSRecursiveVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSRecursiveVisitor.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSVisitor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java index 9302b170b..ad8b32c06 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/visitor/DFSVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DFSVisitor.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.IntTriple; +import com.fastasyncworldedit.core.math.IntTriple; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DirectionalVisitor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java similarity index 70% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DirectionalVisitor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java index 5f036c403..24a35b989 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DirectionalVisitor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/DirectionalVisitor.java @@ -1,26 +1,8 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.function.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.math.BlockVector3; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/IntersectRegionFunction.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/IntersectRegionFunction.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/IntersectRegionFunction.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/IntersectRegionFunction.java index 8d0f5ea10..4cd8486e1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/IntersectRegionFunction.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/IntersectRegionFunction.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.function.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; @@ -11,7 +11,6 @@ public class IntersectRegionFunction implements RegionFunction { this.functions = functions; } - @Override public boolean apply(BlockVector3 position) throws WorldEditException { boolean ret = false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/Order.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/Order.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/Order.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/Order.java index 913d4a0b5..35f82a0cc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/Order.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/visitor/Order.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.function.visitor; +package com.fastasyncworldedit.core.function.visitor; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/DiskStorageHistory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/DiskStorageHistory.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/DiskStorageHistory.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/DiskStorageHistory.java index 928d13f70..93a945d80 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/DiskStorageHistory.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/DiskStorageHistory.java @@ -1,12 +1,14 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.database.DBHandler; import com.fastasyncworldedit.core.database.RollbackDatabase; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.IntPair; +import com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet; +import com.fastasyncworldedit.core.history.changeset.SimpleChangeSetSummary; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/MemoryOptimizedHistory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/MemoryOptimizedHistory.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/MemoryOptimizedHistory.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/MemoryOptimizedHistory.java index a270a1019..9aaa01636 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/MemoryOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/MemoryOptimizedHistory.java @@ -1,10 +1,11 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArraysInputStream; +import com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/logging/RollbackOptimizedHistory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/logging/RollbackOptimizedHistory.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java index fdb5b4656..80d5ab6f2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/logging/RollbackOptimizedHistory.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/RollbackOptimizedHistory.java @@ -1,9 +1,8 @@ -package com.fastasyncworldedit.core.logging; +package com.fastasyncworldedit.core.history; import com.fastasyncworldedit.core.database.DBHandler; import com.fastasyncworldedit.core.database.RollbackDatabase; -import com.fastasyncworldedit.core.object.changeset.DiskStorageHistory; -import com.fastasyncworldedit.core.object.changeset.SimpleChangeSetSummary; +import com.fastasyncworldedit.core.history.changeset.SimpleChangeSetSummary; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBiomeChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBiomeChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java index 8cb5e8041..88f1ac4d3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBiomeChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.history.change.Change; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.biome.BiomeTypes; public class MutableBiomeChange implements Change { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBlockChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBlockChange.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBlockChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBlockChange.java index b4857b367..6264c2735 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableBlockChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBlockChange.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.history.UndoContext; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableEntityChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableEntityChange.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableEntityChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableEntityChange.java index 72da7ba37..82aeb8c19 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableEntityChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableEntityChange.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableFullBlockChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableFullBlockChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java index 9396829eb..1d2c3abfe 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableFullBlockChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.inventory.BlockBag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableTileChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableTileChange.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableTileChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableTileChange.java index 6cc4a709e..16e64f75e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/MutableTileChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableTileChange.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/StreamChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/StreamChange.java similarity index 80% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/StreamChange.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/StreamChange.java index 753e8bb5f..066a4855b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/change/StreamChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/StreamChange.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.change; +package com.fastasyncworldedit.core.history.change; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; import net.jpountz.lz4.LZ4BlockInputStream; import net.jpountz.lz4.LZ4BlockOutputStream; @@ -13,11 +13,11 @@ import java.io.FileOutputStream; import java.io.IOException; public interface StreamChange { - public void flushChanges(FaweOutputStream out) throws IOException; + void flushChanges(FaweOutputStream out) throws IOException; - public void undoChanges(FaweInputStream in) throws IOException; + void undoChanges(FaweInputStream in) throws IOException; - public void redoChanges(FaweInputStream in) throws IOException; + void redoChanges(FaweInputStream in) throws IOException; default void flushChanges(File file) throws IOException { try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractChangeSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java index 93512b3f1..eb0ae7231 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history.changeset; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; -import com.fastasyncworldedit.core.object.HistoryExtent; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; +import com.fastasyncworldedit.core.extent.HistoryExtent; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.TaskManager; @@ -27,7 +27,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockID; +import com.fastasyncworldedit.core.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; import java.io.IOException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractDelegateChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractDelegateChangeSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java index 84504e949..1bbf040af 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/AbstractDelegateChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history.changeset; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; @@ -8,7 +8,6 @@ import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.history.change.EntityCreate; import com.sk89q.worldedit.history.change.EntityRemove; -import com.sk89q.worldedit.history.changeset.ChangeSetSummary; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.World; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/BlockBagChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/BlockBagChangeSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java index d27cb4dff..15d62a09c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/BlockBagChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/BlockBagChangeSet.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history.changeset; import com.fastasyncworldedit.core.FaweCache; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/ChangeSetSummary.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/ChangeSetSummary.java index b8367ea3b..dc0532e60 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSetSummary.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/ChangeSetSummary.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.history.changeset; +package com.fastasyncworldedit.core.history.changeset; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/FaweStreamChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/FaweStreamChangeSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java index b38cb7480..429e376ff 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/FaweStreamChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java @@ -1,13 +1,13 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history.changeset; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.change.MutableBiomeChange; -import com.fastasyncworldedit.core.object.change.MutableBlockChange; -import com.fastasyncworldedit.core.object.change.MutableEntityChange; -import com.fastasyncworldedit.core.object.change.MutableFullBlockChange; -import com.fastasyncworldedit.core.object.change.MutableTileChange; +import com.fastasyncworldedit.core.history.change.MutableBiomeChange; +import com.fastasyncworldedit.core.history.change.MutableBlockChange; +import com.fastasyncworldedit.core.history.change.MutableEntityChange; +import com.fastasyncworldedit.core.history.change.MutableFullBlockChange; +import com.fastasyncworldedit.core.history.change.MutableTileChange; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/NullChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/NullChangeSet.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/NullChangeSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/NullChangeSet.java index adb22b731..6b4339adf 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/NullChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/NullChangeSet.java @@ -1,6 +1,5 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.history.changeset; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.history.change.Change; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/SimpleChangeSetSummary.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/SimpleChangeSetSummary.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java index 174007b4f..290e940a6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/changeset/SimpleChangeSetSummary.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.changeset; +package com.fastasyncworldedit.core.history.changeset; -import com.sk89q.worldedit.history.changeset.ChangeSetSummary; +import com.fastasyncworldedit.core.history.changeset.ChangeSetSummary; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/command/MethodInjector.java similarity index 92% rename from worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/command/MethodInjector.java index 0ca5e85b7..d900a3797 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/MethodInjector.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/command/MethodInjector.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.internal.command; +package com.fastasyncworldedit.core.internal.command; import org.enginehub.piston.CommandParameters; import org.enginehub.piston.gen.CommandCallListener; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweBlockBagException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweBlockBagException.java similarity index 80% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweBlockBagException.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweBlockBagException.java index 698cad3b2..845628262 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweBlockBagException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweBlockBagException.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.exception; +package com.fastasyncworldedit.core.internal.exception; import com.fastasyncworldedit.core.configuration.Caption; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweChunkLoadException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweChunkLoadException.java similarity index 80% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweChunkLoadException.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweChunkLoadException.java index 54c38aa0d..c00675580 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweChunkLoadException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweChunkLoadException.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.exception; +package com.fastasyncworldedit.core.internal.exception; import com.fastasyncworldedit.core.configuration.Caption; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweException.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java index 9205e89bd..3d923e376 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/exception/FaweException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.exception; +package com.fastasyncworldedit.core.internal.exception; import com.sk89q.worldedit.util.formatting.WorldEditText; import com.sk89q.worldedit.util.formatting.text.Component; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AbstractDelegateOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/AbstractDelegateOutputStream.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AbstractDelegateOutputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/AbstractDelegateOutputStream.java index 39ce6f35b..8ddcc2a1a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AbstractDelegateOutputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/AbstractDelegateOutputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import java.io.IOException; import java.io.OutputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArrayOutputStream.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayOutputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArrayOutputStream.java index 169c2f52e..8ffc036b4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayOutputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArrayOutputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import java.io.IOException; import java.io.OutputStream; @@ -7,7 +7,6 @@ import java.io.Writer; import java.util.ArrayDeque; import java.util.Arrays; - /** * A speedy implementation of ByteArrayOutputStream. It's not synchronized, and it * does not copy buffers when it's expanded. There's also no copying of the internal buffer @@ -22,10 +21,10 @@ public class FastByteArrayOutputStream extends OutputStream { private static final int DEFAULT_BLOCK_SIZE = 8192; - private ArrayDeque buffers = new ArrayDeque<>(); + private final ArrayDeque buffers = new ArrayDeque<>(); private byte[] buffer; - private int blockSize; + private final int blockSize; private int index; private int size; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArraysInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArraysInputStream.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArraysInputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArraysInputStream.java index 8ef9f18b5..34434e691 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArraysInputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FastByteArraysInputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import java.io.InputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweInputStream.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweInputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweInputStream.java index b62525c5c..0a498ddc8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweInputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweInputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.internal.io; import com.fastasyncworldedit.core.util.IOUtil; import com.sk89q.jnbt.NBTInputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweOutputStream.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweOutputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweOutputStream.java index 28768a07d..bf824c7c6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/FaweOutputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/FaweOutputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.internal.io; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.Tag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/LittleEndianOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/LittleEndianOutputStream.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/LittleEndianOutputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/LittleEndianOutputStream.java index 22c317042..c6d028938 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/LittleEndianOutputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/LittleEndianOutputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonCloseableInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/NonCloseableInputStream.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonCloseableInputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/NonCloseableInputStream.java index 652538bb9..9e9a74f25 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonCloseableInputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/NonCloseableInputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import java.io.IOException; import java.io.InputStream; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/ResettableFileInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/ResettableFileInputStream.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/ResettableFileInputStream.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/ResettableFileInputStream.java index 688ddc3d9..4db2a2da3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/ResettableFileInputStream.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/io/ResettableFileInputStream.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.io; +package com.fastasyncworldedit.core.internal.io; import java.io.FileInputStream; import java.io.FilterInputStream; @@ -6,7 +6,7 @@ import java.io.IOException; import java.nio.channels.FileChannel; public class ResettableFileInputStream extends FilterInputStream { - private FileChannel myFileChannel; + private final FileChannel myFileChannel; private long mark = 0; public ResettableFileInputStream(FileInputStream fis) { diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedCompoundTag.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedCompoundTag.java similarity index 88% rename from worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedCompoundTag.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedCompoundTag.java index 39eca054c..bcb4d11ad 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedCompoundTag.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedCompoundTag.java @@ -1,5 +1,8 @@ -package com.sk89q.jnbt; +package com.fastasyncworldedit.core.jnbt; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTInputStream; +import com.sk89q.jnbt.Tag; import net.jpountz.lz4.LZ4BlockInputStream; import java.io.IOException; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedSchematicTag.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedSchematicTag.java similarity index 77% rename from worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedSchematicTag.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedSchematicTag.java index a45b86b17..d42768a87 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/CompressedSchematicTag.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/CompressedSchematicTag.java @@ -1,11 +1,10 @@ -package com.sk89q.jnbt.fawe; +package com.fastasyncworldedit.core.jnbt; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArraysInputStream; -import com.sk89q.jnbt.CompressedCompoundTag; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArraysInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter; import net.jpountz.lz4.LZ4BlockInputStream; import net.jpountz.lz4.LZ4BlockOutputStream; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/NumberTag.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/NumberTag.java similarity index 79% rename from worldedit-core/src/main/java/com/sk89q/jnbt/fawe/NumberTag.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/NumberTag.java index c90428e8d..db1984bb3 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/NumberTag.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/jnbt/NumberTag.java @@ -1,4 +1,4 @@ -package com.sk89q.jnbt.fawe; +package com.fastasyncworldedit.core.jnbt; import com.sk89q.jnbt.Tag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArray.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArray.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArray.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArray.java index f3ebdcb18..bf492e3d1 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArray.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArray.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; public final class BitArray { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArrayUnstretched.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArrayUnstretched.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArrayUnstretched.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArrayUnstretched.java index 4f9434ad6..3b759c879 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BitArrayUnstretched.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BitArrayUnstretched.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.util.MathMan; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVector3ChunkMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVector3ChunkMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java index bfb3af54c..d25f347dc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVector3ChunkMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.util.collection.IAdaptedMap; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVectorSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVectorSet.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVectorSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVectorSet.java index 1d64c7476..29bad32ef 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockVectorSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVectorSet.java @@ -1,8 +1,7 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIterator; @@ -25,7 +24,7 @@ import java.util.Set; *

*/ public class BlockVectorSet extends AbstractCollection implements Set { - private Int2ObjectMap localSets = new Int2ObjectOpenHashMap<>(); + private final Int2ObjectMap localSets = new Int2ObjectOpenHashMap<>(); @Override public int size() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/DelegateBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/DelegateBlockVector3.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java index 538f38220..a4dd259e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/DelegateBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/DelegateBlockVector3.java @@ -1,7 +1,10 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastBitSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastBitSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java index ab6a14356..97d539416 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastBitSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; import java.util.Arrays; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntPair.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntPair.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntPair.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntPair.java index 5cfdf135a..dbb92a118 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntPair.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntPair.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.math; public final class IntPair { public int x; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntTriple.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntTriple.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntTriple.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntTriple.java index d41ab9502..9cbe86f6c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/IntTriple.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/IntTriple.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.math; public final class IntTriple { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVectorSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVectorSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java index ea8b0d6b0..6bc37ce38 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVectorSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/LocalBlockVectorSet.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.zaxxer.sparsebits.SparseBitSet; import org.jetbrains.annotations.NotNull; import java.util.Collection; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector2.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector2.java similarity index 91% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector2.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector2.java index 1f9b71bc9..42a090682 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector2.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector2.java @@ -1,4 +1,6 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; + +import com.sk89q.worldedit.math.BlockVector2; public class MutableBlockVector2 extends BlockVector2 { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java similarity index 95% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector3.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java index c2f68f4fb..1b00fe38e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableBlockVector3.java @@ -1,6 +1,7 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.FaweCache; +import com.sk89q.worldedit.math.BlockVector3; public class MutableBlockVector3 extends BlockVector3 { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java similarity index 96% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableVector3.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java index 878906258..4342150b9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/MutableVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/MutableVector3.java @@ -1,6 +1,7 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; import com.fastasyncworldedit.core.FaweCache; +import com.sk89q.worldedit.math.Vector3; public class MutableVector3 extends Vector3 { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/OffsetBlockVector3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java similarity index 83% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/OffsetBlockVector3.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java index ea8253632..6c73273a4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/OffsetBlockVector3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/OffsetBlockVector3.java @@ -1,4 +1,6 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; + +import com.sk89q.worldedit.math.BlockVector3; public class OffsetBlockVector3 extends DelegateBlockVector3 { private final BlockVector3 offset; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3Impl.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java similarity index 87% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3Impl.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java index 7c1068417..9a5cf7b2f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3Impl.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/Vector3Impl.java @@ -1,4 +1,6 @@ -package com.sk89q.worldedit.math; +package com.fastasyncworldedit.core.math; + +import com.sk89q.worldedit.math.Vector3; public class Vector3Impl extends Vector3 { private final double x; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/NoiseRandom.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/NoiseRandom.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/NoiseRandom.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/NoiseRandom.java index 400ce1b77..0c5b86c2a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/NoiseRandom.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/NoiseRandom.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.random; +package com.fastasyncworldedit.core.math.random; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.noise.NoiseGenerator; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimpleRandom.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimpleRandom.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimpleRandom.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimpleRandom.java index 31e0c33fa..f8004eb41 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimpleRandom.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimpleRandom.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.random; +package com.fastasyncworldedit.core.math.random; public interface SimpleRandom { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimplexNoise.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoise.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimplexNoise.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoise.java index ef917d673..fd14b036f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/SimplexNoise.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoise.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.random; +package com.fastasyncworldedit.core.math.random; /* * A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/SimplexNoiseGenerator.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java similarity index 85% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/SimplexNoiseGenerator.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java index a5e19b6a3..8c937836e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/SimplexNoiseGenerator.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/SimplexNoiseGenerator.java @@ -1,8 +1,8 @@ -package com.sk89q.worldedit.math.noise; +package com.fastasyncworldedit.core.math.random; -import com.fastasyncworldedit.core.object.random.SimplexNoise; import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.math.noise.NoiseGenerator; public class SimplexNoiseGenerator implements NoiseGenerator { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/TrueRandom.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/TrueRandom.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/TrueRandom.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/TrueRandom.java index 99adaec28..f4d7d9df6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/random/TrueRandom.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/random/TrueRandom.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.random; +package com.fastasyncworldedit.core.math.random; import java.util.SplittableRandom; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/RoundedTransform.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/transform/RoundedTransform.java similarity index 88% rename from worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/RoundedTransform.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/math/transform/RoundedTransform.java index 8bdca82e8..aefc2997a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/RoundedTransform.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/transform/RoundedTransform.java @@ -1,6 +1,7 @@ -package com.sk89q.worldedit.math.transform; +package com.fastasyncworldedit.core.math.transform; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.math.transform.Transform; public class RoundedTransform implements Transform { private final Transform transform; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/Metadatable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/Metadatable.java deleted file mode 100644 index a38da1435..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/Metadatable.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fastasyncworldedit.core.object; - -import com.sk89q.worldedit.entity.MapMetadatable; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class Metadatable implements MapMetadatable { - private final ConcurrentMap meta = new ConcurrentHashMap<>(); - - @Override - public Map getRawMeta() { - return meta; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTool.java deleted file mode 100644 index b9ea8de93..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/brush/scroll/ScrollTool.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fastasyncworldedit.core.object.brush.scroll; - -import com.sk89q.worldedit.entity.Player; - -public interface ScrollTool { - public boolean increment(Player player, int amount); -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialArray.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialArray.java deleted file mode 100644 index b9b227cb8..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialArray.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.io.serialize.Serialize; -import com.fastasyncworldedit.core.util.MainUtil; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.util.Arrays; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Records changes made through the {@link #setByte(int, byte)} or {@link #setInt(int, int)} method
- * If you are editing the raw data, use {@link #record(Runnable)} - * @param - */ -public final class DifferentialArray implements DifferentialCollection { - private final byte[] dataBytes; - private byte[] changesBytes; - - private final int[] dataInts; - private int[] changesInts; - - private final char[] dataChars; - private char[] changesChars; - - @Serialize - private final T data; - - private T changes; - - private boolean changed; - private int length; - - public DifferentialArray(T array) { - checkNotNull(array); - Class clazz = array.getClass(); - checkArgument(clazz.isArray(), "Data must be an array"); - checkArgument(clazz.getComponentType().isPrimitive(), "Data must be a primitive array"); - this.data = array; - - if (array instanceof byte[]) { - dataBytes = (byte[]) array; - length = dataBytes.length; - } else { - dataBytes = null; - } - if (array instanceof int[]) { - dataInts = (int[]) array; - length = dataInts.length; - } else { - dataInts = null; - } - if (array instanceof char[]) { - dataChars = (char[]) array; - length = dataChars.length; - } else { - dataChars = null; - } - } - - public void record(Runnable task) { - if (changes == null) { - if (data instanceof byte[]) { - changes = (T) (changesBytes = new byte[length]); - } else if (data instanceof int[]) { - changes = (T) (changesInts = new int[length]); - } else if (data instanceof char[]) { - changes = (T) (changesChars = new char[length]); - } - } - T tmp; - boolean changed = this.changed; - if (changed) { - tmp = (T) MainUtil.copyNd(data); - } else { - tmp = changes; - System.arraycopy(data, 0, tmp, 0, Array.getLength(data)); - } - Throwable caught = null; - try { - task.run(); - } catch (Throwable e) { - caught = e; - task.run(); - } - if (tmp instanceof int[]) { - int[] tmpInts = (int[]) tmp; - for (int i = 0; i < tmpInts.length; i++) { - int tmpInt = tmpInts[i]; - int dataInt = dataInts[i]; - if (tmpInt != dataInt) { - this.changed = true; - tmpInts[i] -= dataInt; - } else { - tmpInts[i] = 0; - } - } - if (changed) { - for (int i = 0; i < tmpInts.length; i++) { - changesInts[i] += tmpInts[i]; - } - } - } else if (tmp instanceof char[]) { - char[] tmpChars = (char[]) tmp; - for (int i = 0; i < tmpChars.length; i++) { - char tmpChar = tmpChars[i]; - char dataChar = dataChars[i]; - if (tmpChar != dataChar) { - this.changed = true; - tmpChars[i] -= dataChar; - } else { - tmpChars[i] = 0; - } - } - if (changed) { - for (int i = 0; i < tmpChars.length; i++) { - changesChars[i] += tmpChars[i]; - } - } - } else if (tmp instanceof byte[]) { - byte[] tmpBytes = (byte[]) tmp; - for (int i = 0; i < tmpBytes.length; i++) { - byte tmpByte = tmpBytes[i]; - byte dataByte = dataBytes[i]; - if (tmpByte != dataByte) { - this.changed = true; - tmpBytes[i] -= dataByte; - } else { - tmpBytes[i] = 0; - } - } - if (changed) { - for (int i = 0; i < tmpBytes.length; i++) { - changesBytes[i] += tmpBytes[i]; - } - } - } - if (caught != null) { - if (caught instanceof RuntimeException) { - throw (RuntimeException) caught; - } else { - throw new RuntimeException(caught); - } - } - } - - @Override - public void flushChanges(FaweOutputStream out) throws IOException { - boolean modified = isModified(); - out.writeBoolean(modified); - if (modified) { - if (dataBytes != null) { - out.write(changesBytes); - } else if (dataInts != null) { - for (int c : changesInts) { - out.writeVarInt(c); - } - } else if (dataChars != null) { - for (char c : changesChars) { - out.writeChar(c); - } - } - } - clearChanges(); - } - - @Override - public void undoChanges(FaweInputStream in) throws IOException { - boolean modified = in.readBoolean(); - if (modified) { - if (dataBytes != null) { - if (changesBytes != null) { - for (int i = 0; i < dataBytes.length; i++) { - dataBytes[i] += changesBytes[i]; - } - } - for (int i = 0; i < dataBytes.length; i++) { - int read = in.read(); - dataBytes[i] += read; - } - } else if (dataInts != null) { - if (changesInts != null) { - for (int i = 0; i < dataInts.length; i++) { - dataInts[i] += changesInts[i]; - } - } - for (int i = 0; i < changesInts.length; i++) { - dataInts[i] += in.readVarInt(); - } - } else if (dataChars != null) { - if (changesChars != null) { - for (int i = 0; i < dataChars.length; i++) { - dataChars[i] += changesChars[i]; - } - } - for (int i = 0; i < dataChars.length; i++) { - dataChars[i] += in.readChar(); - } - } - } - clearChanges(); - } - - @Override - public void redoChanges(FaweInputStream in) throws IOException { - boolean modified = in.readBoolean(); - if (modified) { - if (dataBytes != null) { - for (int i = 0; i < dataBytes.length; i++) { - int read = in.read(); - dataBytes[i] -= read; - } - } else if (dataInts != null) { - for (int i = 0; i < dataChars.length; i++) { - dataInts[i] -= in.readVarInt(); - } - } else if (dataChars != null) { - for (int i = 0; i < dataChars.length; i++) { - dataChars[i] -= in.readChar(); - } - } - } - clearChanges(); - } - - public void clearChanges() { - if (changed) { - changed = false; - if (changes != null) { - if (changesBytes != null) { - Arrays.fill(changesBytes, (byte) 0); - } - if (changesChars != null) { - Arrays.fill(changesChars, (char) 0); - } - if (changesInts != null) { - Arrays.fill(changesInts, 0); - } - } - } - } - - public byte[] getByteArray() { - return dataBytes; - } - - public char[] getCharArray() { - return dataChars; - } - - public int[] getIntArray() { - return dataInts; - } - - public boolean isModified() { - return changed; - } - - @Override - public T get() { - return data; - } - - public byte getByte(int index) { - return dataBytes[index]; - } - - public char getChar(int index) { - return dataChars[index]; - } - - public int getInt(int index) { - return dataInts[index]; - } - - public void setByte(int index, byte value) { - changed = true; - try { - changesBytes[index] += (dataBytes[index] - value); - } catch (NullPointerException ignored) { - changes = (T) (changesBytes = new byte[dataBytes.length]); - changesBytes[index] += (dataBytes[index] - value); - } - dataBytes[index] = value; - } - - public void setInt(int index, int value) { - changed = true; - try { - changesInts[index] += dataInts[index] - value; - } catch (NullPointerException ignored) { - changes = (T) (changesInts = new int[dataInts.length]); - changesInts[index] += dataInts[index] - value; - } - dataInts[index] = value; - } - - public void setChar(int index, char value) { - changed = true; - try { - changesChars[index] += dataChars[index] - value; - } catch (NullPointerException ignored) { - changes = (T) (changesChars = new char[dataChars.length]); - changesChars[index] += dataChars[index] - value; - } - dataChars[index] = value; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialBlockBuffer.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialBlockBuffer.java deleted file mode 100644 index 233962161..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialBlockBuffer.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; - -import java.io.IOException; -import java.lang.reflect.Array; - -/** - * Records changes made through the {@link #set(int, int, int, char)} method
- * Changes are not recorded if you edit the raw data - */ -public final class DifferentialBlockBuffer implements DifferentialCollection { - - private final int width; - private final int length; - private final int t1; - private final int t2; - private char[][][][][] data; - private char[][][][][] changes; - - public DifferentialBlockBuffer(int width, int length) { - this.width = width; - this.length = length; - this.t1 = (length + 15) >> 4; - this.t2 = (width + 15) >> 4; - } - - @Override - public char[][][][][] get() { - return data; - } - - @Override - public void flushChanges(FaweOutputStream out) throws IOException { - boolean modified = isModified(); - out.writeBoolean(modified); - - if (modified) { - writeArray(changes, 0, 0, out); - } - clearChanges(); - } - - private void writeArray(Object arr, int level, int index, FaweOutputStream out) throws IOException { - if (level == 4) { - if (arr != null) { - int[] level4 = (int[]) arr; - out.writeVarInt(level4.length); - for (int c : level4) { - out.writeVarInt(c); - } - } else { - out.writeVarInt(0); - } - } else { - int len = arr == null ? 0 : Array.getLength(arr); - out.writeVarInt(len); - for (int i = 0; i < len; i++) { - Object elem = Array.get(arr, i); - writeArray(elem, level + 1, i, out); - } - } - } - - @Override - public void undoChanges(FaweInputStream in) throws IOException { - if (changes != null && changes.length != 0) { - throw new IllegalStateException("There are uncommitted changes, please flush first"); - } - boolean modified = in.readBoolean(); - if (modified) { - int len = in.readVarInt(); - if (len == 0) { - data = null; - } else { - for (int i = 0; i < len; i++) { - readArray(data, i, 1, in); - } - } - } - - clearChanges(); - } - - @Override - public void redoChanges(FaweInputStream in) throws IOException { - clearChanges(); - throw new UnsupportedOperationException("Not implemented"); - } - - private void readArray(Object dataElem, int index, int level, FaweInputStream in) throws IOException { - int len = in.readVarInt(); - if (level == 4) { - int[][] castedElem = (int[][]) dataElem; - if (len == 0) { - castedElem[index] = null; - } else { - int[] current = castedElem[index]; - for (int i = 0; i < len; i++) { - current[i] = in.readVarInt(); - } - } - } else { - if (len == 0) { - Array.set(dataElem, index, null); - } else { - Object nextElem = Array.get(dataElem, index); - for (int i = 0; i < len; i++) { - readArray(nextElem, i, level + 1, in); - } - } - } - } - - public boolean isModified() { - return changes != null; - } - - public void clearChanges() { - changes = null; - } - - public void set(int x, int y, int z, char combined) { - if (combined == 0) { - combined = 1; - } - int localX = x & 15; - int localZ = z & 15; - int chunkX = x >> 4; - int chunkZ = z >> 4; - if (data == null) { - data = new char[t1][][][][]; - changes = new char[0][][][][]; - } - - char[][][][] arr = data[chunkZ]; - if (arr == null) { - arr = data[chunkZ] = new char[t2][][][]; - } - char[][][] arr2 = arr[chunkX]; - if (arr2 == null) { - arr2 = arr[chunkX] = new char[256][][]; - } - - char[][] yMap = arr2[y]; - if (yMap == null) { - arr2[y] = yMap = new char[16][]; - } - boolean newSection; - int current; - char[] zMap = yMap[localZ]; - if (zMap == null) { - yMap[localZ] = zMap = new char[16]; - - if (changes == null) { - changes = new char[t1][][][][]; - } else if (changes != null && changes.length != 0) { - initialChange(changes, chunkX, chunkZ, localX, localZ, y, (char) -combined); - } - - } else { - if (changes == null || changes.length == 0) { - changes = new char[t1][][][][]; - } - appendChange(changes, chunkX, chunkZ, localX, localZ, y, (char) (zMap[localX] - combined)); - } - - zMap[localX] = combined; - } - - private void initialChange(char[][][][][] src, int chunkX, int chunkZ, int localX, int localZ, int y, char combined) { - char[][][][] arr = src[chunkZ]; - if (arr == null) { - src[chunkZ] = new char[0][][][]; - return; - } else if (arr.length == 0) { - return; - } - - char[][][] arr2 = arr[chunkX]; - if (arr2 == null) { - arr[chunkX] = new char[0][][]; - return; - } else if (arr2.length == 0) { - return; - } - - char[][] yMap = arr2[y]; - if (yMap == null) { - arr2[y] = new char[0][]; - return; - } else if (yMap.length == 0) { - return; - } - - char[] zMap = yMap[localZ]; - if (zMap == null) { - yMap[localZ] = new char[0]; - return; - } else if (zMap.length == 0) { - return; - } - - int current = zMap[localX]; - zMap[localX] = combined; - } - - private void appendChange(char[][][][][] src, int chunkX, int chunkZ, int localX, int localZ, int y, char combined) { - char[][][][] arr = src[chunkZ]; - if (arr == null || arr.length == 0) { - arr = src[chunkZ] = new char[t2][][][]; - } - char[][][] arr2 = arr[chunkX]; - if (arr2 == null || arr2.length == 0) { - arr2 = arr[chunkX] = new char[256][][]; - } - - char[][] yMap = arr2[y]; - if (yMap == null || yMap.length == 0) { - arr2[y] = yMap = new char[16][]; - } - char[] zMap = yMap[localZ]; - if (zMap == null || zMap.length == 0) { - yMap[localZ] = zMap = new char[16]; - } - zMap[localX] = combined; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCharBlockBuffer.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCharBlockBuffer.java deleted file mode 100644 index 61ce7de46..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCharBlockBuffer.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; - -import java.io.IOException; -import java.lang.reflect.Array; - -/** - * Records changes made through the {@link #set(int, int, int, char)} method
- * Changes are not recorded if you edit the raw data - */ -public final class DifferentialCharBlockBuffer implements DifferentialCollection { - - private final int width; - private final int length; - private final int t1; - private final int t2; - private char[][][][][] data; - private char[][][][][] changes; - - public DifferentialCharBlockBuffer(int width, int length) { - this.width = width; - this.length = length; - this.t1 = (length + 15) >> 4; - this.t2 = (width + 15) >> 4; - } - - @Override - public char[][][][][] get() { - return data; - } - - @Override - public void flushChanges(FaweOutputStream out) throws IOException { - boolean modified = isModified(); - out.writeBoolean(modified); - - if (modified) { - writeArray(changes, 0, 0, out); - } - clearChanges(); - } - - private void writeArray(Object arr, int level, int index, FaweOutputStream out) throws IOException { - if (level == 4) { - if (arr != null) { - char[] level4 = (char[]) arr; - out.writeVarInt(level4.length); - for (char c : level4) { - out.writeChar(c); - } - } else { - out.writeVarInt(0); - } - } else { - int len = arr == null ? 0 : Array.getLength(arr); - out.writeVarInt(len); - for (int i = 0; i < len; i++) { - Object elem = Array.get(arr, i); - writeArray(elem, level + 1, i, out); - } - } - } - - @Override - public void undoChanges(FaweInputStream in) throws IOException { - if (changes != null && changes.length != 0) { - throw new IllegalStateException("There are uncommitted changes, please flush first"); - } - boolean modified = in.readBoolean(); - if (modified) { - int len = in.readVarInt(); - if (len == 0) { - data = null; - } else { - for (int i = 0; i < len; i++) { - readArray(data, i, 1, in); - } - } - } - - clearChanges(); - } - - @Override - public void redoChanges(FaweInputStream in) throws IOException { - clearChanges(); - throw new UnsupportedOperationException("Not implemented"); - } - - private void readArray(Object dataElem, int index, int level, FaweInputStream in) throws IOException { - int len = in.readVarInt(); - if (level == 4) { - char[][] castedElem = (char[][]) dataElem; - if (len == 0) { - castedElem[index] = null; - } else { - char[] current = castedElem[index]; - for (int i = 0; i < len; i++) { - current[i] = in.readChar(); - } - } - } else { - if (len == 0) { - Array.set(dataElem, index, null); - } else { - Object nextElem = Array.get(dataElem, index); - for (int i = 0; i < len; i++) { - readArray(nextElem, i, level + 1, in); - } - } - } - } - - public boolean isModified() { - return changes != null; - } - - public void clearChanges() { - changes = null; - } - - public void set(int x, int y, int z, char combined) { - if (combined == 0) { - combined = 1; - } - int localX = x & 15; - int localZ = z & 15; - int chunkX = x >> 4; - int chunkZ = z >> 4; - if (data == null) { - data = new char[t1][][][][]; - changes = new char[0][][][][]; - } - - char[][][][] arr = data[chunkZ]; - if (arr == null) { - arr = data[chunkZ] = new char[t2][][][]; - } - char[][][] arr2 = arr[chunkX]; - if (arr2 == null) { - arr2 = arr[chunkX] = new char[256][][]; - } - - char[][] yMap = arr2[y]; - if (yMap == null) { - arr2[y] = yMap = new char[16][]; - } - boolean newSection; - char current; - char[] zMap = yMap[localZ]; - if (zMap == null) { - yMap[localZ] = zMap = new char[16]; - - if (changes == null) { - changes = new char[t1][][][][]; - } else if (changes != null && changes.length != 0) { - initialChange(changes, chunkX, chunkZ, localX, localZ, y, (char) -combined); - } - - } else { - if (changes == null || changes.length == 0) { - changes = new char[t1][][][][]; - } - appendChange(changes, chunkX, chunkZ, localX, localZ, y, (char) (zMap[localX] - combined)); - } - - zMap[localX] = combined; - } - - private void initialChange(char[][][][][] src, int chunkX, int chunkZ, int localX, int localZ, int y, char combined) { - char[][][][] arr = src[chunkZ]; - if (arr == null) { - src[chunkZ] = new char[0][][][]; - return; - } else if (arr.length == 0) { - return; - } - - char[][][] arr2 = arr[chunkX]; - if (arr2 == null) { - arr[chunkX] = new char[0][][]; - return; - } else if (arr2.length == 0) { - return; - } - - char[][] yMap = arr2[y]; - if (yMap == null) { - arr2[y] = new char[0][]; - return; - } else if (yMap.length == 0) { - return; - } - - char[] zMap = yMap[localZ]; - if (zMap == null) { - yMap[localZ] = new char[0]; - return; - } else if (zMap.length == 0) { - return; - } - - char current = zMap[localX]; - zMap[localX] = combined; - } - - private void appendChange(char[][][][][] src, int chunkX, int chunkZ, int localX, int localZ, int y, char combined) { - char[][][][] arr = src[chunkZ]; - if (arr == null || arr.length == 0) { - arr = src[chunkZ] = new char[t2][][][]; - } - char[][][] arr2 = arr[chunkX]; - if (arr2 == null || arr2.length == 0) { - arr2 = arr[chunkX] = new char[256][][]; - } - - char[][] yMap = arr2[y]; - if (yMap == null || yMap.length == 0) { - arr2[y] = yMap = new char[16][]; - } - char[] zMap = yMap[localZ]; - if (zMap == null || zMap.length == 0) { - yMap[localZ] = zMap = new char[16]; - } - zMap[localX] = combined; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCollection.java deleted file mode 100644 index e3d192e2f..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/DifferentialCollection.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import com.fastasyncworldedit.core.object.change.StreamChange; - -public interface DifferentialCollection extends StreamChange { - public T get(); -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVector2DSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVector2DSet.java deleted file mode 100644 index 25dcb1e0c..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LocalBlockVector2DSet.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import com.fastasyncworldedit.core.util.MathMan; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector2; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Set; - -/** - * The LocalPartitionedBlockVector2DSet is a Memory and CPU optimized Set for storing Vector2Ds which are all in a local region - * - All Vector2Ds must be within x[0,32768), y[0,32768) - * - This will use 8 bytes for every 64 Vector2Ds (about 800x less than a HashSet) - */ -public class LocalBlockVector2DSet implements Set { - private final SparseBitSet set; - private final MutableBlockVector2 mutable = new MutableBlockVector2(); - - public LocalBlockVector2DSet() { - this.set = new SparseBitSet(); - } - - public SparseBitSet getBitSet() { - return set; - } - - @Override - public int size() { - return set.cardinality(); - } - - @Override - public boolean isEmpty() { - return set.isEmpty(); - } - - public boolean contains(int x, int y) { - return set.get(MathMan.pairSearchCoords(x, y)); - } - - @Override - public boolean contains(Object o) { - if (o instanceof BlockVector2) { - BlockVector2 v = (BlockVector2) o; - return contains(v.getBlockX(), v.getBlockZ()); - } - return false; - } - - public boolean containsRadius(int x, int y, int radius) { - int size = size(); - if (size == 0) { - return false; - } - if (radius <= 0 || size == 1) { - return contains(x, y); - } -// int centerIndex = MathMan.pairSearchCoords(x, y); - int length = (radius << 1) + 1; - if (size() < length * length) { - int index = -1; - int count = 0; - while ((index = set.nextSetBit(index + 1)) != -1) { -// if (index == centerIndex) continue; - int curx = MathMan.unpairSearchCoordsX(index); - int cury = MathMan.unpairSearchCoordsY(index); - if (Math.abs(curx - x) <= radius && Math.abs(cury - y) <= radius) { - return true; - } - } - return false; - } - int bcx = Math.max(0, (x - radius) >> 4); - int bcy = Math.max(0, (y - radius) >> 4); - int tcx = Math.min(2047, (x + radius) >> 4); - int tcy = Math.min(2047, (y + radius) >> 4); - for (int cy = bcy; cy <= tcy; cy++) { - for (int cx = bcx; cx <= tcx; cx++) { - int index = MathMan.pairSearchCoords(cx << 4, cy << 4) - 1; - int endIndex = index + 256; - while ((index = set.nextSetBit(index + 1)) != -1 && index <= endIndex) { -// if (index == centerIndex) continue; - int curx = MathMan.unpairSearchCoordsX(index); - int cury = MathMan.unpairSearchCoordsY(index); - if (Math.abs(curx - x) <= radius && Math.abs(cury - y) <= radius) { - return true; - } - } - } - } - return false; - } - - public BlockVector2 getIndex(int getIndex) { - int size = size(); - if (getIndex > size) { - return null; - } - int index = -1; - for (int i = 0; i <= getIndex; i++) { - index = set.nextSetBit(index + 1); - } - if (index != -1) { - int x = MathMan.unpairSearchCoordsX(index); - int y = MathMan.unpairSearchCoordsY(index); - return mutable.setComponents(x, y); - } - return null; - } - - @Override - public Iterator iterator() { - return new Iterator() { - int index = set.nextSetBit(0); - int previous = -1; - - @Override - public void remove() { - set.clear(previous); - } - - @Override - public boolean hasNext() { - return index != -1; - } - - @Override - public BlockVector2 next() { - if (index != -1) { - int x = MathMan.unpairSearchCoordsX(index); - int y = MathMan.unpairSearchCoordsY(index); - mutable.setComponents(x, y); - previous = index; - index = set.nextSetBit(index + 1); - return mutable; - } - return null; - } - }; - } - - @Override - public Object[] toArray() { - return toArray((Object[]) null); - } - - @Override - public T[] toArray(T[] array) { - int size = size(); - if (array == null || array.length < size) { - array = (T[]) new BlockVector2[size]; - } - int index = 0; - for (int i = 0; i < size; i++) { - index = set.nextSetBit(index); - int x = MathMan.unpairSearchCoordsX(index); - int y = MathMan.unpairSearchCoordsY(index); - array[i] = (T) BlockVector2.at(x, y); - index++; - } - return array; - } - - public boolean add(int x, int y) { - if (x < 0 || x > 32766 || y < 0 || y > 32766) { - throw new UnsupportedOperationException("LocalVector2DSet can only contain Vector2Ds within 1024 blocks (cuboid) of the first entry. "); - } - int index = getIndex(x, y); - if (set.get(index)) { - return false; - } else { - set.set(index); - return true; - } - } - - @Override - public boolean add(BlockVector2 vector) { - return add(vector.getBlockX(), vector.getBlockZ()); - } - - private int getIndex(BlockVector2 vector) { - return MathMan.pairSearchCoords(vector.getBlockX(), vector.getBlockZ()); - } - - private int getIndex(int x, int y) { - return MathMan.pairSearchCoords(x, y); - } - - public boolean remove(int x, int y) { - if (x < 0 || x > 32766 || y < 0 || y > 32766) { - return false; - } - int index = MathMan.pairSearchCoords(x, y); - boolean value = set.get(index); - if (value) { - set.clear(index); - } - return value; - } - - @Override - public boolean remove(Object o) { - if (o instanceof BlockVector2) { - BlockVector2 v = (BlockVector2) o; - return remove(v.getBlockX(), v.getBlockZ()); - } - return false; - } - - @Override - public boolean containsAll(Collection c) { - return c.stream().allMatch(this::contains); - } - - @Override - public boolean addAll(Collection c) { - return c.stream().map(this::add).reduce(false, (a, b) -> a || b); - } - - @Override - public boolean retainAll(@NotNull Collection c) { - boolean result = false; - int size = size(); - int index = -1; - for (int i = 0; i < size; i++) { - index = set.nextSetBit(index + 1); - int x = MathMan.unpairSearchCoordsX(index); - int y = MathMan.unpairSearchCoordsY(index); - mutable.setComponents(x, y); - if (!c.contains(mutable)) { - result = true; - set.clear(index); - } - } - return result; - } - - @Override - public boolean removeAll(Collection c) { - return c.stream().map(this::remove).reduce(false, (a, b) -> a || b); - } - - @Override - public void clear() { - set.clear(); - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/ObjObjMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/ObjObjMap.java deleted file mode 100644 index cddb1b302..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/ObjObjMap.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import java.util.Arrays; -import javax.annotation.Nonnull; - -import static it.unimi.dsi.fastutil.HashCommon.arraySize; - -public class ObjObjMap { - - private static final Object FREE_KEY = new Object(); - private static final Object REMOVED_KEY = new Object(); - - /** - * Keys and values - */ - private Object[] m_data; - - /** - * Value for the null key (if inserted into a map) - */ - private Object m_nullValue; - private boolean m_hasNull; - - /** - * Fill factor, must be between (0 and 1) - */ - private final float m_fillFactor; - /** - * We will resize a map once it reaches this size - */ - private int m_threshold; - /** - * Current map size - */ - private int m_size; - /** - * Mask to calculate the original position - */ - private int m_mask; - /** - * Mask to wrap the actual array pointer - */ - private int m_mask2; - - public ObjObjMap(int size, float fillFactor) { - if (fillFactor <= 0 || fillFactor >= 1) { - throw new IllegalArgumentException("FillFactor must be in (0, 1)"); - } - if (size <= 0) { - throw new IllegalArgumentException("Size must be positive!"); - } - final int capacity = arraySize(size, fillFactor); - m_mask = capacity - 1; - m_mask2 = capacity * 2 - 1; - m_fillFactor = fillFactor; - - m_data = new Object[capacity * 2]; - Arrays.fill(m_data, FREE_KEY); - - m_threshold = (int) (capacity * fillFactor); - } - - public V get(@Nonnull K key) { -// if ( key == null ) -// return (V) m_nullValue; //we null it on remove, so safe not to check a flag here - - int ptr = (key.hashCode() & m_mask) << 1; - Object k = m_data[ptr]; - -// if ( k == FREE_KEY ) -// return null; //end of chain already - if (k == key) {//we check FREE and REMOVED prior to this call - return (V) m_data[ptr + 1]; - } - while (true) { - ptr = ptr + 2 & m_mask2; //that's next index - k = m_data[ptr]; -// if ( k == FREE_KEY ) -// return null; - if (k == key) { - return (V) m_data[ptr + 1]; - } - } - } - - public V put(K key, V value) { - if (key == null) { - return insertNullKey(value); - } - - int ptr = getStartIndex(key) << 1; - Object k = m_data[ptr]; - - if (k == FREE_KEY) {//end of chain already - m_data[ptr] = key; - m_data[ptr + 1] = value; - if (m_size >= m_threshold) { - rehash(m_data.length * 2); //size is set inside - } else { - ++m_size; - } - return null; - } else if (k == key) { //we check FREE and REMOVED prior to this call - final Object ret = m_data[ptr + 1]; - m_data[ptr + 1] = value; - return (V) ret; - } - - int firstRemoved = -1; - if (k == REMOVED_KEY) { - firstRemoved = ptr; //we may find a key later - } - - while (true) { - ptr = ptr + 2 & m_mask2; //that's next index calculation - k = m_data[ptr]; - if (k == FREE_KEY) { - if (firstRemoved != -1) { - ptr = firstRemoved; - } - m_data[ptr] = key; - m_data[ptr + 1] = value; - if (m_size >= m_threshold) { - rehash(m_data.length * 2); //size is set inside - } else { - ++m_size; - } - return null; - } else if (k == key) { - final Object ret = m_data[ptr + 1]; - m_data[ptr + 1] = value; - return (V) ret; - } else if (k == REMOVED_KEY) { - if (firstRemoved == -1) { - firstRemoved = ptr; - } - } - } - } - - public V remove(K key) { - if (key == null) { - return removeNullKey(); - } - - int ptr = getStartIndex(key) << 1; - Object k = m_data[ptr]; - if (k == FREE_KEY) { - return null; //end of chain already - } else if (k == key) { //we check FREE and REMOVED prior to this call - --m_size; - if (m_data[ptr + 2 & m_mask2] == FREE_KEY) { - m_data[ptr] = FREE_KEY; - } else { - m_data[ptr] = REMOVED_KEY; - } - final V ret = (V) m_data[ptr + 1]; - m_data[ptr + 1] = null; - return ret; - } - while (true) { - ptr = ptr + 2 & m_mask2; //that's next index calculation - k = m_data[ptr]; - if (k == FREE_KEY) { - return null; - } else if (k == key) { - --m_size; - if (m_data[ptr + 2 & m_mask2] == FREE_KEY) { - m_data[ptr] = FREE_KEY; - } else { - m_data[ptr] = REMOVED_KEY; - } - final V ret = (V) m_data[ptr + 1]; - m_data[ptr + 1] = null; - return ret; - } - } - } - - private V insertNullKey(V value) { - if (m_hasNull) { - final Object ret = m_nullValue; - m_nullValue = value; - return (V) ret; - } else { - m_nullValue = value; - ++m_size; - return null; - } - } - - private V removeNullKey() { - if (m_hasNull) { - final Object ret = m_nullValue; - m_nullValue = null; - m_hasNull = false; - --m_size; - return (V) ret; - } else { - return null; - } - } - - public int size() { - return m_size; - } - - private void rehash(int newCapacity) { - m_threshold = (int) (newCapacity / 2 * m_fillFactor); - m_mask = newCapacity / 2 - 1; - m_mask2 = newCapacity - 1; - - final int oldCapacity = m_data.length; - final Object[] oldData = m_data; - - m_data = new Object[newCapacity]; - Arrays.fill(m_data, FREE_KEY); - - m_size = m_hasNull ? 1 : 0; - - for (int i = 0; i < oldCapacity; i += 2) { - final Object oldKey = oldData[i]; - if (oldKey != FREE_KEY && oldKey != REMOVED_KEY) { - put((K) oldKey, (V) oldData[i + 1]); - } - } - } - - public int getStartIndex(Object key) { - //key is not null here - return key.hashCode() & m_mask; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SoftHashMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SoftHashMap.java deleted file mode 100644 index 2e2c0a0c5..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SoftHashMap.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -import org.jetbrains.annotations.NotNull; - -import java.lang.ref.ReferenceQueue; -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.locks.ReentrantLock; - - -/** - * A SoftHashMap is a memory-constrained map that stores its values in - * {@link SoftReference SoftReference}s. (Contrast this with the JDK's - * {@link WeakHashMap WeakHashMap}, which uses weak references for its keys, which is of little value if you - * want the cache to auto-resize itself based on memory constraints). - *

- * Having the values wrapped by soft references allows the cache to automatically reduce its size based on memory - * limitations and garbage collection. This ensures that the cache will not cause memory leaks by holding strong - * references to all of its values. - *

- * This class is a generics-enabled Map based on initial ideas from Heinz Kabutz's and Sydney Redelinghuys's - * publicly posted version (with their approval), with - * continued modifications. It was copied from the Apache Shiro framework. - *

- * This implementation is thread-safe and usable in concurrent environments. - * - * @see SoftReference - * @see Apache Shiro - * @since 0.8 - */ -public class SoftHashMap implements Map { - - /** - * The default value of the RETENTION_SIZE attribute, equal to 100. - */ - private static final int DEFAULT_RETENTION_SIZE = 100; - - /** - * The internal HashMap that will hold the SoftReference. - */ - private final Map> map; - - /** - * The number of strong references to hold internally, that is, the number of instances to prevent - * from being garbage collected automatically (unlike other soft references). - */ - private final int RETENTION_SIZE; - - /** - * The FIFO list of strong references (not to be garbage collected), order of last access. - */ - private final Queue strongReferences; //guarded by 'strongReferencesLock' - private final ReentrantLock strongReferencesLock; - - /** - * Reference queue for cleared SoftReference objects. - */ - private final ReferenceQueue queue; - - /** - * Creates a new SoftHashMap with a default retention size size of - * {@link #DEFAULT_RETENTION_SIZE DEFAULT_RETENTION_SIZE} (100 entries). - * - * @see #SoftHashMap(int) - */ - public SoftHashMap() { - this(DEFAULT_RETENTION_SIZE); - } - - /** - * Creates a new SoftHashMap with the specified retention size. - *

- * The retention size (n) is the total number of most recent entries in the map that will be strongly referenced - * (ie 'retained') to prevent them from being eagerly garbage collected. That is, the point of a SoftHashMap is to - * allow the garbage collector to remove as many entries from this map as it desires, but there will always be (n) - * elements retained after a GC due to the strong references. - *

- * Note that in a highly concurrent environments the exact total number of strong references may differ slightly - * than the actual {@code retentionSize} value. This number is intended to be a best-effort retention low - * water mark. - * - * @param retentionSize the total number of most recent entries in the map that will be strongly referenced - * (retained), preventing them from being eagerly garbage collected by the JVM. - */ - public SoftHashMap(int retentionSize) { - super(); - RETENTION_SIZE = Math.max(0, retentionSize); - queue = new ReferenceQueue<>(); - strongReferencesLock = new ReentrantLock(); - map = new ConcurrentHashMap<>(); - strongReferences = new ConcurrentLinkedQueue<>(); - } - - /** - * Creates a {@code SoftHashMap} backed by the specified {@code source}, with a default retention - * size of {@link #DEFAULT_RETENTION_SIZE DEFAULT_RETENTION_SIZE} (100 entries). - * - * @param source the backing map to populate this {@code SoftHashMap} - * @see #SoftHashMap(Map, int) - */ - public SoftHashMap(Map source) { - this(DEFAULT_RETENTION_SIZE); - putAll(source); - } - - /** - * Creates a {@code SoftHashMap} backed by the specified {@code source}, with the specified retention size. - *

- * The retention size (n) is the total number of most recent entries in the map that will be strongly referenced - * (ie 'retained') to prevent them from being eagerly garbage collected. That is, the point of a SoftHashMap is to - * allow the garbage collector to remove as many entries from this map as it desires, but there will always be (n) - * elements retained after a GC due to the strong references. - *

- * Note that in a highly concurrent environments the exact total number of strong references may differ slightly - * than the actual {@code retentionSize} value. This number is intended to be a best-effort retention low - * water mark. - * - * @param source the backing map to populate this {@code SoftHashMap} - * @param retentionSize the total number of most recent entries in the map that will be strongly referenced - * (retained), preventing them from being eagerly garbage collected by the JVM. - */ - public SoftHashMap(Map source, int retentionSize) { - this(retentionSize); - putAll(source); - } - - @Override - public V get(Object key) { - processQueue(); - - V result = null; - SoftValue value = map.get(key); - - if (value != null) { - //unwrap the 'real' value from the SoftReference - result = value.get(); - if (result == null) { - //The wrapped value was garbage collected, so remove this entry from the backing map: - //noinspection SuspiciousMethodCalls - map.remove(key); - } else { - //Add this value to the beginning of the strong reference queue (FIFO). - addToStrongReferences(result); - } - } - return result; - } - - private void addToStrongReferences(V result) { - strongReferencesLock.lock(); - try { - strongReferences.add(result); - trimStrongReferencesIfNecessary(); - } finally { - strongReferencesLock.unlock(); - } - - } - - //Guarded by the strongReferencesLock in the addToStrongReferences method - - private void trimStrongReferencesIfNecessary() { - //trim the strong ref queue if necessary: - while (strongReferences.size() > RETENTION_SIZE) { - strongReferences.poll(); - } - } - - /** - * Traverses the ReferenceQueue and removes garbage-collected SoftValue objects from the backing map - * by looking them up using the SoftValue.key data member. - */ - private void processQueue() { - SoftValue sv; - while ((sv = (SoftValue) queue.poll()) != null) { - //noinspection SuspiciousMethodCalls - map.remove(sv.key); // we can access private data! - } - } - - @Override - public boolean isEmpty() { - processQueue(); - return map.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - processQueue(); - return map.containsKey(key); - } - - @Override - public boolean containsValue(Object value) { - processQueue(); - Collection values = values(); - return values.contains(value); - } - - @Override - public void putAll(@NotNull Map m) { - if (m.isEmpty()) { - processQueue(); - return; - } - for (Map.Entry entry : m.entrySet()) { - put(entry.getKey(), entry.getValue()); - } - } - - @Override - @NotNull - public Set keySet() { - processQueue(); - return map.keySet(); - } - - @Override - @NotNull - public Collection values() { - processQueue(); - Collection keys = map.keySet(); - if (keys.isEmpty()) { - //noinspection unchecked - return Collections.emptySet(); - } - Collection values = new ArrayList<>(keys.size()); - for (K key : keys) { - V v = get(key); - if (v != null) { - values.add(v); - } - } - return values; - } - - /** - * Creates a new entry, but wraps the value in a SoftValue instance to enable auto garbage collection. - */ - @Override - public V put(K key, V value) { - processQueue(); // throw out garbage collected values first - SoftValue sv = new SoftValue<>(value, key, queue); - SoftValue previous = map.put(key, sv); - addToStrongReferences(value); - return previous != null ? previous.get() : null; - } - - @Override - public V remove(Object key) { - processQueue(); // throw out garbage collected values first - SoftValue raw = map.remove(key); - return raw != null ? raw.get() : null; - } - - @Override - public void clear() { - strongReferencesLock.lock(); - try { - strongReferences.clear(); - } finally { - strongReferencesLock.unlock(); - } - processQueue(); // throw out garbage collected values - map.clear(); - } - - @Override - public int size() { - processQueue(); // throw out garbage collected values first - return map.size(); - } - - @Override - @NotNull - public Set> entrySet() { - processQueue(); // throw out garbage collected values first - Collection keys = map.keySet(); - if (keys.isEmpty()) { - //noinspection unchecked - return Collections.emptySet(); - } - - Map kvPairs = new HashMap<>(keys.size()); - for (K key : keys) { - V v = get(key); - if (v != null) { - kvPairs.put(key, v); - } - } - return kvPairs.entrySet(); - } - - /** - * We define our own subclass of SoftReference which contains - * not only the value but also the key to make it easier to find - * the entry in the HashMap after it's been garbage collected. - */ - private static class SoftValue extends SoftReference { - - private final K key; - - /** - * Constructs a new instance, wrapping the value, key, and queue, as - * required by the superclass. - * - * @param value the map value - * @param key the map key - * @param queue the soft reference queue to poll to determine if the entry had been reaped by the GC. - */ - private SoftValue(V value, K key, ReferenceQueue queue) { - super(value, queue); - this.key = key; - } - - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBitSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBitSet.java deleted file mode 100644 index 43d43ba8f..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBitSet.java +++ /dev/null @@ -1,3097 +0,0 @@ -package com.fastasyncworldedit.core.object.collection; - -/*- This software is the work of Paladin Software International, Incorporated, - * based upon previous work done for and by Sun Microsystems, Inc. */ - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -/** - * This class implements a set of bits that grows as needed. Each bit of the - * bit set represents a boolean value. The values of a - * SparseBitSet are indexed by non-negative integers. - * Individual indexed values may be examined, set, cleared, or modified by - * logical operations. One SparseBitSet or logical value may be - * used to modify the contents of (another) SparseBitSet through - * logical AND, logical inclusive OR, logical exclusive - * OR, and And NOT operations over all or part of the bit sets. - *

- * All values in a bit set initially have the value false. - *

- * Every bit set has a current size, which is the number of bits of space - * nominally in use by the bit set from the first set bit to just after - * the last set bit. The length of the bit set effectively tells the position - * available after the last bit of the SparseBitSet. - *

- * The maximum cardinality of a SparseBitSet is - * Integer.MAX_VALUE, which means the bits of a - * SparseBitSet are labelled - * 0 .. Integer.MAX_VALUE − 1. - * After the last set bit of a SparseBitSet, any attempt to find - * a subsequent bit (nextSetBit()), will return an value of −1. - * If an attempt is made to use nextClearBit(), and all the bits are - * set from the starting position of the search to the bit labelled - * Integer.MAX_VALUE − 1, then similarly −1 - * will be returned. - *

- * Unless otherwise noted, passing a null parameter to any of the methods in - * a SparseBitSet will result in a - * NullPointerException. - *

- * A SparseBitSet is not safe for multi-threaded use without - * external synchronization. - * - * @author Bruce K. Haddon - * @author Arthur van Hoff - * @author Michael McCloskey - * @author Martin Buchholz - * @version 1.0, 2009-03-17 - * @since 1.6 - */ -@SuppressWarnings("ALL") -public class SparseBitSet implements Cloneable, Serializable -{ - /* My apologies for listing all the additional authors, but concepts, code, - and even comments have been re-used in this class definition from code in - the JDK that was written and/or maintained by these people. I owe a debt, - which I acknowledge. But they are in no way responsible for what ever - misuse I have made of their work. - Bruce K. Haddon - - The representation of a SparseBitSet is packed into "words", and the words - are stored in arrays which are here referred to as "blocks." Blocks are - accessed by two levels of indirection from the master "level 1" (whole) - set array through second level arrays called "areas" (making the blocks - "level3"). A "word" is a long, consisting of 64 bits, requiring six address - bits to select a bit within a word (and this is considered in places to be - a "level4"). This choice of a long for "word" is determined purely by - performance concerns, and is built into the implementation in a deep way, - because the references to blocks are always of the form "long[]." (This - does not mean that blocks could not be changed to arrays of ints, but it - would take some extensive work.) - - The fact that there are three levels is also deeply involved in the - scanning algorithms, meaning that the accesses are always nested three - deep. Again, the change this might be a large amount of work. On the - other hand, these three levels have proven, so far, to provide adequate - speed, and an storage efficient way to deal with sparseness. - - For simplicity, the level3 blocks and the level2 areas are always "full" - size, i.e., LENGTH3 and LENGTH2 respectively, and for consistency, the - fourth level is of length LENGTH4. The level1 structure is of variable - length (as this may save scanning several thousand null pointers, and - careful consideration must be taken of this at all times, in particular, - when choosing to increase the size (see resize()). The only place where - this array is reduced in size is when a clone is made, in which case it is - created with the smallest size, and allowed to grow as entries are copied - to it. That all the arrays are kept to power-of-2 sizes is a programming - convenience (permitting shifts and masks). - - Whenever possible, a level 3 block that contains no bits (all the words are - zero, is discarded, and its reference is replaced by a null value. - Similarly, level 2 areas that contain only null pointers (to level 3 - blocks) are discarded, and their references replaced by null values. This - is the "normalized" condition, but does not have to be nor is strictly - enforced. The operations still work if the representation is partially or - totally "denormalized." In particular, the methods that deal with single - bits (setting, flipping, clearing, etc.) do not attempt to normalize the - set, in the interests of speed. However, when a set is scanned as the - resultant set of some operation, then, in most cases, the set will be - normalized--the exception being level2 areas that are not completely scanned - in a particular pass. - - The sizes of the blocks and areas has been the result of some investigation - with varying sizes, and the sizes selected appear to represent a reasonable - "sweet" spot. There is, of course, no guarantee that these are the best - for all possible situations, but, given that not having these the same - for all bit sets would be hopelessly complex (bad enough as is), these - values appear to be a fair compromise. */ - - /** - * This value controls for format of the toString() output. - * @see #toStringCompaction(int) - */ - protected transient int compactionCount; - - /** - * The compaction count default. - */ - static int compactionCountDefault = 2; // Note: this is not final! - - /** - * The storage for this SparseBitSet. The ith bit is stored in a word - * represented by a long value, and is at bit position i % 64 - * within that word (where bit position 0 refers to the least significant bit - * and 63 refers to the most significant bit). - *

- * The words are organized into blocks, and the blocks are accessed by two - * additional levels of array indexing. - */ - protected transient long[][][] bits; - - /** - * For the current size of the bits array, this is the maximum possible - * length of the bit set, i.e., the index of the last possible bit, plus one. - * Note: this not the value returned by length(). - * @see #resize(int) - * @see #length() - */ - protected transient int bitsLength; - - //============================================================================== - // The critical parameters. These are set up so that the compiler may - // pre-compute all the values as compile-time constants. - //============================================================================== - - /** - * The number of bits in a long value. - */ - protected static final int LENGTH4 = Long.SIZE; - - /** - * The number of bits in a positive integer, and the size of permitted index - * of a bit in the bit set. - */ - protected static final int INDEX_SIZE = Integer.SIZE - 1; - - /** - * The label (index) of a bit in the bit set is essentially broken into - * 4 "levels". Respectively (from the least significant end), level4, the - * address within word, the address within a level3 block, the address within - * a level2 area, and the level1 address of that area within the set. - * - * LEVEL4 is the number of bits of the level4 address (number of bits need - * to address the bits in a long) - */ - protected static final int LEVEL4 = 6; - - /** - * LEVEL3 is the number of bits of the level3 address. - */ - protected static final int LEVEL3 = 5; // Do not change! - /** - * LEVEL2 is the number of bits of the level2 address. - */ - protected static final int LEVEL2 = 5; // Do not change! - /** - * LEVEL1 is the number of bits of the level1 address. - */ - protected static final int LEVEL1 = INDEX_SIZE - LEVEL2 - LEVEL3 - LEVEL4; - - /** - * MAX_LENGTH1 is the maximum number of entries in the level1 set array. - */ - protected static final int MAX_LENGTH1 = 1 << LEVEL1; - - /** - * LENGTH2 is the number of entries in the any level2 area. - */ - protected static final int LENGTH2 = 1 << LEVEL2; - - /** - * LENGTH3 is the number of entries in the any level3 block. - */ - protected static final int LENGTH3 = 1 << LEVEL3; - - /** - * The shift to create the word index. (I.e., move it to the right end) - */ - protected static final int SHIFT3 = LEVEL4; - - /** - * MASK3 is the mask to extract the LEVEL3 address from a word index - * (after shifting by SHIFT3). - */ - protected static final int MASK3 = LENGTH3 - 1; - - /** - * SHIFT2 is the shift to bring the level2 address (from the word index) to - * the right end (i.e., after shifting by SHIFT3). - */ - protected static final int SHIFT2 = LEVEL3; - - /** - * UNIT is the greatest number of bits that can be held in one level1 entry. - * That is, bits per word by words per level3 block by blocks per level2 area. - */ - protected static final int UNIT = LENGTH2 * LENGTH3 * LENGTH4; - - /** - * MASK2 is the mask to extract the LEVEL2 address from a word index - * (after shifting by SHIFT3 and SHIFT2). - */ - protected static final int MASK2 = LENGTH2 - 1; - - /** - * SHIFT1 is the shift to bring the level1 address (from the word index) to - * the right end (i.e., after shifting by SHIFT3). - */ - protected static final int SHIFT1 = LEVEL2 + LEVEL3; - - /** - * LENGTH2_SIZE is maximum index of a LEVEL2 page. - */ - protected static final int LENGTH2_SIZE = LENGTH2 - 1; - - /** - * LENGTH3_SIZE is maximum index of a LEVEL3 page. - */ - protected static final int LENGTH3_SIZE = LENGTH3 - 1; - - /** - * LENGTH4_SIZE is maximum index of a bit in a LEVEL4 word. - */ - protected static final int LENGTH4_SIZE = LENGTH4 - 1; - - /** - * Holds reference to the cache of statistics values computed by the - * UpdateStrategy - * @see SparseBitSet.Cache - * @see SparseBitSet.UpdateStrategy - */ - protected transient Cache cache; - - //============================================================================= - // Stack structures used for recycling blocks - //============================================================================= - - /** - * A spare level 3 block is kept for use when scanning. When a target block - * is needed, and there is not already one in the bit set, the spare is - * provided. If non-zero values are placed into this block, it is moved to the - * resulting set, and a new spare is acquired. Note: a new spare needs to - * be allocated when the set is cloned (so that the spare is not shared - * between two sets). - */ - protected transient long[] spare; - - /** An empty level 3 block is kept for use when scanning. When a source block - * is needed, and there is not already one in the corresponding bit set, the - * ZERO_BLOCK is used (as a read-only block). It is a source of zero values - * so that code does not have to test for a null level3 block. This is a - * static block shared everywhere. - */ - static final long[] ZERO_BLOCK = new long[LENGTH3]; - - /* Programming notes: - - i, j, and k are used to hold values that are actual bit indices (i.e., - the index (label) of the bit within the user's view of the bit set). - - u, v, and w, are used to hold values that refer to the indices of the - words in the set array that are used to hold the bits (with 64 bits per - word). These variable names, followed by 1, 2, or 3, refer to the component - "level" parts of the complete word index. - - word (where used) is a potential entry to or from a block, containing 64 - bits of the bit set. The prefixes a, b, result, etc., refer to the bit - sets from which these are coming or going. Without a prefix, or with the - prefix "a," the set in question is "this" set (see next paragraph). - - Operations are conceived to be in the form a.op(b), thus in the discussion - (not in the public Javadoc documentation) the two sets are referred to a - "a" and "b", where the set referred to by "this" is usually set a. - Hence, reference to set a is usually implicit, but set b will usually be - explicit. Variables beginning with these letters hold values relevant to - the corresponding set, and, in particular, these letters followed by - 1, 2, and 3 are used to refer to the corresponding (current) level1, - level3 area, and level3 block, arrays. - - The resizing of the table takes place as necessary. In this regard, it is - worth noting that the table is grown, but never shrunk (except in a new - object formed by cloning). - - Similarly, care it taken to ensure that any supplied reference to a bit - set (other than this) has an opportunity to fail for being null before - any other set (including this) has its state changed. For the most - part, this is allowed to happen "naturally," but the Strategies incorporate - an explicit check when necessary. - - There is a amount of (almost) repetitive scanning code in many of the - "singe bit" methods. The intent is that these methods for SparseBitSet be - as small and as fast as possible. - - For the scanning of complete sets, or for ranges within complete sets, - all of the scanning logic is built into one (somewhat enormous) method, - setScanner(). This contains all the considerations for matching up - corresponding level 3 blocks (if they exist), and then uses a Strategy - object to do the processing on those level3 blocks. This keeps all - the scanning and optimization logic in one place, and the Strategies are - reasonably simple (see the definition of AbstractStrategy for a discussion - of the tasks that must be defined therein). - - The test for index i (the first index in all cases) being in range is - rather perverse, but the idea was to keep the actual number of comparisons - to a minimum, hence the check is for "(i + 1) < 1". This is almost but not - quite equivalent to "i < 0", although it is for all values of i except - i=Integer.MAX_VALUE. In this latter case, (i + 1) "overflows" to - -(Integer.MAX_VALUE + 1), and thus appears to be less than 1, and thus the - check picks up the other disallowed case. Let us hope the compiler never - gets smart enough to try to do the apparent optimisation! */ - - /** - * Constructor for a new (sparse) bit set. All bits initially are effectively - * false. This is a internal constructor that collects all the - * needed actions to initialise the bit set. - *

- * The capacity is taken to be a suggestion for a size of the bit set, - * in bits. An appropriate table size (a power of two) is then determined and - * used. The size will be grown as needed to accommodate any bits addressed - * during the use of the bit set. - * - * @param capacity a size in terms of bits - * @param compactionCount the compactionCount to be inherited (for - * internal generation) - * @exception NegativeArraySizeException if the specified initial size - * is negative - * @since 1.6 - */ - protected SparseBitSet(int capacity, int compactionCount) - throws NegativeArraySizeException - { - /* Array size is computed based on this being a capacity given in bits. */ - if (capacity < 0) // capacity can't be negative -- could only come from - throw new NegativeArraySizeException( // an erroneous user given - "(requested capacity=" + capacity + ") < 0"); // nbits value - resize(capacity - 1); // Resize takes last usable index - this.compactionCount = compactionCount; - /* Ensure there is a spare level 3 block for the use of the set scanner.*/ - constructorHelper(); - statisticsUpdate(); - } - - /** - * Constructs an empty bit set with the default initial size. - * Initially all bits are effectively false. - * - * @since 1.6 - */ - public SparseBitSet() - { - /* By requesting 1 bit, will actually get UNIT number of bits. */ - this(1, compactionCountDefault); - } - - /** - * Creates a bit set whose initial size is large enough to efficiently - * represent bits with indices in the range 0 through - * at least nbits-1. Initially all bits are effectively - * false. - *

- * No guarantees are given for how large or small the actual object will be. - * The setting of bits above the given range is permitted (and will perhaps - * eventually cause resizing). - * - * @param nbits the initial provisional length of the SparseBitSet - * @throws java.lang.NegativeArraySizeException if the specified initial - * length is negative - * @see #SparseBitSet() - * @since 1.6 - */ - public SparseBitSet(int nbits) throws NegativeArraySizeException - { - this(nbits, compactionCountDefault); - } - - /** - * Performs a logical AND of the addressed target bit with the argument - * value. This bit set is modified so that the addressed bit has the value - * true if and only if it both initially had the value - * true and the argument value is also true. - * - * @param i a bit index - * @param value a boolean value to AND with that bit - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void and(int i, boolean value) throws IndexOutOfBoundsException - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - if (!value) - clear(i); - } - - /** - * Performs a logical AND of this target bit set with the argument bit - * set within the given range of bits. Within the range, this bit set is - * modified so that each bit in it has the value true if and only - * if it both initially had the value true and the corresponding - * bit in the bit set argument also had the value true. Outside - * the range, this set is not changed. - * - * @param i index of the first bit to be included in the operation - * @param j index after the last bit to included in the operation - * @param b a SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public void and(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException - { - setScanner(i, j, b, andStrategy); - } - - /** - * Performs a logical AND of this target bit set with the argument bit - * set. This bit set is modified so that each bit in it has the value - * true if and only if it both initially had the value - * true and the corresponding bit in the bit set argument also - * had the value true. - * - * @param b a SparseBitSet - * @since 1.6 - */ - public void and(SparseBitSet b) - { - nullify(Math.min(bits.length, b.bits.length)); // Optimisation - setScanner(0, Math.min(bitsLength, b.bitsLength), b, andStrategy); - } - - /** - * Performs a logical AND of the two given SparseBitSets. - * The returned SparseBitSet is created so that each bit in it - * has the value true if and only if both the given sets - * initially had the corresponding bits true, otherwise - * false. - * - * @param a a SparseBitSet - * @param b another SparseBitSet - * @return a new SparseBitSet representing the AND of the two sets - * @since 1.6 - */ - public static SparseBitSet and(SparseBitSet a, SparseBitSet b) - { - final SparseBitSet result = a.clone(); - result.and(b); - return result; - } - - /** - * Performs a logical AndNOT of the addressed target bit with the - * argument value. This bit set is modified so that the addressed bit has the - * value true if and only if it both initially had the value - * true and the argument value is false. - * - * @param i a bit index - * @param value a boolean value to AndNOT with that bit - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void andNot(int i, boolean value) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - if (value) - clear(i); - } - - /** - * Performs a logical AndNOT of this target bit set with the argument - * bit set within the given range of bits. Within the range, this bit set is - * modified so that each bit in it has the value true if and only - * if it both initially had the value true and the corresponding - * bit in the bit set argument has the value false. Outside - * the range, this set is not changed. - * - * @param i index of the first bit to be included in the operation - * @param j index after the last bit to included in the operation - * @param b the SparseBitSet with which to mask this SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public void andNot(int i, int j, SparseBitSet b) - throws IndexOutOfBoundsException - { - setScanner(i, j, b, andNotStrategy); - } - - /** - * Performs a logical AndNOT of this target bit set with the argument - * bit set. This bit set is modified so that each bit in it has the value - * true if and only if it both initially had the value - * true and the corresponding bit in the bit set argument has - * the value false. - * - * @param b the SparseBitSet with which to mask this SparseBitSet - * @since 1.6 - */ - public void andNot(SparseBitSet b) - { - setScanner(0, Math.min(bitsLength, b.bitsLength), b, andNotStrategy); - } - - /** - * Creates a bit set from the first SparseBitSet whose - * corresponding bits are cleared by the set bits of the second - * SparseBitSet. The resulting bit set is created so that a bit - * in it has the value true if and only if the corresponding bit - * in the SparseBitSet of the first is set, and that same - * corresponding bit is not set in the SparseBitSet of the second - * argument. - * - * @param a a SparseBitSet - * @param b another SparseBitSet - * @return a new SparseBitSet representing the AndNOT of the - * two sets - * @since 1.6 - */ - public static SparseBitSet andNot(SparseBitSet a, SparseBitSet b) - { - final SparseBitSet result = a.clone(); - result.andNot(b); - return result; - } - - /** - * Returns the number of bits set to true in this - * SparseBitSet. - * - * @return the number of bits set to true in this SparseBitSet - * @since 1.6 - */ - public int cardinality() - { - statisticsUpdate(); // Update size, cardinality and length values - return cache.cardinality; - } - - /** - * Sets the bit at the specified index to false. - * - * @param i a bit index. - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE. - * @since 1.6 - */ - public void clear(int i) - { - /* In the interests of speed, no check is made here on whether the - level3 block goes to all zero. This may be found and corrected - in some later operation. */ - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - if (i >= bitsLength) - return; - final int w = i >> SHIFT3; - long[][] a2; - if ((a2 = bits[w >> SHIFT1]) == null) - return; - long[] a3; - if ((a3 = a2[(w >> SHIFT2) & MASK2]) == null) - return; - a3[w & MASK3] &= ~(1L << i); // Clear the indicated bit - cache.hash = 0; // Invalidate size, etc., - } - - /** - * Sets the bits from the specified i (inclusive) to the - * specified j (exclusive) to false. - * - * @param i index of the first bit to be cleared - * @param j index after the last bit to be cleared - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public void clear(int i, int j) throws IndexOutOfBoundsException - { - setScanner(i, j, null, clearStrategy); - } - - /** - * Sets all of the bits in this SparseBitSet to - * false. - * - * @since 1.6 - */ - public void clear() - { - /* This simply resets to null all the entries in the set. */ - nullify(0); - } - - /** - * Cloning this SparseBitSet produces a new - * SparseBitSet that is equal() to it. The clone of the - * bit set is another bit set that has exactly the same bits set to - * true as this bit set. - *

- * Note: the actual space allocated to the clone tries to minimise the actual - * amount of storage allocated to hold the bits, while still trying to - * keep access to the bits being a rapid as possible. Since the space - * allocated to a SparseBitSet is not normally decreased, - * replacing a bit set by its clone may be a way of both managing memory - * consumption and improving the rapidity of access. - * - * @return a clone of this SparseBitSet - * @since 1.6 - */ - @Override - public SparseBitSet clone() - { - try - { - final SparseBitSet result = (SparseBitSet) super.clone(); - /* Clear out the shallow copy of the set array (which contains just - copies of the references from this set), and then replace these - by a deep copy (created by a "copy" from the set being cloned . */ - result.bits = null; - result.resize(1); - /* Ensure the clone is not sharing a copy of a spare block with - the cloned set, nor the cache set, nor any of the visitors (which - are linked to their parent object) (Not all visitors actually use - this link to their containing object, but they are reset here just - in case of future changes). */ - result.constructorHelper(); - result.equalsStrategy = null; - result.setScanner(0, bitsLength, this, copyStrategy); - return result; - } - catch (CloneNotSupportedException ex) - { - /* This code has not been unit tested. Inspection offers hope - that is will work, but it likely never to be used. */ - throw new InternalError(ex.getMessage()); - } - } - - /** - * Compares this object against the specified object. The result is - * true if and only if the argument is not null - * and is a SparseBitSet object that has exactly the same bits - * set to true as this bit set. That is, for every nonnegative - * i indexing a bit in the set, - *

((SparseBitSet)obj).get(i) == this.get(i)
- * must be true. - * - * @param obj the Object with which to compare - * @return true if the objects are equivalent; - * false otherwise. - * @since 1.6 - */ - @Override - public boolean equals(Object obj) - { - /* Sanity and quick checks. */ - if (!(obj instanceof SparseBitSet)) - return false; - final SparseBitSet b = (SparseBitSet) obj; - if (this == b) - return true; // Identity - - /* Do the real work. */ - if (equalsStrategy == null) - equalsStrategy = new EqualsStrategy(); - - setScanner(0, Math.max(bitsLength, b.bitsLength), b, equalsStrategy); - return equalsStrategy.result; - } - - /** - * Sets the bit at the specified index to the complement of its current value. - * - * @param i the index of the bit to flip - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void flip(int i) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - final int w = i >> SHIFT3; - final int w1 = w >> SHIFT1; - final int w2 = (w >> SHIFT2) & MASK2; - - if (i >= bitsLength) - resize(i); - long[][] a2; - if ((a2 = bits[w1]) == null) - a2 = bits[w1] = new long[LENGTH2][]; - long[] a3; - if ((a3 = a2[w2]) == null) - a3 = a2[w2] = new long[LENGTH3]; - a3[w & MASK3] ^= 1L << i; //Flip the designated bit - cache.hash = 0; // Invalidate size, etc., values - } - - /** - * Sets each bit from the specified i (inclusive) to the - * specified j (exclusive) to the complement of its current - * value. - * - * @param i index of the first bit to flip - * @param j index after the last bit to flip - * @exception IndexOutOfBoundsException if i is negative or is - * equal to Integer.MAX_VALUE, or j is negative, or - * i is larger than j - * @since 1.6 - */ - public void flip(int i, int j) throws IndexOutOfBoundsException - { - setScanner(i, j, null, flipStrategy); - } - - /** - * Returns the value of the bit with the specified index. The value is - * true if the bit with the index i is currently set - * in this SparseBitSet; otherwise, the result is - * false. - * - * @param i the bit index - * @return the boolean value of the bit with the specified index. - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public boolean get(int i) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - final int w = i >> SHIFT3; - - long[][] a2; - long[] a3; - return i < bitsLength && (a2 = bits[w >> SHIFT1]) != null - && (a3 = a2[(w >> SHIFT2) & MASK2]) != null - && ((a3[w & MASK3] & (1L << i)) != 0); - } - - /** - * Returns a new SparseBitSet composed of bits from this - * SparseBitSet from i (inclusive) to j - * (exclusive). - * - * @param i index of the first bit to include - * @param j index after the last bit to include - * @return a new SparseBitSet from a range of this SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or is - * equal to Integer.MAX_VALUE, or j is negative, or - * i is larger than j - * @since 1.6 - */ - public SparseBitSet get(int i, int j) throws IndexOutOfBoundsException - { - final SparseBitSet result = new SparseBitSet(j, compactionCount); - result.setScanner(i, j, this, copyStrategy); - return result; - } - - /** - * Returns a hash code value for this bit set. The hash code depends only on - * which bits have been set within this SparseBitSet. The - * algorithm used to compute it may be described as follows. - *

- * Suppose the bits in the SparseBitSet were to be stored in an - * array of long integers called, say, bits, in such - * a manner that bit i is set in the SparseBitSet - * (for nonnegative values of i) if and only if the expression - *

-     *  ((i>>6) < bits.length) && ((bits[i>>6] & (1L << (bit & 0x3F))) != 0)
-     *  
- * is true. Then the following definition of the hashCode method - * would be a correct implementation of the actual algorithm: - *
-     *  public int hashCode()
-     *  {
-     *      long hash = 1234L;
-     *      for ( int i = bits.length; --i >= 0; )
-     *          hash ^= bits[i] * (i + 1);
-     *      return (int)((h >> 32) ^ h);
-     *  }
- * Note that the hash code values change if the set of bits is altered. - * - * @return a hash code value for this bit set - * @since 1.6 - * @see Object#equals(Object) - * @see java.util.Hashtable - */ - @Override - public int hashCode() - { - statisticsUpdate(); - return cache.hash; - } - - /** - * Returns true if the specified SparseBitSet has any bits - * within the given range i (inclusive) to j - * (exclusive) set to true that are also set to true - * in the same range of this SparseBitSet. - * - * @param i index of the first bit to include - * @param j index after the last bit to include - * @param b the SparseBitSet with which to intersect - * @return the boolean indicating whether this SparseBitSet intersects the - * specified SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public boolean intersects(int i, int j, SparseBitSet b) - throws IndexOutOfBoundsException - { - setScanner(i, j, b, intersectsStrategy); - return intersectsStrategy.result; - } - - /** - * Returns true if the specified SparseBitSet has any bits set to - * true that are also set to true in this - * SparseBitSet. - * - * @param b a SparseBitSet with which to intersect - * @return boolean indicating whether this SparseBitSet intersects the - * specified SparseBitSet - * @since 1.6 - */ - public boolean intersects(SparseBitSet b) - { - setScanner(0, Math.max(bitsLength, b.bitsLength), b, intersectsStrategy); - return intersectsStrategy.result; - } - - /** - * Returns true if this SparseBitSet contains no bits that are - * set to true. - * - * @return the boolean indicating whether this SparseBitSet is empty - * @since 1.6 - */ - public boolean isEmpty() - { - statisticsUpdate(); - return cache.cardinality == 0; - } - - /** - * Returns the "logical length" of this SparseBitSet: the index - * of the highest set bit in the SparseBitSet plus one. Returns - * zero if the SparseBitSet contains no set bits. - * - * @return the logical length of this SparseBitSet - * @since 1.6 - */ - public int length() - { - statisticsUpdate(); - return cache.length; - } - - /** - * Returns the index of the first bit that is set to false that - * occurs on or after the specified starting index. - * - * @param i the index to start checking from (inclusive) - * @return the index of the next clear bit, or -1 if there is no such bit - * @exception IndexOutOfBoundsException if the specified index is negative - * @since 1.6 - */ - public int nextClearBit(int i) - { - /* The index of this method is permitted to be Integer.MAX_VALUE, as this - is needed to make this method work together with the method - nextSetBit()--as might happen if a search for the next clear bit is - started after finding a set bit labelled Integer.MAX_VALUE-1. This - case is not optimised, the code will eventually return -1 (since - the Integer.MAX_VALUEth bit does "exist," and is 0. */ - - if (i < 0) - throw new IndexOutOfBoundsException("i=" + i); - /* This is the word from which the search begins. */ - int w = i >> SHIFT3; - int w3 = w & MASK3; - int w2 = (w >> SHIFT2) & MASK2; - int w1 = w >> SHIFT1; - - long nword = ~0L << i; - final int aLength = bits.length; - - long[][] a2; - long[] a3; - /* Is the next clear bit in the same word at the nominated beginning bit - (including the nominated beginning bit itself). The first check is - whether the starting bit is within the structure at all. */ - if (w1 < aLength && (a2 = bits[w1]) != null - && (a3 = a2[w2]) != null - && ((nword = ~a3[w3] & (~0L << i))) == 0L) - { - /* So now start a search though the rest of the entries for - a null area or block, or a clear bit (a set bit in the - complemented value). */ - ++w; - w3 = w & MASK3; - w2 = (w >> SHIFT2) & MASK2; - w1 = w >> SHIFT1; - nword = ~0L; - loop: for (; w1 != aLength; ++w1) - { - if ((a2 = bits[w1]) == null) - break; - for (; w2 != LENGTH2; ++w2) - { - if ((a3 = a2[w2]) == null) - break loop; - for (; w3 != LENGTH3; ++w3) - if ((nword = ~a3[w3]) != 0) - break loop; - w3 = 0; - } - w2 = w3 = 0; - } - } - final int result = (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) - + Long.numberOfTrailingZeros(nword); - return (result == Integer.MAX_VALUE ? -1 : result); - } - - /** - * Returns the index of the first bit that is set to true that - * occurs on or after the specified starting index. If no such it exists then - * -1 is returned. - *

- * To iterate over the true bits in a SparseBitSet - * sbs, use the following loop: - * - *

-     *  for ( int i = sbbits.nextSetBit(0); i >= 0; i = sbbits.nextSetBit(i+1) )
-     *  {
-     *      // operate on index i here
-     *  }
- * - * @param i the index to start checking from (inclusive) - * @return the index of the next set bit - * @exception IndexOutOfBoundsException if the specified index is negative - * @since 1.6 - */ - public int nextSetBit(int i) - { - /* The index value (i) of this method is permitted to be Integer.MAX_VALUE, - as this is needed to make the loop defined above work: just in case the - bit labelled Integer.MAX_VALUE-1 is set. This case is not optimised: - but eventually -1 will be returned, as this will be included with - any search that goes off the end of the level1 array. */ - - if (i < 0) - throw new IndexOutOfBoundsException("i=" + i); - /* This is the word from which the search begins. */ - int w = i >> SHIFT3; - int w3 = w & MASK3; - int w2 = (w >> SHIFT2) & MASK2; - int w1 = w >> SHIFT1; - - long word = 0L; - final int aLength = bits.length; - - long[][] a2; - long[] a3; - /* Is the next set bit in the same word at the nominated beginning bit - (including the nominated beginning bit itself). The first check is - whether the starting bit is within the structure at all. */ - if (w1 < aLength && ((a2 = bits[w1]) == null - || (a3 = a2[w2]) == null - || ((word = a3[w3] & (~0L << i)) == 0L))) - { - /* So now start a search though the rest of the entries for a bit. */ - ++w; - w3 = w & MASK3; - w2 = (w >> SHIFT2) & MASK2; - w1 = w >> SHIFT1; - major: for (; w1 != aLength; ++w1) - { - if ((a2 = bits[w1]) != null) - for (; w2 != LENGTH2; ++w2) - { - if ((a3 = a2[w2]) != null) - for (; w3 != LENGTH3; ++w3) - if ((word = a3[w3]) != 0) - break major; - w3 = 0; - } - w2 = w3 = 0; - } - } - return (w1 >= aLength ? -1 - : (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) - + Long.numberOfTrailingZeros(word)); - } - - /** - * Returns the index of the nearest bit that is set to {@code false} - * that occurs on or before the specified starting index. - * If no such bit exists, or if {@code -1} is given as the - * starting index, then {@code -1} is returned. - * - * @param i the index to start checking from (inclusive) - * @return the index of the previous clear bit, or {@code -1} if there - * is no such bit - * @throws IndexOutOfBoundsException if the specified index is less - * than {@code -1} - * @since 1.2 - * @see java.util.BitSet#previousClearBit - */ - public int previousClearBit(int i) - { - if (i < 0) - { - if (i == -1) - return -1; - throw new IndexOutOfBoundsException("i=" + i); - } - - final long[][][] bits = this.bits; - final int aSize = bits.length - 1; - - int w = i >> SHIFT3; - int w3 = w & MASK3; - int w2 = (w >> SHIFT2) & MASK2; - int w1 = w >> SHIFT1; - if (w1 > aSize) - return i; - w1 = Math.min(w1, aSize); - int w4 = i % LENGTH4; - - long word; - long[][] a2; - long[] a3; - - for (; w1 >= 0; --w1) - { - if ((a2 = bits[w1]) == null) - return (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) + w4; - for (; w2 >= 0; --w2) - { - if ((a3 = a2[w2]) == null) - return (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) + w4; - for (; w3 >= 0; --w3) - { - if ((word = a3[w3]) == 0) - return (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) + w4; - for (int bitIdx = w4; bitIdx >= 0; --bitIdx) - { - if ((word & (1L << bitIdx)) == 0) - return (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) + bitIdx; - } - w4 = LENGTH4_SIZE; - } - w3 = LENGTH3_SIZE; - } - w2 = LENGTH2_SIZE; - } - return -1; - } - - /** - * Returns the index of the nearest bit that is set to {@code true} - * that occurs on or before the specified starting index. - * If no such bit exists, or if {@code -1} is given as the - * starting index, then {@code -1} is returned. - * - * @param i the index to start checking from (inclusive) - * @return the index of the previous set bit, or {@code -1} if there - * is no such bit - * @throws IndexOutOfBoundsException if the specified index is less - * than {@code -1} - * @since 1.2 - * @see java.util.BitSet#previousSetBit - */ - public int previousSetBit(int i) - { - if (i < 0) - { - if (i == -1) - return -1; - throw new IndexOutOfBoundsException("i=" + i); - } - - final long[][][] bits = this.bits; - final int aSize = bits.length - 1; - - /* This is the word from which the search begins. */ - final int w = i >> SHIFT3; - int w1 = w >> SHIFT1; - int w2, w3, w4; - /* But if its off the end of the array, start from the very end. */ - if (w1 > aSize) - { - w1 = aSize; - w2 = LENGTH2_SIZE; - w3 = LENGTH3_SIZE; - w4 = LENGTH4_SIZE; - } - else - { - w2 = (w >> SHIFT2) & MASK2; - w3 = w & MASK3; - w4 = i % LENGTH4; - } - long word; - long[][] a2; - long[] a3; - for (; w1 >= 0; --w1) - { - if ((a2 = bits[w1]) != null) - for (; w2 >= 0; --w2) - { - if ((a3 = a2[w2]) != null) - for (; w3 >= 0; --w3) - { - if ((word = a3[w3]) != 0) - for (int bitIdx = w4; bitIdx >= 0; --bitIdx) - { - if ((word & (1L << bitIdx)) != 0) - return (((w1 << SHIFT1) + (w2 << SHIFT2) + w3) << SHIFT3) + bitIdx; - } - w4 = LENGTH4_SIZE; - } - w3 = LENGTH3_SIZE; - w4 = LENGTH4_SIZE; - } - w2 = LENGTH2_SIZE; - w3 = LENGTH3_SIZE; - w4 = LENGTH4_SIZE; - } - return -1; - } - - /** - * Performs a logical OR of the addressed target bit with the - * argument value. This bit set is modified so that the addressed bit has the - * value true if and only if it both initially had the value - * true or the argument value is true. - * - * @param i a bit index - * @param value a boolean value to OR with that bit - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void or(int i, boolean value) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - if (value) - set(i); - } - - /** - * Performs a logical OR of the addressed target bit with the - * argument value within the given range. This bit set is modified so that - * within the range a bit in it has the value true if and only if - * it either already had the value true or the corresponding bit - * in the bit set argument has the value true. Outside the range - * this set is not changed. - * - * @param i index of the first bit to be included in the operation - * @param j index after the last bit to included in the operation - * @param b the SparseBitSet with which to perform the OR - * operation with this SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public void or(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException - { - setScanner(i, j, b, orStrategy); - } - - /** - * Performs a logical OR of this bit set with the bit set argument. - * This bit set is modified so that a bit in it has the value true - * if and only if it either already had the value true or the - * corresponding bit in the bit set argument has the value true. - * - * @param b the SparseBitSet with which to perform the OR - * operation with this SparseBitSet - * @since 1.6 - */ - public void or(SparseBitSet b) - { - setScanner(0, b.bitsLength, b, orStrategy); - } - - /** - * Performs a logical OR of the two given SparseBitSets. - * The returned SparseBitSet is created so that a bit in it has - * the value true if and only if it either had the value - * true in the set given by the first arguemetn or had the value - * true in the second argument, otherwise false. - * - * @param a a SparseBitSet - * @param b another SparseBitSet - * @return new SparseBitSet representing the OR of the two sets - * @since 1.6 - */ - public static SparseBitSet or(SparseBitSet a, SparseBitSet b) - { - final SparseBitSet result = a.clone(); - result.or(b); - return result; - } - - /** - * Sets the bit at the specified index. - * - * @param i a bit index - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void set(int i) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - final int w = i >> SHIFT3; - final int w1 = w >> SHIFT1; - final int w2 = (w >> SHIFT2) & MASK2; - - if (i >= bitsLength) - resize(i); - long[][] a2; - if ((a2 = bits[w1]) == null) - a2 = bits[w1] = new long[LENGTH2][]; - long[] a3; - if ((a3 = a2[w2]) == null) - a3 = a2[w2] = new long[LENGTH3]; - a3[w & MASK3] |= 1L << i; - cache.hash = 0; //Invalidate size, etc., scan - } - - /** - * Sets the bit at the specified index to the specified value. - * - * @param i a bit index - * @param value a boolean value to set - * @exception IndexOutOfBoundsException if the specified index is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void set(int i, boolean value) - { - if (value) - set(i); - else - clear(i); - } - - /** - * Sets the bits from the specified i (inclusive) to the specified - * j (exclusive) to true. - * - * @param i index of the first bit to be set - * @param j index after the last bit to be se - * @exception IndexOutOfBoundsException if i is negative or is - * equal to Integer.MAX_INT, or j is negative, or - * i is larger than j. - * @since 1.6 - */ - public void set(int i, int j) throws IndexOutOfBoundsException - { - setScanner(i, j, null, setStrategy); - } - - /** - * Sets the bits from the specified i (inclusive) to the specified - * j (exclusive) to the specified value. - * - * @param i index of the first bit to be set - * @param j index after the last bit to be set - * @param value to which to set the selected bits - * @exception IndexOutOfBoundsException if i is negative or is - * equal to Integer.MAX_VALUE, or j is negative, or - * i is larger than j - * @since 1.6 - */ - public void set(int i, int j, boolean value) - { - if (value) - set(i, j); - else - clear(i, j); - } - - /** - * Returns the number of bits of space nominally in use by this - * SparseBitSet to represent bit values. The count of bits in - * the set is the (label of the last set bit) + 1 - (the label of the first - * set bit). - * - * @return the number of bits (true and false) nominally in this bit set - * at this moment - * @since 1.6 - */ - public int size() - { - statisticsUpdate(); - return cache.size; - } - - /** - * Convenience method for statistics if the individual results are not needed. - * - * @return a String detailing the statistics of the bit set - * @see #statistics(String[]) - * @since 1.6 - */ - public String statistics() - { - return statistics(null); - } - - /** - * Determine, and create a String with the bit set statistics. The statistics - * include: Size, Length, Cardinality, Total words (i.e., the total - * number of 64-bit "words"), Set array length (i.e., the number of - * references that can be held by the top level array, Level2 areas in use, - * Level3 blocks in use,, Level2 pool size, Level3 pool size, and the - * Compaction count. - *

- * This method is intended for diagnostic use (as it is relatively expensive - * in time), but can be useful in understanding an application's use of a - * SparseBitSet. - * - * @param values an array for the individual results (if not null) - * @return a String detailing the statistics of the bit set - * @since 1.6 - */ - public String statistics(String[] values) - { - statisticsUpdate(); // Ensure statistics are up-to-date - String[] v = new String[Statistics.values().length]; - - /* Assign the statistics values to the appropriate entry. The order - of the assignments does not matter--the ordinal serves to get the - values into the matching order with the labels from the enumeration. */ - v[Statistics.Size.ordinal()] = Integer.toString(size()); - v[Statistics.Length.ordinal()] = Integer.toString(length()); - v[Statistics.Cardinality.ordinal()] = Integer.toString(cardinality()); - v[Statistics.Total_words.ordinal()] = Integer.toString(cache.count); - v[Statistics.Set_array_length.ordinal()] = Integer.toString(bits.length); - v[Statistics.Set_array_max_length.ordinal()] = - Integer.toString(MAX_LENGTH1); - v[Statistics.Level2_areas.ordinal()] = Integer.toString(cache.a2Count); - v[Statistics.Level2_area_length.ordinal()] = Integer.toString(LENGTH2); - v[Statistics.Level3_blocks.ordinal()] = Integer.toString(cache.a3Count); - v[Statistics.Level3_block_length.ordinal()] = Integer.toString(LENGTH3); - v[Statistics.Compaction_count_value.ordinal()] = - Integer.toString(compactionCount); - - /* Determine the longest label, so that the equal signs may be lined-up. */ - int longestLabel = 0; - for (Statistics s : Statistics.values()) - longestLabel = - Math.max(longestLabel, s.name().length()); - - /* Build a String that has for each statistic, the name of the statistic, - padding, and equals sign, and the value. The "Load_factor_value", - "Average_length_value", and "Average_chain_length" are printed as - floating point values. */ - final StringBuilder result = new StringBuilder(); - for (Statistics s : Statistics.values()) - { - result.append(s.name()); // The name of the statistic - for (int i = 0; i != longestLabel - s.name().length(); ++i) - result.append(' '); // Fill out the field - result.append(" = "); // Show an equals sign - result.append(v[s.ordinal()]); // and a value - result.append('\n'); - } - /* Remove the underscores. */ - for (int i = 0; i != result.length(); ++i) - if (result.charAt(i) == '_') - result.setCharAt(i, ' '); - - if (values != null) - { - final int len = Math.min(values.length, v.length); - System.arraycopy(v, 0, values, 0, len); - } - return result.toString(); - } - - /** - * Returns a string representation of this bit set. For every index for which - * this SparseBitSet contains a bit in the set state, the decimal - * representation of that index is included in the result. Such indices are - * listed in order from lowest to highest. If there is a subsequence of set - * bits longer than the value given by toStringCompaction, the subsequence - * is represented by the value for the first and the last values, with ".." - * between them. The individual bits, or the representation of sub-sequences - * are separated by ", " (a comma and a space) and surrounded by braces, - * resulting in a compact string showing (a variant of) the usual mathematical - * notation for a set of integers. - *
- * Example (with the default value of 2 for subsequences): - *

-     *      SparseBitSet drPepper = new SparseBitSet();
-     *  
- * Now drPepper.toString() returns "{}". - *
- *
-     *      drPepper.set(2);
-     *  
- * Now drPepper.toString() returns "{2}". - *
- *
-     *      drPepper.set(3, 4);
-     *      drPepper.set(10);
-     *  
- * Now drPepper.toString() returns "{2..4, 10}". - *
- * This method is intended for diagnostic use (as it is relatively expensive - * in time), but can be useful in interpreting problems in an application's use - * of a SparseBitSet. - * - * @return a String representation of this SparseBitSet - * @see #toStringCompaction(int length) - * @since 1.6 - */ - @Override - public String toString() - { - final StringBuilder p = new StringBuilder(200); - p.append('{'); - int i = nextSetBit(0); - /* Loop so long as there is another bit to append to the String. */ - while (i >= 0) - { - /* Append that next bit */ - p.append(i); - /* Find the position of the next bit to show. */ - int j = nextSetBit(i + 1); - if (compactionCount > 0) - { - /* Give up if there is no next bit to show. */ - if (j < 0) - break; - /* Find the next clear bit is after the current bit, i.e., i */ - int last = nextClearBit(i); - /* Compute the position of the next clear bit after the current - subsequence of set bits. */ - last = (last < 0 ? Integer.MAX_VALUE : last); - /* If the subsequence is more than the specified bits long, then - collapse the subsequence into one entry in the String. */ - if (i + compactionCount < last) - { - p.append("..").append(last - 1); - /* Having accounted for a subsequence of bits that are all set, - recompute the label of the next bit to show. */ - j = nextSetBit(last); - } - } - /* If there is another set bit, put a comma and a space after the - last entry in the String. */ - if (j >= 0) - p.append(", "); - /* Transfer to i the index of the next set bit. */ - i = j; - } - /* Terminate the representational String, and return it. */ - p.append('}'); - return p.toString(); - } - - /** Sequences of set bits longer than this value are shown by - * {@link #toString()} as a "sub-sequence," in the form a..b. - * Setting this value to zero causes each set bit to be listed individually. - * The default default value is 2 (which means sequences of three or more - * bits set are shown as a subsequence, and all other set bits are listed - * individually). - *

- * Note: this value will be passed to SparseBitSets that - * may be created within or as a result of the operations on this bit set, - * or, for static methods, from the value belonging to the first parameter. - * - * @param count the maximum count of a run of bits that are shown as - * individual entries in a toString() conversion. - * If 0, all bits are shown individually. - * @since 1.6 - * @see #toString() - */ - public void toStringCompaction(int count) - { - compactionCount = count; - } - - /** - * If change is true, the current value of the - * toStringCompaction() value is made the default value for all - * SparseBitSets created from this point onward in this JVM. - * - * @param change if true, change the default value - * @since 1.6 - */ - public void toStringCompaction(boolean change) - { - /* This is an assignment to a static value: the integer value assignment - is atomic, so there will not be a partial store. If multiple - invocations are made from multiple threads, there is a race - condition that cannot be resolved by synchronization. */ - if (change) - compactionCountDefault = compactionCount; - } - - /** - * Performs a logical XOR of the addressed target bit with the - * argument value. This bit set is modified so that the addressed bit has the - * value true if and only one of the following statements holds: - *

    - *
  • The addressed bit initially had the value true, and the - * value of the argument is false. - *
  • The bit initially had the value false, and the - * value of the argument is true. - *
- * - * @param i a bit index - * @param value a boolean value to XOR with that bit - * @exception java.lang.IndexOutOfBoundsException if the specified index - * is negative - * or equal to Integer.MAX_VALUE - * @since 1.6 - */ - public void xor(int i, boolean value) - { - if ((i + 1) < 1) - throw new IndexOutOfBoundsException("i=" + i); - if (value) - flip(i); - } - - /** - * Performs a logical XOR of this bit set with the bit set argument - * within the given range. This resulting bit set is computed so that a bit - * within the range in it has the value true if and only if one - * of the following statements holds: - *
    - *
  • The bit initially had the value true, and the - * corresponding bit in the argument set has the value false. - *
  • The bit initially had the value false, and the - * corresponding bit in the argument set has the value true. - *
- * Outside the range this set is not changed. - * - * @param i index of the first bit to be included in the operation - * @param j index after the last bit to included in the operation - * @param b the SparseBitSet with which to perform the XOR - * operation with this SparseBitSet - * @exception IndexOutOfBoundsException if i is negative or - * equal to Integer.MAX_VALUE, or j is negative, - * or i is larger than j - * @since 1.6 - */ - public void xor(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException - { - setScanner(i, j, b, xorStrategy); - } - - /** - * Performs a logical XOR of this bit set with the bit set argument. - * This resulting bit set is computed so that a bit in it has the value - * true if and only if one of the following statements holds: - *
    - *
  • The bit initially had the value true, and the - * corresponding bit in the argument set has the value false. - *
  • The bit initially had the value false, and the - * corresponding bit in the argument set has the value true. - *
- * - * @param b the SparseBitSet with which to perform the XOR - * operation with thisSparseBitSet - * @since 1.6 - */ - public void xor(SparseBitSet b) - { - setScanner(0, b.bitsLength, b, xorStrategy); - } - - /** - * Performs a logical XOR of the two given SparseBitSets. - * The resulting bit set is created so that a bit in it has the value - * true if and only if one of the following statements holds: - *
    - *
  • A bit in the first argument has the value true, and the - * corresponding bit in the second argument has the value - * false.
  • - *
  • A bit in the first argument has the value false, and the - * corresponding bit in the second argument has the value - * true.
- * - * @param a a SparseBitSet - * @param b another SparseBitSet - * @return a new SparseBitSet representing the XOR of the two sets - * @since 1.6 - */ - public static SparseBitSet xor(SparseBitSet a, SparseBitSet b) - { - final SparseBitSet result = a.clone(); - result.xor(b); - return result; - } - - //============================================================================== - // Internal methods - //============================================================================== - - /** - * Throw the exception to indicate a range error. The String - * constructed reports all the possible errors in one message. - * - * @param i lower bound for a operation - * @param j upper bound for a operation - * @exception IndexOutOfBoundsException indicating the range is not valid - * @since 1.6 - */ - protected static void throwIndexOutOfBoundsException(int i, int j) - throws IndexOutOfBoundsException - { - String s = ""; - if (i < 0) - s += "(i=" + i + ") < 0"; - if (i == Integer.MAX_VALUE) - s += "(i=" + i + ")"; - if (j < 0) - s += (s.isEmpty() ? "" : ", ") + "(j=" + j + ") < 0"; - if (i > j) - s += (s.isEmpty() ? "" : ", ") + "(i=" + i + ") > (j=" + j + ")"; - throw new IndexOutOfBoundsException(s); - } - - /** - * Initializes all the additional objects required for correct operation. - * - * @since 1.6 - */ - protected final void constructorHelper() - { - spare = new long[LENGTH3]; - cache = new Cache(); - updateStrategy = new UpdateStrategy(); - } - - /** - * Clear out a part of the set array with nulls, from the given start to the - * end of the array. If the given parameter is beyond the end of the bits - * array, nothing is changed. - * - * @param start word index at which to start (inclusive) - * @since 1.6 - */ - protected final void nullify(int start) - { - final int aLength = bits.length; - if (start < aLength) - { - for (int w = start; w != aLength; ++w) - bits[w] = null; - cache.hash = 0; // Invalidate size, etc., values - } - } - - /** - * Resize the bit array. Moves the entries in the the bits array of this - * SparseBitSet into an array whose size (which may be larger or smaller) is - * the given bit size (i.e., includes the bit whose index is one less - * that the given value). If the new array is smaller, the excess entries in - * the set array are discarded. If the new array is bigger, it is filled with - * nulls. - * - * @param index the desired address to be included in the set - * @since 1.6 - */ - protected final void resize(int index) - { - /* Find an array size that is a power of two that is as least as large - enough to contain the index requested. */ - final int w1 = (index >> SHIFT3) >> SHIFT1; - int newSize = Integer.highestOneBit(w1); - if (newSize == 0) - newSize = 1; - if (w1 >= newSize) - newSize <<= 1; - if (newSize > MAX_LENGTH1) - newSize = MAX_LENGTH1; - final int aLength1 = (bits != null ? bits.length : 0); - - if (newSize != aLength1 || bits == null) - { // only if the size needs to be changed - final long[][][] temp = new long[newSize][][]; // Get the new array - if (aLength1 != 0) - { - /* If it exists, copy old array to the new array. */ - System.arraycopy(bits, 0, temp, 0, Math.min(aLength1, newSize)); - nullify(0); // Don't leave unused pointers around. */ - } - bits = temp; // Set new array as the set array - bitsLength = // Index of last possible bit, plus one. - (newSize == MAX_LENGTH1 ? Integer.MAX_VALUE : newSize * UNIT); - } - } - - /** - * Scans over the bit set (and a second bit set if part of the operation) are - * all performed by this method. The properties and the operation executed - * are defined by a given strategy, which must be derived from the - * AbstractStrategy. The strategy defines how to operate on a - * single word, and on whole words that may or may not constitute a full - * block of words. - * - * @param i the bit (inclusive) at which to start the scan - * @param j the bit (exclusive) at which to stop the scan - * @param b a SparseBitSet, if needed, the second SparseBitSet in the - * operation - * @param op the AbstractStrategy class defining the operation to be - * executed - * @exception IndexOutOfBoundsException - * @since 1.6 - * @see AbstractStrategy - */ - protected final void setScanner(int i, int j, SparseBitSet b, - AbstractStrategy op) throws IndexOutOfBoundsException - { - /* This method has been assessed as having a McCabe cyclomatic - complexity of 47 (i.e., impossibly high). However, given that this - method incorporates all the set scanning logic for all methods - (with the exception of nextSetBit and nextClearBit, which themselves - have high cyclomatic complexities of 13), and is attempting to minimise - execution time (hence deals with processing shortcuts), it cannot be - expected to be simple. In fact, the work of lining up level3 blocks - proceeds step-wise, and each sub-section piece is reasonably - straight-forward. Nevertheless, the number of paths is high, and - caution is advised in attempting to correct anything. */ - - /* Do whatever the strategy needs to get started, and do whatever initial - checking is needed--fail here if needed before much else is done. */ - if (op.start(b)) - cache.hash = 0; - - if (j < i || (i + 1) < 1) - throwIndexOutOfBoundsException(i, j); - if (i == j) - return; - - /* Get the values of all the short-cut options. */ - final int properties = op.properties(); - final boolean f_op_f_eq_f = (properties & AbstractStrategy.F_OP_F_EQ_F) != 0; - final boolean f_op_x_eq_f = (properties & AbstractStrategy.F_OP_X_EQ_F) != 0; - final boolean x_op_f_eq_f = (properties & AbstractStrategy.X_OP_F_EQ_F) != 0; - final boolean x_op_f_eq_x = (properties & AbstractStrategy.X_OP_F_EQ_X) != 0; - - /* Index of the current word, and mask for the first word, - to be processed in the bit set. */ - int u = i >> SHIFT3; - final long um = ~0L << i; - - /* Index of the final word, and mask for the final word, - to be processed in the bit set. */ - final int v = (j - 1) >> SHIFT3; - final long vm = ~0L >>> -j; - - /* Set up the two bit arrays (if the second exists), and their - corresponding lengths (if any). */ - long[][][] a1 = bits; // Level1, i.e., the bit arrays - int aLength1 = bits.length; - final long[][][] b1 = (b != null ? b.bits : null); - final int bLength1 = (b1 != null ? b.bits.length : 0); - - /* Calculate the initial values of the parts of the words addresses, - as well as the location of the final block to be processed. */ - int u1 = u >> SHIFT1; - int u2 = (u >> SHIFT2) & MASK2; - int u3 = u & MASK3; - final int v1 = v >> SHIFT1; - final int v2 = (v >> SHIFT2) & MASK2; - final int v3 = v & MASK3; - final int lastA3Block = (v1 << LEVEL2) + v2; - - /* Initialize the local copies of the counts of blocks and areas; and - whether there is a partial first block. */ - int a2CountLocal = 0; - int a3CountLocal = 0; - boolean notFirstBlock = u == 0 && um == ~0L; - - /* The first level2 is cannot be judged empty if not being scanned from - the beginning. */ - boolean a2IsEmpty = u2 == 0; // Presumption - while (i < j) - { - /* Determine if there is a level2 area in both the a and the b set, - and if so, set the references to these areas. */ - long[][] a2 = null; - boolean haveA2 = u1 < aLength1 && (a2 = a1[u1]) != null; - long[][] b2 = null; - final boolean haveB2 = u1 < bLength1 - && b1 != null && (b2 = b1[u1]) != null; - /* Handling of level 2 empty areas: determined by the - properties of the strategy. It is necessary to actually visit - the first and last blocks of a scan, since not all of the block - might participate in the operation, hence making decision based - on just the references to the blocks could be wrong. */ - if ((!haveA2 && !haveB2 && f_op_f_eq_f - || !haveA2 && f_op_x_eq_f || !haveB2 && x_op_f_eq_f) - && notFirstBlock && u1 != v1) - {//nested if! - if (u1 < aLength1) - a1[u1] = null; - } - else - { - final int limit2 = (u1 == v1 ? v2 + 1 : LENGTH2); - while (u2 != limit2) - { - /* Similar logic applied here as for the level2 blocks. - The initial and final block must be examined. In other - cases, it may be possible to make a decision based on - the value of the references, as indicated by the - properties of the strategy. */ - long[] a3 = null; - final boolean haveA3 = haveA2 && (a3 = a2[u2]) != null; - long[] b3 = null; - final boolean haveB3 = haveB2 && (b3 = b2[u2]) != null; - final int a3Block = (u1 << LEVEL2) + u2; - final boolean notLastBlock = lastA3Block != a3Block; - /* Handling of level 3 empty areas: determined by the - properties of the strategy. */ - if ((!haveA3 && !haveB3 && f_op_f_eq_f - || !haveA3 && f_op_x_eq_f || !haveB3 && x_op_f_eq_f) - && notFirstBlock && notLastBlock) - { - /* Do not need level3 block, so remove it, and move on. */ - if (haveA2) - a2[u2] = null; - } - else - { - /* So what is needed is the level3 block. */ - final int base3 = a3Block << SHIFT2; - final int limit3 = (notLastBlock ? LENGTH3 : v3); - if (!haveA3) - a3 = spare; - if (!haveB3) - b3 = ZERO_BLOCK; - boolean isZero; - if (notFirstBlock && notLastBlock) - if (x_op_f_eq_x && !haveB3) - isZero = op.isZeroBlock(a3); - // b block is null, just check a block - else - isZero = op.block(base3, 0, LENGTH3, a3, b3); - // Do the operation on the whole block - else - { /* Partial block to process. */ - if (notFirstBlock) - { - /* By implication, this is the last block */ - isZero = op.block(base3, 0, limit3, a3, b3); - // Do the whole words - isZero &= op.word(base3, limit3, a3, b3, vm); - // And then the final word - } - else - { // u, v are correct if first block - if (u == v) // Scan starts and ends in one word - isZero = op.word(base3, u3, a3, b3, um & vm); - else - { // Scan starts in this a3 block - isZero = op.word(base3, u3, a3, b3, um); - // First word - isZero &= - op.block(base3, u3 + 1, limit3, a3, b3); - // Remainder of full words in block - if (limit3 != LENGTH3) - isZero &= op.word(base3, limit3, a3, b3, vm); - // If there is a partial word left - } - notFirstBlock = true; // Only one first block - } - if (isZero) - isZero = op.isZeroBlock(a3); - // If not known to have a non-zero - // value, be sure whether all zero. - } - if (isZero) // The resulting a3 block has no values - {// nested if! - /* If there is an level 2 area make the entry for this - level3 block be a null (i.e., remove any a3 block ). */ - if (haveA2) - a2[u2] = null; - } - else - { - /* If the a3 block used was the spare block, put it - into current level2 area; get a new spare block. */ - if (a3 == spare) - { - if (i >= bitsLength) //Check that the set is large - { // enough to take the new block - resize(i); // Make it large enough - a1 = bits; // Update reference and length - aLength1 = a1.length; - } - if (a2 == null) // Ensure a level 2 area - { - a1[u1] = a2 = new long[LENGTH2][]; - haveA2 = true; // Ensure know level2 not empty - } - a2[u2] = a3; // Insert the level3 block - spare = new long[LENGTH3]; // Replace the spare - } - ++a3CountLocal; // Count the level 3 block - } - a2IsEmpty &= !(haveA2 && a2[u2] != null); - } // Keep track of level 2 usage - ++u2; - u3 = 0; - } /* end while ( u2 != limit2 ) */ - /* If the loop finishes without completing the level 2, it may - be left with a reference but still be all null--this is OK. */ - if (u2 == LENGTH2 && a2IsEmpty && u1 < aLength1) - a1[u1] = null; - else - ++a2CountLocal; // Count level 2 areas - } - /* Advance the value of u based on what happened. */ - i = (u = (++u1 << SHIFT1)) << SHIFT3; - u2 = 0; // u3 = 0 - // Compute next word and bit index - if (i < 0) - i = Integer.MAX_VALUE; // Don't go over the end - } /* end while( i < j ) */ - - /* Do whatever the strategy needs in order to finish. */ - op.finish(a2CountLocal, a3CountLocal); - } - - /** - * The entirety of the bit set is examined, and the various statistics of - * the bit set (size, length, cardinality, hashCode, etc.) are computed. Level - * arrays that are empty (i.e., all zero at level 3, all null at level 2) are - * replaced by null references, ensuring a normalized representation. - * - * @since 1.6 - */ - protected final void statisticsUpdate() - { - if (cache.hash != 0) - return; - setScanner(0, bitsLength, null, updateStrategy); - } - - //============================================================================== - // Serialization/Deserialization methods - //============================================================================== - - /** - * Save the state of the SparseBitSet instance to a stream - * (i.e., serialize it). - * - * @param s the ObjectOutputStream to which to write the serialized object - * @exception java.io.IOException if an io error occurs - * @exception java.lang.InternalError if the SparseBitSet representation is - * inconsistent - * - * @serialData The default data is emitted, followed by the current - * compactionCount for the bit set, and then the - * length of the set (the position of the last bit), - * followed by the cache.count value (an int, - * the number of int->long pairs needed to describe - * the set), followed by the index (int) and word - * (long) for each int->long pair. - * The mappings need not be emitted in any particular order. This - * is followed by the hashCode for the set that can be used - * as an integrity check when the bit set is read back. - * - * @since 1.6 - */ - private void writeObject(ObjectOutputStream s) throws IOException, InternalError - { - statisticsUpdate(); // Update structure and stats if needed. - /* Write any hidden stuff. */ - s.defaultWriteObject(); - s.writeInt(compactionCount); // Needed to preserve value - s.writeInt(cache.length); // Needed to know where last bit is - - /* This is the number of index/value pairs to be written. */ - int count = cache.count; // Minimum number of words to be written - s.writeInt(count); - final long[][][] a1 = bits; - final int aLength1 = a1.length; - long[][] a2; - long[] a3; - long word; - for (int w1 = 0; w1 != aLength1; ++w1) - if ((a2 = a1[w1]) != null) - for (int w2 = 0; w2 != LENGTH2; ++w2) - if ((a3 = a2[w2]) != null) - { - final int base = (w1 << SHIFT1) + (w2 << SHIFT2); - for (int w3 = 0; w3 != LENGTH3; ++w3) - if ((word = a3[w3]) != 0) - { - s.writeInt(base + w3); - s.writeLong(word); - --count; - } - } - if (count != 0) - throw new InternalError("count of entries not consistent"); - /* As a consistency check, write the hash code of the set. */ - s.writeInt(cache.hash); - } - - /** - * serialVersionUID - */ - private static final long serialVersionUID = -6663013367427929992L; - - /** - * Reconstitute the SparseBitSet instance from a stream - * (i.e., deserialize it). - * - * @param s the ObjectInputStream to use - * @exception IOException if there is an io error - * @exception ClassNotFoundException if the stream contains an unidentified - * class - * @since 1.6 - */ - private void readObject(ObjectInputStream s) throws IOException, - ClassNotFoundException - { - /* Read in any hidden stuff that is part of the class overhead. */ - s.defaultReadObject(); - compactionCount = s.readInt(); - final int aLength = s.readInt(); - resize(aLength); // Make sure there is enough space - - /* Read in number of mappings. */ - final int count = s.readInt(); - /* Read the keys and values, them into the set array, areas, and blocks. */ - long[][] a2; - long[] a3; - for (int n = 0; n != count; ++n) - { - final int w = s.readInt(); - final int w3 = w & MASK3; - final int w2 = (w >> SHIFT2) & MASK2; - final int w1 = w >> SHIFT1; - - final long word = s.readLong(); - if ((a2 = bits[w1]) == null) - a2 = bits[w1] = new long[LENGTH2][]; - if ((a3 = a2[w2]) == null) - a3 = a2[w2] = new long[LENGTH3]; - a3[w3] = word; - } - /* Ensure all the pieces are set up for set scanning. */ - constructorHelper(); - statisticsUpdate(); - if (count != cache.count) - throw new InternalError("count of entries not consistent"); - final int hash = s.readInt(); // Get the hashcode that was stored - if (hash != cache.hash) // An error of some kind if not the same - throw new IOException("deserialized hashCode mis-match"); - } - - //============================================================================= - // Statistics enumeration - //============================================================================= - - /** - * These enumeration values are used as labels for the values in the String - * created by the statistics() method. The values of the corresponding - * statistics are ints, except for the loadFactor and - * Average_chain_length values, which are floats. - *

- * An array of Strings may be obtained containing a - * representation of each of these values. An element of such an array, say, - * values, may be accessed, for example, by: - *

-     *      values[SparseBitSet.statistics.Buckets_available.ordinal()]
- * - * @see #statistics(String[]) - */ - public enum Statistics - { - /** - * The size of the bit set, as give by the size() method. - */ - Size, // 0 - /** - * The length of the bit set, as give by the length() method. - */ - Length, // 1 - /** - * The cardinality of the bit set, as give by the cardinality() method. - */ - Cardinality, // 2 - /** - * The total number of non-zero 64-bits "words" being used to hold the - * representation of the bit set. - */ - Total_words, // 3 - /** - * The length of the bit set array. - */ - Set_array_length, // 4 - /** - * The maximum permitted length of the bit set array. - */ - Set_array_max_length, // 5 - /** - * The number of level2 areas. - */ - Level2_areas, // 6 - /** - * The length of the level2 areas. - */ - Level2_area_length, // 7 - /** - * The total number of level3 blocks in use. - */ - Level3_blocks, // 8 - /** - * The length of the level3 blocks. - */ - Level3_block_length, // 9 - /** - * Is the value that determines how the toString() conversion is - * performed. - * @see #toStringCompaction(int) - */ - Compaction_count_value // 10 - } - - //============================================================================= - // A set of cached statistics values, recomputed when necessary - //============================================================================= - - /** - * This class holds the values related to various statistics kept about the - * bit set. These values are not kept continuously up-to-date. Whenever the - * values become invalid, the field hash is set to zero, indicating - * that an update is required. - * - * @see #statisticsUpdate() - */ - protected class Cache - { - /** - * hash is updated by the statisticsUpdate() method. - * If the hash value is zero, it is assumed that all - * the cached values are stale, and must be updated. - */ - protected transient int hash; - - /** - * size is updated by the statisticsUpdate() method. - * If the hash value is zero, it is assumed the all the cached - * values are stale, and must be updated. - */ - protected transient int size; - - /** - * cardinality is updated by the statisticsUpdate() method. - * If the hash value is zero, it is assumed the all the cached - * values are stale, and must be updated. - */ - protected transient int cardinality; - - /** - * length is updated by the statisticsUpdate() method. - * If the hash value is zero, it is assumed the all the cached - * values are stale, and must be updated. - */ - protected transient int length; - - /** - * count is updated by the statisticsUpdate() method. - * If the hash value is zero, it is assumed the all the cached - * values are stale, and must be updated. - */ - protected transient int count; - - /** - * a2Count is updated by the statisticsUpdate() - * method, and will only be correct immediately after a full update. The - * hash value is must be zero for all values to be updated. - */ - protected transient int a2Count; - - /** - * a3Count is updated by the statisticsUpdate() method, - * and will only be correct immediately after a full update. The - * hash value is must be zero for all values to be updated. - */ - protected transient int a3Count; - } - - //============================================================================= - // Abstract Strategy super-class for Strategies describing logical operations - //============================================================================= - - /** - * This strategy class is used by the setScanner to carry out the a variety - * of operations on this set, and usually a second set. The - * setScanner() method of the main SparseBitSet class - * essentially finds matching level3 blocks, and then calls the strategy to - * do the appropriate operation on each of the elements of the block. - *

- * The symbolic constants control optimisation paths in the - * setScanner() method of the main SparseBitSet class. - * - * @see SparseBitSet#setScanner(int i, int j, - * SparseBitSet b, AbstractStrategy op) - */ - protected abstract static class AbstractStrategy - { - /** If the operation requires that when matching level2 areas or level3 - * blocks are null, that no action is required, then this property is - * required. Corresponds to the top-left entry in the logic diagram for the - * operation being 0. For all the defined actual logic operations ('and', - * 'andNot', 'or', and 'xor', this will be true, because for all these, - * "false" op "false" = "false". - */ - static final int F_OP_F_EQ_F = 0x1; - - /** If when level2 areas or level3 areas from the this set are null will - * require that area or block to remain null, irrespective of the value of - * the matching structure from the other set, then this property is required. - * Corresponds to the first row in the logic diagram being all zeros. For - * example, this is true for 'and' as well as 'andNot', and for 'clear', since - * false" & "x" = "false", and "false" &! "x" = "false". - */ - static final int F_OP_X_EQ_F = 0x2; - - /** If when level2 areas or level3 areas from the other set are null will - * require the matching area or block in this set to be set to null, - * irrespective of the current values in the matching structure from the - * this, then this property is required. Corresponds to the first column - * in the logic diagram being all zero. For example, this is true for - * 'and', since "x" & "false" = "false", as well as for 'clear'. - */ - static final int X_OP_F_EQ_F = 0x4; - - /** If when a level3 area from the other set is null will require the - * matching area or block in this set to be left as it is, then this property - * is required. Corresponds to the first column of the logic diagram being - * equal to the left hand operand column. For example, this is true for 'or', - * 'xor', and 'andNot', since for all of these "x" op "false" = "x". - */ - static final int X_OP_F_EQ_X = 0x8; - - /** - * Properties of this strategy. - * - * @return the int containing the bits representing the properties of - * this strategy - * @since 1.6 - */ - protected abstract int properties(); - - /** - * Instances of this class are to be serially reusable. To start a - * particular use, an instance is (re-)started by calling this method. It is - * passed the reference to the other bit set (usually to allow a check on - * whether it is null or not, so as to simplify the implementation of the - * block() method. - * - * @param b the "other" set, for whatever checking is needed. - * @since 1.6 - * @return true -> if the cache should be set to zero - */ - protected abstract boolean start(SparseBitSet b); - - /** - * Deal with a scan that include a partial word within a level3 block. All - * that is required is that the result be stored (if needed) into the - * given a set block at the correct position, and that the operation only - * affect those bits selected by 1 bits in the mask. - * - * @param base the base index of the block (to be used if needed) - * @param u3 the index of the word within block - * @param a3 the level3 block from the a set. - * @param b3 the (nominal) level3 block from the b set (not null). - * @param mask for the (partial) word - * @return true if the resulting word is zero - * @since 1.6 - */ - protected abstract boolean word(int base, int u3, long[] a3, long[] b3, long mask); - - /** - * Deals with a part of a block that consists of whole words, starting with - * the given first index, and ending with the word before the last index. - * For the words processed, the return value should indicate whether all those - * resulting words were zero, or not. - * - * @param base the base index of the block (to be used if needed) - * @param u3 the index of the first word within block to process - * @param v3 the index of the last word, which may be within block - * @param a3 the level3 block from the a set. - * @param b3 the (nominal) level3 block from the b set (not null). - * @return true if the words scanned within the level3 block were all zero - * @since 1.6 - */ - protected abstract boolean block(int base, int u3, int v3, long[] a3, long[] b3); - - /** - * This is called to finish the processing started by the strategy (if there - * needs to be anything done at all). - * - * @param a2Count possible count of level2 areas in use - * @param a3Count possible count of level3 blocks in use - * @since 1.6 - */ - protected void finish(int a2Count, int a3Count) - { - } - - /** - * Check whether a level3 block is all zero. - * - * @param a3 the block from the a set - * @return true if the values of the level3 block are all zero - * - * @since 1.6 - */ - protected final boolean isZeroBlock(long[] a3) - { - for (long word : a3) - if (word != 0L) - return false; - return true; - } - } - - //============================================================================= - // Strategies based on the Strategy super-class describing logical operations - //============================================================================= - - /** - * And of two sets. Where the a set is zero, it remains zero (i.e., - * without entries or with zero words). Similarly, where the b set is - * zero, the a becomes zero (i.e., without entries). - *

- * If level1 of the a set is longer than level1 of the bit set - * b, then the unmatched virtual "entries" of the b set (beyond - * the actual length of b) corresponding to these are all false, hence - * the result of the "and" operation will be to make all these entries in this - * set to become false--hence just remove them, and then scan only those - * entries that could match entries in the bit setb. This clearing of - * the remainder of the a set is accomplished by selecting both - * F_OP_X_EQ_F and X_OP_F_EQ_F. - * - *

-     *  and| 0 1
-     *    0| 0 0
-     *    1| 0 1 
-     */
-    protected static class AndStrategy extends AbstractStrategy
-    {
-        @Override
-        //  AndStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + F_OP_X_EQ_F + X_OP_F_EQ_F;
-        }
-
-        @Override
-        //  AndStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            return true;
-        }
-
-        @Override
-        //  AndStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] &= b3[u3] | ~mask) == 0L;
-        }
-
-        @Override
-        //  AndStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= ((a3[w3] &= b3[w3]) == 0L);
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  AndNot of two sets. Where the a set is zero, it remains zero
-     *  (i.e., without entries or with zero words). On the other hand, where the
-     *  b set is zero, the a remains unchanged.
-     *  

- * If level1 of the a set is longer than level1 of the bit set - * b, then the unmatched virtual "entries" of the b set (beyond - * the actual length of b) corresponding to these are all false, hence - * the result of the "and" operation will be to make all these entries in this - * set to become false--hence just remove them, and then scan only those - * entries that could match entries in the bit setb. This clearing of - * the remainder of the a set is accomplished by selecting both - * F_OP_X_EQ_F and X_OP_F_EQ_F. - * - *

-     * andNot| 0 1
-     *      0| 0 0
-     *      1| 1 0 
-     */
-    protected static class AndNotStrategy extends AbstractStrategy
-    {
-        @Override
-        //  AndNotStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + F_OP_X_EQ_F + X_OP_F_EQ_X;
-        }
-
-        @Override
-        //  AndNotStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            return true;
-        }
-
-        @Override
-        //  AndNotStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] &= ~(b3[u3] & mask)) == 0L;
-        }
-
-        @Override
-        //  AndNotStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= (a3[w3] &= ~b3[w3]) == 0L;
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Clear clears bits in the a set.
-     *
-     * 
-     * clear| 0 1
-     *     0| 0 0
-     *     1| 0 0 
-     */
-    protected static class ClearStrategy extends AbstractStrategy
-    {
-        @Override
-        //  ClearStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + F_OP_X_EQ_F;
-        }
-
-        @Override
-        //  ClearStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            return true;
-        }
-
-        @Override
-        //  ClearStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] &= ~mask) == 0L;
-        }
-
-        @Override
-        //  ClearStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            if (u3 != 0 || v3 != LENGTH3) //  Optimisation
-                for (int w3 = u3; w3 != v3; ++w3)
-                    a3[w3] = 0L;
-            return true;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Copies the needed parts of the b set to the a set.
-     *
-     * 
-     * get| 0 1
-     *   0| 0 1
-     *   1| 0 1 
-     */
-    protected static class CopyStrategy extends AbstractStrategy
-    {
-        @Override
-        //  CopyStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + X_OP_F_EQ_F;
-        }
-
-        @Override
-        //  CopyStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            return true;
-        }
-
-        @Override
-        //  CopyStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] = b3[u3] & mask) == 0L;
-        }
-
-        @Override
-        //  CopyStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true;
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= (a3[w3] = b3[w3]) == 0L;
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Equals compares bits in the a set with those in the b set.
-     *  None of the values in either set are changed, although the a set
-     *  may have all zero level 3 blocks replaced by null references (and
-     *  similarly at level 2).
-     *
-     * 
-     * equals| 0 1
-     *      0| 0 -
-     *      1| - - 
-     */
-    protected static class EqualsStrategy extends AbstractStrategy
-    {
-        boolean result; // Used to hold result of the comparison
-
-        @Override
-        //  EqualsStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F;
-        }
-
-        @Override
-        //  EqualsStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            result = true;
-            return false;
-            /*  Equals does not change the content of the set, hence hash need
-                not be reset. */
-        }
-
-        @Override
-        //  EqualsStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            final long word = a3[u3];
-            result &= (word & mask) == (b3[u3] & mask);
-            return word == 0L;
-        }
-
-        @Override
-        //  EqualsStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-            {
-                final long word = a3[w3];
-                result &= word == b3[w3];
-                isZero &= word == 0L;
-            }
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Flip inverts the bits of the a set within the given range.
-     *
-     * 
-     * flip| 0 1
-     *    0| 1 1
-     *    1| 0 0 
-     */
-    protected static class FlipStrategy extends AbstractStrategy
-    {
-        @Override
-        // FlipStrategy
-        protected int properties()
-        {
-            return 0;
-        }
-
-        @Override
-        // FlipStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            return true;
-        }
-
-        @Override
-        // FlipStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] ^= mask) == 0L;
-        }
-
-        @Override
-        // FlipStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= (a3[w3] ^= ~0L) == 0L;
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Intersect has a true result if any word in the a set has a bit
-     *  in common with the b set. During the scan of the a set
-     *  blocks (and areas) that are all zero may be replaced with empty blocks
-     *  and areas (null references), but the value of the set is not changed
-     *  (which is why X_OP_F_EQ_F is not selected, since this would cause
-     *  parts of the a set to be zero-ed out).
-     *
-     * 
-     * intersect| 0 1
-     *         0| 0 0
-     *         1| 1 1 
-     */
-    protected static class IntersectsStrategy extends AbstractStrategy
-    {
-        /**
-         *  The boolean result of the intersects scan Strategy is kept here.
-         */
-        protected boolean result;
-
-        @Override
-        //  IntersectsStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + F_OP_X_EQ_F;
-        }
-
-        @Override
-        //  IntersectsStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            result = false;
-            return false;
-            /*  Intersect does not change the content of the set, hence hash
-                need not be reset. */
-        }
-
-        @Override
-        //  IntersectsStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            final long word = a3[u3];
-            result |= (word & b3[u3] & mask) != 0L;
-            return word == 0L;
-        }
-
-        @Override
-        //  IntersectsStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-            {
-                final long word = a3[w3];
-                result |= (word & b3[w3]) != 0L;
-                isZero &= word == 0L;
-            }
-            return isZero;
-        }
-    }
-
-    /**
-     *  Or of two sets. Where the a set is one, it remains one. Similarly,
-     *  where the b set is one, the a becomes one. If both sets have
-     *  zeros in corresponding places, a zero results. Whole blocks or areas that
-     *  are or become zero are replaced by null arrays.
-     *  

- * If level1 of the a set is longer than level1 of the bit set - * b, then the unmatched entries of the a set (beyond - * the actual length of b) corresponding to these remain unchanged. * - *

-     *   or| 0 1
-     *    0| 0 1
-     *    1| 1 1 
-     */
-    protected static class OrStrategy extends AbstractStrategy
-    {
-        @Override
-        //  OrStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + X_OP_F_EQ_X;
-        }
-
-        @Override
-        //  OrStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            return true;
-        }
-
-        @Override
-        //  OrStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] |= b3[u3] & mask) == 0L;
-        }
-
-        @Override
-        //  OrStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= (a3[w3] |= b3[w3]) == 0L;
-            return isZero;
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Set creates entries everywhere within the range. Hence no empty level2
-     *  areas or level3 blocks are ignored, and no empty (all zero) blocks are
-     *  returned.
-     *
-     *  
-     * set| 0 1
-     *   0| 1 1
-     *   1| 1 1 
-     */
-    protected static class SetStrategy extends AbstractStrategy
-    {
-        @Override
-        //  SetStrategy
-        protected int properties()
-        {
-            return 0;
-        }
-
-        @Override
-        //  SetStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            return true;
-        }
-
-        @Override
-        //  SetStrategy
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            a3[u3] |= mask;
-            return false;
-        }
-
-        @Override
-        //  SetStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            for (int w3 = u3; w3 != v3; ++w3)
-                a3[w3] = ~0L;
-            return false; // set always sets bits
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Update the seven statistics that are computed for each set. These are
-     *  updated by calling statisticsUpdate, which uses this strategy.
-     *
-     *  
-     *  update| 0 1
-     *       0| 0 0
-     *       1| 1 1 
-     *
-     * @see SparseBitSet#statisticsUpdate()
-     */
-    protected class UpdateStrategy extends AbstractStrategy
-    {
-        /**
-         *  Working space for find the size and length of the bit set. Holds the
-         *  index of the first non-empty word in the set.
-         */
-        protected transient int wMin;
-
-        /**
-         *  Working space for find the size and length of the bit set. Holds copy of
-         *  the first non-empty word in the set.
-         */
-        protected transient long wordMin;
-
-        /**
-         *  Working space for find the size and length of the bit set. Holds the
-         *  index of the last non-empty word in the set.
-         */
-        protected transient int wMax;
-
-        /**
-         *  Working space for find the size and length of the bit set. Holds a copy
-         *  of the last non-empty word in the set.
-         */
-        protected transient long wordMax;
-
-        /**
-         *  Working space for find the hash value of the bit set. Holds the
-         *  current state of the computation of the hash value. This value is
-         *  ultimately transferred to the Cache object.
-         *
-         * @see SparseBitSet.Cache
-         */
-        protected transient long hash;
-
-        /**
-         *  Working space for keeping count of the number of non-zero words in the
-         *  bit set. Holds the current state of the computation of the count. This
-         *  value is ultimately transferred to the Cache object.
-         *
-         * @see SparseBitSet.Cache
-         */
-        protected transient int count;
-
-        /**
-         *  Working space for counting the number of non-zero bits in the bit set.
-         *  Holds the current state of the computation of the cardinality.This
-         *  value is ultimately transferred to the Cache object.
-         *
-         * @see SparseBitSet.Cache
-         */
-        protected transient int cardinality;
-
-        @Override
-        //  UpdateStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + F_OP_X_EQ_F;
-        }
-
-        /**
-         *  This method initializes the computations by suitably resetting cache
-         *  fields or working fields.
-         *
-         * @param       b the other SparseBitSet, for checking if needed.
-         *
-         * @since       1.6
-         */
-        @Override
-        protected boolean start(SparseBitSet b)
-        {
-            hash = 1234L; // Magic number
-            wMin = -1; // index of first non-zero word
-            wordMin = 0L; // word at that index
-            wMax = 0; // index of last non-zero word
-            wordMax = 0L; // word at that index
-            count = 0; // count of non-zero words in whole set
-            cardinality = 0; // count of non-zero bits in the whole set
-            return false;
-        }
-
-        @Override
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            final long word = a3[u3];
-            final long word1 = word & mask;
-            if (word1 != 0L)
-                compute(base + u3, word1);
-            return word == 0L;
-        }
-
-        @Override
-        //  UpdateStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = 0; w3 != v3; ++w3)
-            {
-                final long word = a3[w3];
-                if (word != 0)
-                {
-                    isZero = false;
-                    compute(base + w3, word);
-                }
-            }
-            return isZero;
-        }
-
-        @Override
-        //  UpdateStrategy
-        protected void finish(int a2Count, int a3Count)
-        {
-            cache.a2Count = a2Count;
-            cache.a3Count = a3Count;
-            cache.count = count;
-            cache.cardinality = cardinality;
-            cache.length = (wMax + 1) * LENGTH4 - Long.numberOfLeadingZeros(wordMax);
-            cache.size = cache.length - wMin * LENGTH4
-                - Long.numberOfTrailingZeros(wordMin);
-            cache.hash = (int) ((hash >> Integer.SIZE) ^ hash);
-        }
-
-        /**
-         *  This method does the accumulation of the statistics. It must be called
-         *  in sequential order of the words in the set for which the statistics
-         *  are being accumulated, and only for non-null values of the second
-         *  parameter.
-         *
-         *  Two of the values (a2Count and a3Count) are not updated here,
-         *  but are done in the code near where this method is called.
-         *
-         * @param       index the word index of the word supplied
-         * @param       word the long non-zero word from the set
-         * @since       1.6
-         */
-        private void compute(final int index, final long word)
-        {
-            /*  Count the number of actual words being used. */
-            ++count;
-            /*  Continue to accumulate the hash value of the set. */
-            hash ^= word * (long) (index + 1);
-            /*  The first non-zero word contains the first actual bit of the
-                set. The location of this bit is used to compute the set size. */
-            if (wMin < 0)
-            {
-                wMin = index;
-                wordMin = word;
-            }
-            /*  The last non-zero word contains the last actual bit of the set.
-                The location of this bit is used to compute the set length. */
-            wMax = index;
-            wordMax = word;
-            /*  Count the actual bits, so as to get the cardinality of the set. */
-            cardinality += Long.bitCount(word);
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  The XOR of level3 blocks is computed.
-     *
-     * 
-     * xor| 0 1
-     *   0| 0 1
-     *   1| 1 0 
-     */
-    protected static class XorStrategy extends AbstractStrategy
-    {
-        @Override
-        //  XorStrategy
-        protected int properties()
-        {
-            return F_OP_F_EQ_F + X_OP_F_EQ_X;
-        }
-
-        @Override
-        //  XorStrategy
-        protected boolean start(SparseBitSet b)
-        {
-            if (b == null)
-                throw new NullPointerException();
-            return true;
-        }
-
-        @Override
-        protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
-        {
-            return (a3[u3] ^= b3[u3] & mask) == 0;
-        }
-
-        @Override
-        //  XorStrategy
-        protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
-        {
-            boolean isZero = true; //  Presumption
-            for (int w3 = u3; w3 != v3; ++w3)
-                isZero &= (a3[w3] ^= b3[w3]) == 0;
-            return isZero;
-
-        }
-    }
-
-    //-----------------------------------------------------------------------------
-    /**
-     *  Word and block and strategy.
-     */
-    protected static final transient AndStrategy andStrategy = new AndStrategy();
-    /**
-     *  Word and block andNot strategy.
-     */
-    protected static final transient AndNotStrategy andNotStrategy = new AndNotStrategy();
-    /**
-     *  Word and block clear strategy.
-     */
-    protected static final transient ClearStrategy clearStrategy = new ClearStrategy();
-    /**
-     *  Word and block copy strategy.
-     */
-    protected static final transient CopyStrategy copyStrategy = new CopyStrategy();
-    /**
-     *  Word and block equals strategy.
-     */
-    protected transient EqualsStrategy equalsStrategy;
-    /**
-     *  Word and block flip strategy.
-     */
-    protected static final transient FlipStrategy flipStrategy = new FlipStrategy();
-    /**
-     *  Word and block intersects strategy.
-     */
-    protected static transient IntersectsStrategy intersectsStrategy = new IntersectsStrategy();
-    /**
-     *  Word and block or strategy.
-     */
-    protected static final transient OrStrategy orStrategy = new OrStrategy();
-    /**
-     *  Word and block set strategy.
-     */
-    protected static final transient SetStrategy setStrategy = new SetStrategy();
-    /**
-     *  Word and block update strategy.
-     */
-    protected transient UpdateStrategy updateStrategy;
-    /**
-     *  Word and block xor strategy.
-     */
-    protected static final transient XorStrategy xorStrategy = new XorStrategy();
-}
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBlockSet.java
deleted file mode 100644
index 72f86e51a..000000000
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SparseBlockSet.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.fastasyncworldedit.core.object.collection;
-
-import java.io.Serializable;
-
-public class SparseBlockSet implements Serializable {
-    private SparseBitSet[] sets;
-
-    public SparseBlockSet(int depth) {
-        sets = new SparseBitSet[depth];
-        for (int i = 0; i < sets.length; i++) {
-            sets[i] = new SparseBitSet();
-        }
-    }
-
-    public void setBlock(int index, int id) {
-        for (int i = 0; i < sets.length; i++) {
-            SparseBitSet set = sets[i];
-            if (((id >> i) & 1) == 1) {
-                set.set(index);
-            } else {
-                set.clear(index);
-            }
-        }
-    }
-
-    public int getBlock(int index) {
-        int id = 0;
-        for (int i = 0; i < sets.length; i++) {
-            SparseBitSet set = sets[i];
-            if (set.get(index)) {
-                id += 1 << i;
-            }
-        }
-        return id;
-    }
-}
\ No newline at end of file
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedAreaTable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedAreaTable.java
deleted file mode 100644
index a58108228..000000000
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedAreaTable.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.fastasyncworldedit.core.object.collection;
-
-import com.fastasyncworldedit.core.util.MathMan;
-
-public class SummedAreaTable {
-
-    private final char[] source;
-    private final long[] summed;
-    private final int length;
-    private final int width;
-    private final int area;
-    private final int radius;
-    private final float areaInverse;
-    private final float[] areaInverses;
-
-    public SummedAreaTable(long[] buffer, char[] matrix, int width, int radius) {
-        this.source = matrix;
-        this.summed = buffer;
-        this.width = width;
-        this.length = buffer.length / width;
-        this.radius = radius;
-        this.area = MathMan.sqr(radius * 2 + 1);
-        this.areaInverse = 1f / area;
-        this.areaInverses = new float[area - 2];
-        for (int area = 2; area < this.area; area++) {
-            this.areaInverses[area - 2] = 1f / area;
-        }
-    }
-
-    public void processSummedAreaTable() {
-        int rowSize = source.length / width;
-        int index = 0;
-        for (int i = 0; i < rowSize; i++) {
-            for (int j = 0; j < width; j++, index++) {
-                long val = getVal(i, j, index, source[index]);
-                summed[index] = val;
-            }
-        }
-    }
-
-    private long getSum(int index) {
-        if (index < 0) {
-            return 0;
-        }
-        return summed[index];
-    }
-
-    public int average(int x, int z, int index) {
-        int minX = Math.max(0, x - radius) - x;
-        int minZ = Math.max(0, z - radius) - z;
-        int maxX = Math.min(width - 1, x + radius) - x;
-        int maxZ = Math.min(length - 1, z + radius) - z;
-        int maxzwi = maxZ * width;
-        int XZ = index + maxzwi + maxX;
-        int area = (maxX - minX + 1) * (maxZ - minZ + 1);
-
-        long total = getSum(XZ);
-
-        int minzw = minZ * width;
-        int Z = index + minzw + maxX;
-        if (x > radius) {
-            int X = index + minX + maxzwi;
-            int M = index + minzw + minX;
-            total -= summed[X - 1];
-            total += getSum(M - width - 1);
-        }
-        total -= getSum(Z - width);
-        if (area == this.area) {
-            return (int) (total * areaInverse);
-        } else {
-            return Math.round(total * areaInverses[area - 2]);
-        }
-    }
-
-    private long getVal(int row, int col, int index, long curr) {
-        long leftSum;                    // sub matrix sum of left matrix
-        long topSum;                        // sub matrix sum of top matrix
-        long topLeftSum;                    // sub matrix sum of top left matrix
-        /* top left value is itself */
-        if (index == 0) {
-            return curr;
-        }
-        /* top row */
-        else if (row == 0 && col != 0) {
-            leftSum = summed[index - 1];
-            return curr + leftSum;
-        }
-        /* left-most column */
-        else if (row != 0 && col == 0) {
-            topSum = summed[index - width];
-            return curr + topSum;
-        } else {
-            leftSum = summed[index - 1];
-            topSum = summed[index - width];
-            topLeftSum = summed[index - width - 1]; // overlap between leftSum and topSum
-            return curr + leftSum + topSum - topLeftSum;
-        }
-    }
-}
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AsyncBufferedOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AsyncBufferedOutputStream.java
deleted file mode 100644
index 598cc0447..000000000
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/AsyncBufferedOutputStream.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package com.fastasyncworldedit.core.object.io;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.concurrent.ConcurrentLinkedDeque;
-
-/**
- * BufferedOutputStream that asynchronously flushes to disk, so callers don't
- * have to wait until the flush happens. Buffers are put into a queue that is
- * written asynchronously to disk once it is really available.
- *
- * 

- * The error handling (as all stream ops are done asynchronously) is done during - * write and close. Exceptions on the asynchronous thread will be thrown to the - * caller either while writing or closing this stream. - *

- * - * @apiNote This class is thread-safe. - * @author thomas.jungblut - */ -public final class AsyncBufferedOutputStream extends FilterOutputStream { - - private final FlushThread flusher = new FlushThread(); - private final Thread flusherThread = new Thread(flusher, "FlushThread"); - private final ConcurrentLinkedDeque buffers; - - private final byte[] buf; - private int count = 0; - - /** - * Creates an asynchronous buffered output stream with 8K buffer and 5 maximal - * buffers. - */ - public AsyncBufferedOutputStream(OutputStream out) { - this(out, 8 * 1024, 5); - } - - /** - * Creates an asynchronous buffered output stream with defined bufferSize and - * 5 maximal buffers. - */ - public AsyncBufferedOutputStream(OutputStream out, int bufSize) { - this(out, bufSize, 5); - } - - /** - * Creates an asynchronous buffered output stream. - * - * @param out the outputStream to layer on. - * @param bufSize the buffer size. - * @param maxBuffers the number of buffers to keep in parallel. - */ - public AsyncBufferedOutputStream(OutputStream out, int bufSize, int maxBuffers) { - super(out); - buffers = new ConcurrentLinkedDeque<>(); - buf = new byte[bufSize]; - flusherThread.start(); - } - - /** - * Writes the specified byte to this buffered output stream. - * - * @param b the byte to be written. - * @throws IOException if an I/O error occurs. - */ - @Override - public synchronized void write(int b) throws IOException { - flushBufferIfSizeLimitReached(); - throwOnFlusherError(); - buf[count++] = (byte) b; - } - - @Override - public void write(byte[] b) throws IOException { - write(b, 0, b.length); - } - - /** - * Writes len bytes from the specified byte array starting at - * offset off to this buffered output stream. - * - * @param b the data. - * @param off the start offset in the data. - * @param len the number of bytes to write. - * @throws IOException if an I/O error occurs. - */ - @Override - public synchronized void write(byte[] b, int off, int len) throws IOException { - if ((off | len | (b.length - (len + off)) | (off + len)) < 0) { - throw new IndexOutOfBoundsException(); - } - - int bytesWritten = 0; - while (bytesWritten < len) { - throwOnFlusherError(); - flushBufferIfSizeLimitReached(); - - int bytesToWrite = Math.min(len - bytesWritten, buf.length - count); - System.arraycopy(b, off + bytesWritten, buf, count, bytesToWrite); - count += bytesToWrite; - bytesWritten += bytesToWrite; - } - } - - /** - * Flushes this buffered output stream. It will enforce that the current - * buffer will be queue for asynchronous flushing no matter what size it has. - * - * @throws IOException if an I/O error occurs. - */ - @Override - public synchronized void flush() throws IOException { - forceFlush(); - } - - private void flushBufferIfSizeLimitReached() throws IOException { - if (count >= buf.length) { - forceFlush(); - } - } - - private void forceFlush() throws IOException { - if (count > 0) { - final byte[] copy = new byte[count]; - System.arraycopy(buf, 0, copy, 0, copy.length); - buffers.add(copy); - count = 0; - } - } - - @Override - public synchronized void close() throws IOException { - throwOnFlusherError(); - - forceFlush(); - flusher.closed = true; - - try { - flusherThread.interrupt(); - flusherThread.join(); - - throwOnFlusherError(); - } catch (InterruptedException e) { - // this is expected to happen - } finally { - out.close(); - } - } - - private void throwOnFlusherError() throws IOException { - if (flusher != null && flusher.errorHappened) { - throw new IOException("caught flusher to fail writing asynchronously!", - flusher.caughtException); - } - } - - class FlushThread implements Runnable { - - volatile boolean closed = false; - volatile boolean errorHappened = false; - volatile Exception caughtException; - - @Override - public void run() { - // run the real flushing action to the underlying stream - try { - while (!closed) { - byte[] take = buffers.poll(); - if (take != null) { - out.write(take); - } - } - } catch (Exception e) { - caughtException = e; - errorHappened = true; - // yield this thread, an error happened - return; - } - } - } - -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/BufferedRandomAccessFile.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/BufferedRandomAccessFile.java deleted file mode 100644 index 7d6ea9690..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/BufferedRandomAccessFile.java +++ /dev/null @@ -1,424 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.Arrays; - - -/** - * A {@code BufferedRandomAccessFile} is like a - * {@code RandomAccessFile}, but it uses a private buffer so that most - * operations do not require a disk access. - * - * @author Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com ) - * @apiNote The operations on this class are unmonitored. Also, the correct - * functioning of the {@code RandomAccessFile} methods that are not - * overridden here relies on the implementation of those methods in the superclass. - */ - -public class BufferedRandomAccessFile extends RandomAccessFile { - static final int LogBuffSz_ = 16; // 64K buffer - public static final int BuffSz_ = (1 << LogBuffSz_); - static final long BuffMask_ = ~(((long) BuffSz_) - 1L); - - /* - * This implementation is based on the buffer implementation in Modula-3's - * "Rd", "Wr", "RdClass", and "WrClass" interfaces. - */ - private boolean dirty_; // true iff unflushed bytes exist - private boolean closed_; // true iff the file is closed - private long curr_; // current position in file - private long lo_; // bounds on characters in "buff" - private long hi_; // bounds on characters in "buff" - private byte[] buff_; // local buffer - private long maxHi_; // this.lo + this.buff.length - private boolean hitEOF_; // buffer contains last file block? - private long diskPos_; // disk position - - /* - * To describe the above fields, we introduce the following abstractions for - * the file "f": - * - * len(f) the length of the file curr(f) the current position in the file - * c(f) the abstract contents of the file disk(f) the contents of f's - * backing disk file closed(f) true iff the file is closed - * - * "curr(f)" is an index in the closed interval [0, len(f)]. "c(f)" is a - * character sequence of length "len(f)". "c(f)" and "disk(f)" may differ if - * "c(f)" contains unflushed writes not reflected in "disk(f)". The flush - * operation has the effect of making "disk(f)" identical to "c(f)". - * - * A file is said to be *valid* if the following conditions hold: - * - * V1. The "closed" and "curr" fields are correct: - * - * f.closed == closed(f) f.curr == curr(f) - * - * V2. The current position is either contained in the buffer, or just past - * the buffer: - * - * f.lo <= f.curr <= f.hi - * - * V3. Any (possibly) unflushed characters are stored in "f.buff": - * - * (forall i in [f.lo, f.curr): c(f)[i] == f.buff[i - f.lo]) - * - * V4. For all characters not covered by V3, c(f) and disk(f) agree: - * - * (forall i in [f.lo, len(f)): i not in [f.lo, f.curr) => c(f)[i] == - * disk(f)[i]) - * - * V5. "f.dirty" is true iff the buffer contains bytes that should be - * flushed to the file; by V3 and V4, only part of the buffer can be dirty. - * - * f.dirty == (exists i in [f.lo, f.curr): c(f)[i] != f.buff[i - f.lo]) - * - * V6. this.maxHi == this.lo + this.buff.length - * - * Note that "f.buff" can be "null" in a valid file, since the range of - * characters in V3 is empty when "f.lo == f.curr". - * - * A file is said to be *ready* if the buffer contains the current position, - * i.e., when: - * - * R1. !f.closed && f.buff != null && f.lo <= f.curr && f.curr < f.hi - * - * When a file is ready, reading or writing a single byte can be performed - * by reading or writing the in-memory buffer without performing a disk - * operation. - */ - - /** - * Open a new {@code BufferedRandomAccessFile} on {@code file} - * in mode {@code mode}, which should be "r" for reading only, or - * "rw" for reading and writing. - */ - public BufferedRandomAccessFile(File file, String mode) throws IOException { - super(file, mode); - this.init(0); - } - - public BufferedRandomAccessFile(File file, String mode, int size) throws IOException { - super(file, mode); - this.init(size); - } - - /** - * Open a new {@code BufferedRandomAccessFile} on the file named - * {@code name} in mode {@code mode}, which should be "r" for - * reading only, or "rw" for reading and writing. - */ - public BufferedRandomAccessFile(String name, String mode) throws IOException { - super(name, mode); - this.init(0); - } - - public BufferedRandomAccessFile(String name, String mode, int size) throws FileNotFoundException { - super(name, mode); - this.init(size); - } - - public BufferedRandomAccessFile(File file, String mode, byte[] buf) throws FileNotFoundException { - super(file, mode); - this.dirty_ = this.closed_ = false; - this.lo_ = this.curr_ = this.hi_ = 0; - this.buff_ = buf; - this.maxHi_ = (long) BuffSz_; - this.hitEOF_ = false; - this.diskPos_ = 0L; - } - - private void init(int size) { - this.dirty_ = this.closed_ = false; - this.lo_ = this.curr_ = this.hi_ = 0; - this.buff_ = (size > BuffSz_) ? new byte[size] : new byte[BuffSz_]; - this.maxHi_ = (long) BuffSz_; - this.hitEOF_ = false; - this.diskPos_ = 0L; - } - - @Override - public void close() throws IOException { - this.flush(); - this.closed_ = true; - super.close(); - } - - /** - * Flush any bytes in the file's buffer that have not yet been written to - * disk. If the file was created read-only, this method is a no-op. - */ - public void flush() throws IOException { - this.flushBuffer(); - } - - /* Flush any dirty bytes in the buffer to disk. */ - private void flushBuffer() throws IOException { - if (this.dirty_) { - if (this.diskPos_ != this.lo_) { - super.seek(this.lo_); - } - int len = (int) (this.curr_ - this.lo_); - super.write(this.buff_, 0, len); - this.diskPos_ = this.curr_; - this.dirty_ = false; - } - } - - /* - * Read at most "this.buff.length" bytes into "this.buff", returning the - * number of bytes read. If the return result is less than - * "this.buff.length", then EOF was read. - */ - private int fillBuffer() throws IOException { - int cnt = 0; - int rem = this.buff_.length; - while (rem > 0) { - int n = super.read(this.buff_, cnt, rem); - if (n < 0) { - break; - } - cnt += n; - rem -= n; - } - if ((cnt < 0) && (this.hitEOF_ = (cnt < this.buff_.length))) { - // make sure buffer that wasn't read is initialized with -1 - Arrays.fill(this.buff_, cnt, this.buff_.length, (byte) 0xff); - } - this.diskPos_ += cnt; - return cnt; - } - - /* - * This method positions this.curr at position pos. - * If pos does not fall in the current buffer, it flushes the - * current buffer and loads the correct one.

- * - * On exit from this routine this.curr == this.hi iff pos - * is at or past the end-of-file, which can only happen if the file was - * opened in read-only mode. - */ - @Override - public void seek(long pos) throws IOException { - if (pos >= this.hi_ || pos < this.lo_) { - // seeking outside of current buffer -- flush and read - this.flushBuffer(); - this.lo_ = pos & BuffMask_; // start at BuffSz boundary - this.maxHi_ = this.lo_ + (long) this.buff_.length; - if (this.diskPos_ != this.lo_) { - super.seek(this.lo_); - this.diskPos_ = this.lo_; - } - int n = this.fillBuffer(); - this.hi_ = this.lo_ + (long) n; - } else { - // seeking inside current buffer -- no read required - if (pos < this.curr_) { - // if seeking backwards, we must flush to maintain V4 - this.flushBuffer(); - } - } - this.curr_ = pos; - } - - /* - * Does not maintain V4 (i.e. buffer differs from disk contents if previously written to) - * - Assumes no writes were made - * @param pos - * @throws IOException - */ - public void seekUnsafe(long pos) throws IOException { - if (pos >= this.hi_ || pos < this.lo_) { - // seeking outside of current buffer -- flush and read - this.flushBuffer(); - this.lo_ = pos & BuffMask_; // start at BuffSz boundary - this.maxHi_ = this.lo_ + (long) this.buff_.length; - if (this.diskPos_ != this.lo_) { - super.seek(this.lo_); - this.diskPos_ = this.lo_; - } - int n = this.fillBuffer(); - this.hi_ = this.lo_ + (long) n; - } - this.curr_ = pos; - } - - @Override - public long getFilePointer() { - return this.curr_; - } - - @Override - public long length() throws IOException { - return Math.max(this.curr_, super.length()); - } - - @Override - public int read() throws IOException { - if (this.curr_ >= this.hi_) { - // test for EOF - // if (this.hi < this.maxHi) return -1; - if (this.hitEOF_) { - return -1; - } - - // slow path -- read another buffer - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - return -1; - } - } - byte res = this.buff_[(int) (this.curr_ - this.lo_)]; - this.curr_++; - return ((int) res) & 0xFF; // convert byte -> int - } - - public byte read1() throws IOException { - if (this.curr_ >= this.hi_) { - // test for EOF - // if (this.hi < this.maxHi) return -1; - if (this.hitEOF_) { - return -1; - } - - // slow path -- read another buffer - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - return -1; - } - } - byte res = this.buff_[(int) (this.curr_ - this.lo_)]; - this.curr_++; - return res; - } - - @Override - public int read(byte[] b) throws IOException { - return this.read(b, 0, b.length); - } - - @Override - public int read(byte[] b, int off, int len) throws IOException { - if (this.curr_ >= this.hi_) { - // test for EOF - // if (this.hi < this.maxHi) return -1; - if (this.hitEOF_) { - return -1; - } - - // slow path -- read another buffer - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - return -1; - } - } - len = Math.min(len, (int) (this.hi_ - this.curr_)); - int buffOff = (int) (this.curr_ - this.lo_); - System.arraycopy(this.buff_, buffOff, b, off, len); - this.curr_ += len; - return len; - } - - public byte readCurrent() throws IOException { - if (this.curr_ >= this.hi_) { - // test for EOF - // if (this.hi < this.maxHi) return -1; - if (this.hitEOF_) { - return -1; - } - - // slow path -- read another buffer - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - return -1; - } - } - return this.buff_[(int) (this.curr_ - this.lo_)]; - } - - public void writeCurrent(byte b) throws IOException { - if (this.curr_ >= this.hi_) { - if (this.hitEOF_ && this.hi_ < this.maxHi_) { - // at EOF -- bump "hi" - this.hi_++; - } else { - // slow path -- write current buffer; read next one - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - // appending to EOF -- bump "hi" - this.hi_++; - } - } - } - this.buff_[(int) (this.curr_ - this.lo_)] = (byte) b; - this.dirty_ = true; - } - - public void writeUnsafe(int b) throws IOException { - this.buff_[(int) (this.curr_ - this.lo_)] = (byte) b; - this.curr_++; - this.dirty_ = true; - } - - @Override - public void write(int b) throws IOException { - if (this.curr_ >= this.hi_) { - if (this.hitEOF_ && this.hi_ < this.maxHi_) { - // at EOF -- bump "hi" - this.hi_++; - } else { - // slow path -- write current buffer; read next one - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - // appending to EOF -- bump "hi" - this.hi_++; - } - } - } - this.buff_[(int) (this.curr_ - this.lo_)] = (byte) b; - this.curr_++; - this.dirty_ = true; - } - - @Override - public void write(byte[] b) throws IOException { - this.write(b, 0, b.length); - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - while (len > 0) { - int n = this.writeAtMost(b, off, len); - off += n; - len -= n; - this.dirty_ = true; - } - } - - /* - * Write at most "len" bytes to "b" starting at position "off", and return - * the number of bytes written. - */ - private int writeAtMost(byte[] b, int off, int len) throws IOException { - if (this.curr_ >= this.hi_) { - if (this.hitEOF_ && this.hi_ < this.maxHi_) { - // at EOF -- bump "hi" - this.hi_ = this.maxHi_; - } else { - // slow path -- write current buffer; read next one - this.seek(this.curr_); - if (this.curr_ == this.hi_) { - // appending to EOF -- bump "hi" - this.hi_ = this.maxHi_; - } - } - } - len = Math.min(len, (int) (this.hi_ - this.curr_)); - int buffOff = (int) (this.curr_ - this.lo_); - System.arraycopy(b, off, this.buff_, buffOff, len); - this.curr_ += len; - return len; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayInputStream.java deleted file mode 100644 index 65b5bdfb2..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/FastByteArrayInputStream.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.InputStream; - -public class FastByteArrayInputStream extends InputStream { - public byte[] array; - public int offset; - public int length; - private int position; - private int mark; - - public FastByteArrayInputStream(byte[] array, int offset, int length) { - this.array = array; - this.offset = offset; - this.length = length; - } - - public FastByteArrayInputStream(byte[] array) { - this(array, 0, array.length); - } - - public boolean markSupported() { - return true; - } - - public void reset() { - this.position = this.mark; - } - - public void close() { - } - - public void mark(int dummy) { - this.mark = this.position; - } - - public int available() { - return this.length - this.position; - } - - public long skip(long n) { - if (n <= this.length - this.position) { - this.position += (int) n; - return n; - } - n = this.length - this.position; - this.position = this.length; - return n; - } - - public int read() { - if (this.length == this.position) { - return -1; - } - return this.array[(this.offset + this.position++)] & 0xFF; - } - - public int read(byte[] b, int offset, int length) { - if (this.length == this.position) { - return length == 0 ? 0 : -1; - } - int n = Math.min(length, this.length - this.position); - System.arraycopy(this.array, this.offset + this.position, b, offset, n); - this.position += n; - return n; - } - - public long position() { - return this.position; - } - - public void position(long newPosition) { - this.position = ((int) Math.min(newPosition, this.length)); - } - - public long length() { - return this.length; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonClosableOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonClosableOutputStream.java deleted file mode 100644 index 5cd937088..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/NonClosableOutputStream.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.IOException; -import java.io.OutputStream; - -public class NonClosableOutputStream extends AbstractDelegateOutputStream { - - public NonClosableOutputStream(OutputStream os) { - super(os); - } - - @Override - public void close() throws IOException { - // Do nothing - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPBlock.java deleted file mode 100644 index 87cb915a5..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPBlock.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.util.concurrent.Callable; - -public class PGZIPBlock implements Callable { - public PGZIPBlock(final PGZIPOutputStream parent) { - STATE = new PGZIPThreadLocal(parent); - } - - /** - * This ThreadLocal avoids the recycling of a lot of memory, causing lumpy performance. - */ - protected final ThreadLocal STATE; - public static final int SIZE = 64 * 1024; - // private final int index; - protected final byte[] in = new byte[SIZE]; - protected int in_length = 0; - - /* - public Block(@Nonnegative int index) { - this.index = index; - } - */ - // Only on worker thread - @Override - public byte[] call() throws Exception { - // LOG.info("Processing " + this + " on " + Thread.currentThread()); - - PGZIPState state = STATE.get(); - // ByteArrayOutputStream buf = new ByteArrayOutputStream(in.length); // Overestimate output size required. - // DeflaterOutputStream def = newDeflaterOutputStream(buf); - state.def.reset(); - state.buf.reset(); - state.str.write(in, 0, in_length); - state.str.flush(); - - // return Arrays.copyOf(in, in_length); - return state.buf.toByteArray(); - } - - @Override - public String toString() { - return "Block" /* + index */ + "(" + in_length + "/" + in.length + " bytes)"; - } -} \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPOutputStream.java deleted file mode 100644 index 0bb398e97..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPOutputStream.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InterruptedIOException; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.zip.CRC32; -import java.util.zip.Deflater; -import java.util.zip.DeflaterOutputStream; -import java.util.zip.GZIPOutputStream; -import javax.annotation.Nonnegative; -import javax.annotation.Nonnull; - -/** - * A multi-threaded version of {@link GZIPOutputStream}. - * - * @author shevek - */ -public class PGZIPOutputStream extends FilterOutputStream { - - private static final ExecutorService EXECUTOR = Executors.newCachedThreadPool(); - - public static ExecutorService getSharedThreadPool() { - return EXECUTOR; - } - - - // private static final Logger LOG = LoggerFactory.getLogger(PGZIPOutputStream.class); - private static final int GZIP_MAGIC = 0x8b1f; - - // todo: remove after block guessing is implemented - // array list that contains the block sizes - ArrayList blockSizes = new ArrayList<>(); - - private int level = Deflater.DEFAULT_COMPRESSION; - private int strategy = Deflater.DEFAULT_STRATEGY; - - @Nonnull - protected Deflater newDeflater() { - Deflater def = new Deflater(level, true); - def.setStrategy(strategy); - return def; - } - - public void setStrategy(int strategy) { - this.strategy = strategy; - } - - public void setLevel(int level) { - this.level = level; - } - - @Nonnull - protected static DeflaterOutputStream newDeflaterOutputStream(@Nonnull OutputStream out, @Nonnull Deflater deflater) { - return new DeflaterOutputStream(out, deflater, 512, true); - } - - // TODO: Share, daemonize. - private final ExecutorService executor; - private final int nthreads; - private final CRC32 crc = new CRC32(); - private final BlockingQueue> emitQueue; - private PGZIPBlock block = new PGZIPBlock(this/* 0 */); - /** - * Used as a sentinel for 'closed'. - */ - private int bytesWritten = 0; - - // Master thread only - public PGZIPOutputStream(@Nonnull OutputStream out, @Nonnull ExecutorService executor, @Nonnegative int nthreads) throws IOException { - super(out); - this.executor = executor; - this.nthreads = nthreads; - this.emitQueue = new ArrayBlockingQueue<>(nthreads); - writeHeader(); - } - - /** - * Creates a PGZIPOutputStream - * using {@link PGZIPOutputStream#getSharedThreadPool()}. - * - * @param out the eventual output stream for the compressed data. - * @throws IOException if it all goes wrong. - */ - public PGZIPOutputStream(@Nonnull OutputStream out, @Nonnegative int nthreads) throws IOException { - this(out, PGZIPOutputStream.getSharedThreadPool(), nthreads); - } - - /** - * Creates a PGZIPOutputStream - * using {@link PGZIPOutputStream#getSharedThreadPool()} - * and {@link Runtime#availableProcessors()}. - * - * @param out the eventual output stream for the compressed data. - * @throws IOException if it all goes wrong. - */ - public PGZIPOutputStream(@Nonnull OutputStream out) throws IOException { - this(out, Runtime.getRuntime().availableProcessors()); - } - - /* - * @see http://www.gzip.org/zlib/rfc-gzip.html#file-format - */ - private void writeHeader() throws IOException { - out.write(new byte[]{ - (byte) GZIP_MAGIC, // ID1: Magic number (little-endian short) - (byte) (GZIP_MAGIC >> 8), // ID2: Magic number (little-endian short) - Deflater.DEFLATED, // CM: Compression method - 0, // FLG: Flags (byte) - 0, 0, 0, 0, // MTIME: Modification time (int) - 0, // XFL: Extra flags - 3 // OS: Operating system (3 = Linux) - }); - } - - // Master thread only - @Override - public void write(int b) throws IOException { - byte[] single = new byte[1]; - single[0] = (byte) (b & 0xFF); - write(single); - } - - // Master thread only - @Override - public void write(@Nonnull byte[] b) throws IOException { - write(b, 0, b.length); - } - - // Master thread only - @Override - public void write(@Nonnull byte[] b, int off, int len) throws IOException { - crc.update(b, off, len); - bytesWritten += len; - while (len > 0) { - // assert block.in_length < block.in.length - int capacity = block.in.length - block.in_length; - if (len >= capacity) { - System.arraycopy(b, off, block.in, block.in_length, capacity); - block.in_length += capacity; // == block.in.length - off += capacity; - len -= capacity; - submit(); - } else { - System.arraycopy(b, off, block.in, block.in_length, len); - block.in_length += len; - // off += len; - // len = 0; - break; - } - } - } - - // Master thread only - private void submit() throws IOException { - emitUntil(nthreads - 1); - emitQueue.add(executor.submit(block)); - block = new PGZIPBlock(this/* block.index + 1 */); - } - - // Emit If Available - submit always - // Emit At Least one - submit when executor is full - // Emit All Remaining - flush(), close() - // Master thread only - private void tryEmit() throws IOException, InterruptedException, ExecutionException { - for (; ; ) { - Future future = emitQueue.peek(); - // LOG.info("Peeked future " + future); - if (future == null) { - return; - } - if (!future.isDone()) { - return; - } - // It's an ordered queue. This MUST be the same element as above. - emitQueue.remove(); - byte[] toWrite = future.get(); - blockSizes.add(toWrite.length); // todo: remove after block guessing is implemented - out.write(toWrite); - } - } - - // Master thread only - - /** - * Emits any opportunistically available blocks. Furthermore, emits blocks until the number of executing tasks is less than taskCountAllowed. - */ - private void emitUntil(@Nonnegative int taskCountAllowed) throws IOException { - try { - while (emitQueue.size() > taskCountAllowed) { - // LOG.info("Waiting for taskCount=" + emitQueue.size() + " -> " + taskCountAllowed); - Future future = emitQueue.remove(); // Valid because emitQueue.size() > 0 - byte[] toWrite = future.get(); // Blocks until this task is done. - blockSizes.add(toWrite.length); // todo: remove after block guessing is implemented - out.write(toWrite); - } - // We may have achieved more opportunistically available blocks - // while waiting for a block above. Let's emit them here. - tryEmit(); - } catch (ExecutionException e) { - throw new IOException(e); - } catch (InterruptedException e) { - throw new InterruptedIOException(); - } - } - - // Master thread only - @Override - public void flush() throws IOException { - // LOG.info("Flush: " + block); - if (block.in_length > 0) { - submit(); - } - emitUntil(0); - super.flush(); - } - - // Master thread only - @Override - public void close() throws IOException { - // LOG.info("Closing: bytesWritten=" + bytesWritten); - if (bytesWritten >= 0) { - flush(); - - newDeflaterOutputStream(out, newDeflater()).finish(); - - ByteBuffer buf = ByteBuffer.allocate(8); - buf.order(ByteOrder.LITTLE_ENDIAN); - // LOG.info("CRC is " + crc.getValue()); - buf.putInt((int) crc.getValue()); - buf.putInt(bytesWritten); - out.write(buf.array()); // allocate() guarantees a backing array. - // LOG.info("trailer is " + Arrays.toString(buf.array())); - - out.flush(); - out.close(); - - bytesWritten = Integer.MIN_VALUE; - // } else { - // LOG.warn("Already closed."); - } - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPState.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPState.java deleted file mode 100644 index eef34628d..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPState.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.ByteArrayOutputStream; -import java.util.zip.Deflater; -import java.util.zip.DeflaterOutputStream; - -public class PGZIPState { - protected final DeflaterOutputStream str; - protected final ByteArrayOutputStream buf; - protected final Deflater def; - - public PGZIPState(PGZIPOutputStream parent) { - this.def = parent.newDeflater(); - this.buf = new ByteArrayOutputStream(PGZIPBlock.SIZE); - this.str = parent.newDeflaterOutputStream(buf, def); - } - - -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPThreadLocal.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPThreadLocal.java deleted file mode 100644 index 20937cdb3..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/PGZIPThreadLocal.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -public class PGZIPThreadLocal extends ThreadLocal { - - private final PGZIPOutputStream parent; - - public PGZIPThreadLocal(PGZIPOutputStream parent) { - this.parent = parent; - } - - @Override - protected PGZIPState initialValue() { - return new PGZIPState(parent); - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomAccessInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomAccessInputStream.java deleted file mode 100644 index 8dd7586a4..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomAccessInputStream.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.IOException; -import java.io.InputStream; -import java.io.RandomAccessFile; - -public class RandomAccessInputStream extends InputStream { - private final RandomAccessFile raf; - - public RandomAccessInputStream(RandomAccessFile raf) { - this.raf = raf; - } - - @Override - public int read() throws IOException { - return raf.read(); - } - - @Override - public int read(byte[] b, int off, int len) throws IOException { - return raf.read(b, off, len); - } - - @Override - public int read(byte[] b) throws IOException { - return raf.read(b); - } - - @Override - public int available() throws IOException { - return (int) (raf.length() - raf.getFilePointer()); - } - - @Override - public void close() throws IOException { - raf.close(); - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomFileOutputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomFileOutputStream.java deleted file mode 100644 index db7d24369..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/RandomFileOutputStream.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.fastasyncworldedit.core.object.io; - -import java.io.File; -import java.io.FileDescriptor; -import java.io.IOException; -import java.io.OutputStream; -import java.io.RandomAccessFile; - -/** - * A positionable file output stream. - *

- * Threading Design : [x] Single Threaded [ ] Threadsafe [ ] Immutable [ ] Isolated - */ - -public class RandomFileOutputStream extends OutputStream { - -// ***************************************************************************** -// INSTANCE PROPERTIES -// ***************************************************************************** - - protected RandomAccessFile randomFile; // the random file to write to - protected boolean sync; // whether to synchronize every write - protected boolean closeParent; - -// ***************************************************************************** -// INSTANCE CONSTRUCTION/INITIALIZATION/FINALIZATION, OPEN/CLOSE -// ***************************************************************************** - - public RandomFileOutputStream(String fnm) throws IOException { - this(fnm, false); - } - - public RandomFileOutputStream(String fnm, boolean syn) throws IOException { - this(new File(fnm), syn); - } - - public RandomFileOutputStream(File fil) throws IOException { - this(fil, false); - } - - public RandomFileOutputStream(File fil, boolean syn) throws IOException { - super(); - - File par; // parent file - - fil = fil.getAbsoluteFile(); - if ((par = fil.getParentFile()) != null) { - par.mkdirs(); - } - randomFile = new RandomAccessFile(fil, "rw"); - sync = syn; - this.closeParent = true; - } - - public RandomFileOutputStream(RandomAccessFile randomFile, boolean syn, boolean closeParent) { - super(); - this.randomFile = randomFile; - sync = syn; - this.closeParent = closeParent; - } - -// ***************************************************************************** -// INSTANCE METHODS - OUTPUT STREAM IMPLEMENTATION -// ***************************************************************************** - - @Override - public void write(int val) throws IOException { - randomFile.write(val); - if (sync) { - randomFile.getFD().sync(); - } - } - - @Override - public void write(byte[] val) throws IOException { - randomFile.write(val); - if (sync) { - randomFile.getFD().sync(); - } - } - - @Override - public void write(byte[] val, int off, int len) throws IOException { - randomFile.write(val, off, len); - if (sync) { - randomFile.getFD().sync(); - } - } - - @Override - public void flush() throws IOException { - if (sync) { - randomFile.getFD().sync(); - } - } - - @Override - public void close() throws IOException { - if (closeParent) { - randomFile.close(); - } - } - -// ***************************************************************************** -// INSTANCE METHODS - RANDOM ACCESS EXTENSIONS -// ***************************************************************************** - - public long getFilePointer() throws IOException { - return randomFile.getFilePointer(); - } - - public void setFilePointer(long pos) throws IOException { - randomFile.seek(pos); - } - - public long getFileSize() throws IOException { - return randomFile.length(); - } - - public void setFileSize(long len) throws IOException { - randomFile.setLength(len); - } - - public FileDescriptor getFD() throws IOException { - return randomFile.getFD(); - } - -} // END PUBLIC CLASS diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/serialize/Serialize.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/serialize/Serialize.java deleted file mode 100644 index 23098f8d6..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/serialize/Serialize.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fastasyncworldedit.core.object.io.serialize; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD}) -public @interface Serialize { - -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/zstd/ZstdInputStream.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/zstd/ZstdInputStream.java deleted file mode 100644 index e3b06b6ab..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/io/zstd/ZstdInputStream.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.fastasyncworldedit.core.object.io.zstd; - -import com.github.luben.zstd.Zstd; -import com.github.luben.zstd.util.Native; - -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * InputStream filter that decompresses the data provided - * by the underlying InputStream using Zstd compression. - * - *

- * It does not support mark/reset methods - *

- */ - -public class ZstdInputStream extends FilterInputStream { - - static { - Native.load(); - } - - // Opaque pointer to Zstd context object - private long stream; - private long dstPos = 0; - private long srcPos = 0; - private long srcSize = 0; - private byte[] src = null; - private static final int srcBuffSize = (int) recommendedDInSize(); - - private boolean isContinuous = false; - private boolean frameFinished = false; - private boolean isClosed = false; - - /* JNI methods */ - private static native long recommendedDInSize(); - - private static native long recommendedDOutSize(); - - private static native long createDStream(); - - private static native int freeDStream(long stream); - - private native int initDStream(long stream); - - private native int decompressStream(long stream, byte[] dst, int dst_size, byte[] src, int src_size); - - // The main constructor / legacy version dispatcher - public ZstdInputStream(InputStream inStream) throws IOException { - // FilterInputStream constructor - super(inStream); - - // allocate input buffer with max frame header size - src = new byte[srcBuffSize]; - stream = createDStream(); - int size = initDStream(stream); - if (Zstd.isError(size)) { - throw new IOException("Decompression error: " + Zstd.getErrorName(size)); - } - } - - /** - * Don't break on unfinished frames. - * - *

- * Use case: decompressing files that are not yet finished writing and compressing. - *

- */ - public ZstdInputStream setContinuous(boolean b) { - isContinuous = b; - return this; - } - - public boolean getContinuous() { - return this.isContinuous; - } - - public int read(byte[] dst, int offset, int len) throws IOException { - - if (isClosed) { - throw new IOException("Stream closed"); - } - - // guard against buffer overflows - if (offset < 0 || len > dst.length - offset) { - throw new IndexOutOfBoundsException( - "Requested length " + len + " from offset " + offset + " in buffer of size " - + dst.length); - } - int dstSize = offset + len; - dstPos = offset; - - while (dstPos < dstSize) { - if (srcSize - srcPos == 0) { - srcSize = in.read(src, 0, srcBuffSize); - srcPos = 0; - if (srcSize < 0) { - srcSize = 0; - if (frameFinished) { - return -1; - } else if (isContinuous) { - return (int) (dstPos - offset); - } else { - throw new IOException("Read error or truncated source"); - } - } - frameFinished = false; - } - - int size = decompressStream(stream, dst, dstSize, src, (int) srcSize); - - if (Zstd.isError(size)) { - throw new IOException("Decompression error: " + Zstd.getErrorName(size)); - } - - // we have completed a frame - if (size == 0) { - frameFinished = true; - // re-init the codec so it can start decoding next frame - size = initDStream(stream); - if (Zstd.isError(size)) { - throw new IOException("Decompression error: " + Zstd.getErrorName(size)); - } - return (int) (dstPos - offset); - } - } - return len; - } - - public int read() throws IOException { - byte[] oneByte = new byte[1]; - int result = read(oneByte, 0, 1); - if (result > 0) { - return oneByte[0] & 0xff; - } else { - return result; - } - } - - public int available() throws IOException { - if (isClosed) { - throw new IOException("Stream closed"); - } - if (srcSize - srcPos > 0) { - return 1; - } else { - return 0; - } - } - - /* we don't support mark/reset */ - public boolean markSupported() { - return false; - } - - /* we can skip forward */ - public long skip(long toSkip) throws IOException { - if (isClosed) { - throw new IOException("Stream closed"); - } - long skipped = 0; - int dstSize = (int) recommendedDOutSize(); - byte[] dst = new byte[dstSize]; - while (toSkip > dstSize) { - long size = read(dst, 0, dstSize); - toSkip -= size; - skipped += size; - } - skipped += read(dst, 0, (int) toSkip); - return skipped; - } - - public void close() throws IOException { - if (isClosed) { - return; - } - freeDStream(stream); - in.close(); - isClosed = true; - } -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Filter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Filter.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Filter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Filter.java index f09d512ca..b004b0dbb 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Filter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Filter.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.regions.Region; import org.jetbrains.annotations.Range; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/FilterBlockMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/FilterBlockMask.java new file mode 100644 index 000000000..e368772b1 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/FilterBlockMask.java @@ -0,0 +1,8 @@ +package com.fastasyncworldedit.core.queue; + +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; + +public interface FilterBlockMask { + + boolean applyBlock(FilterBlock block); +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java similarity index 93% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBatchProcessor.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java index 2c594aa53..47f49bc15 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.implementation.processors.EmptyBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.processors.MultiBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.extent.processor.EmptyBatchProcessor; +import com.fastasyncworldedit.core.extent.processor.MultiBatchProcessor; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBlocks.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBlocks.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBlocks.java index c7b4cab42..c4be33f94 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBlocks.java @@ -1,14 +1,14 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.block.BlockID; +import com.fastasyncworldedit.core.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.registry.BlockRegistry; import org.jetbrains.annotations.Range; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunk.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunk.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunk.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunk.java index 68327fe8d..b3cf77d28 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunk.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunk.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; import com.sk89q.worldedit.regions.Region; import org.jetbrains.annotations.Range; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkCache.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkCache.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkCache.java index 853b38a99..0deaf065e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkCache.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; import org.jetbrains.annotations.Range; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/IChunkExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java index cb59f2687..6e6b8afb0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/IChunkExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta.implementation; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.IChunk; +import com.fastasyncworldedit.core.queue.IChunk; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.DoubleTag; import com.sk89q.jnbt.IntArrayTag; @@ -102,9 +102,9 @@ public interface IChunkExtent extends Extent { } @Override - default int getEmmittedLight(int x, int y, int z) { + default int getEmittedLight(int x, int y, int z) { final IChunk chunk = getOrCreateChunk(x >> 4, z >> 4); - return chunk.getEmmittedLight(x & 15, y, z & 15); + return chunk.getEmittedLight(x & 15, y, z & 15); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkGet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java similarity index 89% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkGet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java index 7bab053a5..5e63f0e66 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkGet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkGet.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.InputExtent; import com.sk89q.worldedit.math.BlockVector3; @@ -35,7 +35,7 @@ public interface IChunkGet extends IBlocks, Trimable, InputExtent, ITileInput { int getSkyLight(int x, int y, int z); @Override - int getEmmittedLight(int x, int y, int z); + int getEmittedLight(int x, int y, int z); @Override int[] getHeightMap(HeightMapType type); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java index 9f3daa079..486402167 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IChunkSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.OutputExtent; import com.sk89q.worldedit.function.operation.Operation; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IDelegateFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IDelegateFilter.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IDelegateFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IDelegateFilter.java index 5cc29e1cc..378c9eae8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IDelegateFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IDelegateFilter.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.regions.Region; import javax.annotation.Nullable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueChunk.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueChunk.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueChunk.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueChunk.java index 69530c3ff..d1cec6d25 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueChunk.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueChunk.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java index cc6d5b75d..9f13a97a6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueExtent.java @@ -1,8 +1,7 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; -import com.fastasyncworldedit.core.beta.implementation.IChunkExtent; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.IBatchProcessorHolder; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.IBatchProcessorHolder; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.math.BlockVector2; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java similarity index 77% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueWrapper.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java index c3c5b3afa..4c378d1c9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/IQueueWrapper.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IQueueWrapper.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; public interface IQueueWrapper { default IQueueExtent wrapQueue(IQueueExtent queue) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/ITileInput.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/ITileInput.java similarity index 72% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/ITileInput.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/ITileInput.java index 072f3b26c..f0f176cd0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/ITileInput.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/ITileInput.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/Pool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Pool.java similarity index 71% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/Pool.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Pool.java index 54ac41e1b..d51065607 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/Pool.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Pool.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.queue; +package com.fastasyncworldedit.core.queue; @FunctionalInterface public interface Pool { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Trimable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Trimable.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Trimable.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Trimable.java index 3ec305325..c29206c8c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Trimable.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/Trimable.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue; /** * Interface for objects that can be trimmed (memory related). Trimming will reduce its memory diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Flood.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/Flood.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Flood.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/Flood.java index 1665c310b..3d84dfa32 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/Flood.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/Flood.java @@ -1,7 +1,9 @@ -package com.fastasyncworldedit.core.beta; +package com.fastasyncworldedit.core.queue.implementation; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.World; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/ParallelQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/ParallelQueueExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java index eacb72f81..49bc8279b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/ParallelQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java @@ -1,23 +1,23 @@ -package com.fastasyncworldedit.core.beta.implementation.queue; +package com.fastasyncworldedit.core.queue.implementation; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.IQueueWrapper; -import com.fastasyncworldedit.core.beta.implementation.filter.CountFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.DistrFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.LinkedFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.BatchProcessorHolder; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.queue.IQueueWrapper; +import com.fastasyncworldedit.core.extent.filter.CountFilter; +import com.fastasyncworldedit.core.extent.filter.DistrFilter; +import com.fastasyncworldedit.core.extent.filter.LinkedFilter; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.BatchProcessorHolder; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.clipboard.WorldCopyClipboard; -import com.fastasyncworldedit.core.object.extent.NullExtent; +import com.fastasyncworldedit.core.extent.clipboard.WorldCopyClipboard; +import com.fastasyncworldedit.core.extent.NullExtent; import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.extent.PassthroughExtent; +import com.fastasyncworldedit.core.extent.PassthroughExtent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.BlockMask; -import com.sk89q.worldedit.function.mask.BlockMaskBuilder; +import com.fastasyncworldedit.core.function.mask.BlockMaskBuilder; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.BlockPattern; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueueHandler.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index 883c192f4..a78fff960 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -1,17 +1,17 @@ -package com.fastasyncworldedit.core.beta.implementation.queue; +package com.fastasyncworldedit.core.queue.implementation; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunkCache; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.Trimable; -import com.fastasyncworldedit.core.beta.implementation.chunk.ChunkCache; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.queue.Trimable; +import com.fastasyncworldedit.core.queue.implementation.chunk.ChunkCache; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.collection.CleanableThreadLocal; +import com.fastasyncworldedit.core.util.collection.CleanableThreadLocal; import com.fastasyncworldedit.core.util.MemUtil; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.wrappers.WorldWrapper; @@ -39,9 +39,9 @@ import java.util.function.Supplier; @SuppressWarnings("UnstableApiUsage") public abstract class QueueHandler implements Trimable, Runnable { - private ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool(); - private ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool(); - private ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor(); + private final ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool(); + private final ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool(); + private final ThreadPoolExecutor blockingExecutor = FaweCache.IMP.newBlockingExecutor(); private final ConcurrentLinkedQueue syncTasks = new ConcurrentLinkedQueue<>(); private final ConcurrentLinkedQueue syncWhenFree = new ConcurrentLinkedQueue<>(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueuePool.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueuePool.java similarity index 84% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueuePool.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueuePool.java index dc8a8e137..58b522d84 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/QueuePool.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueuePool.java @@ -1,4 +1,6 @@ -package com.fastasyncworldedit.core.beta.implementation.queue; +package com.fastasyncworldedit.core.queue.implementation; + +import com.fastasyncworldedit.core.queue.Pool; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.function.Supplier; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/SingleThreadQueueExtent.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java index e29804433..ae4cff434 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/queue/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java @@ -1,22 +1,22 @@ -package com.fastasyncworldedit.core.beta.implementation.queue; +package com.fastasyncworldedit.core.queue.implementation; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkCache; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.blocks.CharSetBlocks; -import com.fastasyncworldedit.core.beta.implementation.chunk.ChunkHolder; -import com.fastasyncworldedit.core.beta.implementation.chunk.NullChunk; -import com.fastasyncworldedit.core.beta.implementation.filter.block.CharFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.EmptyBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.processors.ExtentBatchProcessorHolder; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.queue.implementation.blocks.CharSetBlocks; +import com.fastasyncworldedit.core.queue.implementation.chunk.ChunkHolder; +import com.fastasyncworldedit.core.queue.implementation.chunk.NullChunk; +import com.fastasyncworldedit.core.extent.filter.block.CharFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.EmptyBatchProcessor; +import com.fastasyncworldedit.core.extent.processor.ExtentBatchProcessorHolder; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.MemUtil; import com.google.common.util.concurrent.Futures; @@ -50,7 +50,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen private boolean initialized; private Thread currentThread; - private ConcurrentLinkedQueue submissions = new ConcurrentLinkedQueue<>(); + private final ConcurrentLinkedQueue submissions = new ConcurrentLinkedQueue<>(); // Last access pointers private IQueueChunk lastChunk; private long lastPair = Long.MAX_VALUE; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/BitSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/BitSetBlocks.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/BitSetBlocks.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/BitSetBlocks.java index 3fe78b462..cde827222 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/BitSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/BitSetBlocks.java @@ -1,9 +1,9 @@ -package com.fastasyncworldedit.core.beta.implementation.blocks; +package com.fastasyncworldedit.core.queue.implementation.blocks; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; -import com.fastasyncworldedit.core.object.collection.MemBlockSet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.util.collection.MemBlockSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharBlocks.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharBlocks.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharBlocks.java index 8793a6e89..45adbe2d8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharBlocks.java @@ -1,8 +1,8 @@ -package com.fastasyncworldedit.core.beta.implementation.blocks; +package com.fastasyncworldedit.core.queue.implementation.blocks; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.IBlocks; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharGetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharGetBlocks.java similarity index 87% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharGetBlocks.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharGetBlocks.java index 6647e6f3c..10fb2039a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharGetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharGetBlocks.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.blocks; +package com.fastasyncworldedit.core.queue.implementation.blocks; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharSetBlocks.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java index ed2d29776..00fa1c3f7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/CharSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java @@ -1,11 +1,11 @@ -package com.fastasyncworldedit.core.beta.implementation.blocks; +package com.fastasyncworldedit.core.queue.implementation.blocks; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; -import com.fastasyncworldedit.core.beta.implementation.queue.Pool; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.queue.Pool; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.collection.BlockVector3ChunkMap; +import com.fastasyncworldedit.core.math.BlockVector3ChunkMap; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/NullChunkGet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/NullChunkGet.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/NullChunkGet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/NullChunkGet.java index 887cc0b50..f140c973e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/blocks/NullChunkGet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/NullChunkGet.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.blocks; +package com.fastasyncworldedit.core.queue.implementation.blocks; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBlocks; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; @@ -103,7 +103,7 @@ public final class NullChunkGet implements IChunkGet { return false; } - public int getEmmittedLight(int x, int y, int z) { + public int getEmittedLight(int x, int y, int z) { return 15; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkCache.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkCache.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkCache.java index 77278e482..7ab7d7a7f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkCache.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.chunk; +package com.fastasyncworldedit.core.queue.implementation.chunk; -import com.fastasyncworldedit.core.beta.IChunkCache; -import com.fastasyncworldedit.core.beta.Trimable; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.Trimable; import com.fastasyncworldedit.core.util.MathMan; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkHolder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java index f1d231266..cd88e40db 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java @@ -1,16 +1,16 @@ -package com.fastasyncworldedit.core.beta.implementation.chunk; +package com.fastasyncworldedit.core.queue.implementation.chunk; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; -import com.fastasyncworldedit.core.beta.implementation.processors.EmptyBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.queue.Pool; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.EmptyBatchProcessor; +import com.fastasyncworldedit.core.queue.Pool; import com.fastasyncworldedit.core.configuration.Settings; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector3; @@ -262,7 +262,7 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public int getEmmittedLight(ChunkHolder chunk, int x, int y, int z) { + public int getEmittedLight(ChunkHolder chunk, int x, int y, int z) { if (chunk.chunkSet.getLight() != null) { int layer = y >> 4; if (chunk.chunkSet.getLight()[layer] != null) { @@ -272,7 +272,7 @@ public class ChunkHolder> implements IQueueChunk { } } } - return chunk.chunkExisting.getEmmittedLight(x, y, z); + return chunk.chunkExisting.getEmittedLight(x, y, z); } @Override @@ -410,8 +410,8 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public int getEmmittedLight(ChunkHolder chunk, int x, int y, int z) { - return chunk.chunkExisting.getEmmittedLight(x, y, z); + public int getEmittedLight(ChunkHolder chunk, int x, int y, int z) { + return chunk.chunkExisting.getEmittedLight(x, y, z); } @Override @@ -553,7 +553,7 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public int getEmmittedLight(ChunkHolder chunk, int x, int y, int z) { + public int getEmittedLight(ChunkHolder chunk, int x, int y, int z) { if (chunk.chunkSet.getLight() != null) { int layer = y >> 4; if (chunk.chunkSet.getLight()[layer] != null) { @@ -566,7 +566,7 @@ public class ChunkHolder> implements IQueueChunk { chunk.getOrCreateGet(); chunk.delegate = BOTH; chunk.chunkExisting.trim(false); - return chunk.getEmmittedLight(x, y, z); + return chunk.getEmittedLight(x, y, z); } @Override @@ -739,11 +739,11 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public int getEmmittedLight(ChunkHolder chunk, int x, int y, int z) { + public int getEmittedLight(ChunkHolder chunk, int x, int y, int z) { chunk.getOrCreateGet(); chunk.delegate = GET; chunk.chunkExisting.trim(false); - return chunk.getEmmittedLight(x, y, z); + return chunk.getEmittedLight(x, y, z); } @Override @@ -1024,8 +1024,8 @@ public class ChunkHolder> implements IQueueChunk { } @Override - public int getEmmittedLight(int x, int y, int z) { - return delegate.getEmmittedLight(this, x, y, z); + public int getEmittedLight(int x, int y, int z) { + return delegate.getEmittedLight(this, x, y, z); } @Override @@ -1073,7 +1073,7 @@ public class ChunkHolder> implements IQueueChunk { int getSkyLight(ChunkHolder chunk, int x, int y, int z); - int getEmmittedLight(ChunkHolder chunk, int x, int y, int z); + int getEmittedLight(ChunkHolder chunk, int x, int y, int z); int getBrightness(ChunkHolder chunk, int x, int y, int z); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/NullChunk.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/NullChunk.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/NullChunk.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/NullChunk.java index 0b33ed4bc..f340c7e3b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/chunk/NullChunk.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/NullChunk.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.chunk; +package com.fastasyncworldedit.core.queue.implementation.chunk; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; @@ -86,7 +86,7 @@ public final class NullChunk implements IQueueChunk { return new int[256]; } - public int getEmmittedLight(int x, int y, int z) { + public int getEmittedLight(int x, int y, int z) { return 15; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/packet/ChunkPacket.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/packet/ChunkPacket.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/packet/ChunkPacket.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/packet/ChunkPacket.java index a93c43d6b..240209771 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/packet/ChunkPacket.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/packet/ChunkPacket.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.beta.implementation.packet; +package com.fastasyncworldedit.core.queue.implementation.packet; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IBlocks; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.sk89q.jnbt.CompoundTag; import java.util.HashMap; @@ -91,9 +91,8 @@ public class ChunkPacket implements Function, Supplier { public CompoundTag getHeightMap() { HashMap map = new HashMap<>(); map.put("MOTION_BLOCKING", new long[36]); - CompoundTag tag = FaweCache.IMP.asTag(map); // TODO - return tag; + return FaweCache.IMP.asTag(map); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/AsyncPreloader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/AsyncPreloader.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java index 24a1a4007..1aff92e46 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/AsyncPreloader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.beta.implementation.preloader; +package com.fastasyncworldedit.core.queue.implementation.preloader; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.object.collection.MutablePair; +import com.fastasyncworldedit.core.util.collection.MutablePair; import com.fastasyncworldedit.core.util.FaweTimer; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/Preloader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/Preloader.java similarity index 67% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/Preloader.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/Preloader.java index 7fbc4ab65..da6846c41 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/beta/implementation/preloader/Preloader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/Preloader.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.beta.implementation.preloader; +package com.fastasyncworldedit.core.queue.implementation.preloader; import com.sk89q.worldedit.entity.Player; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java index 98d2b67db..23ef9399c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java @@ -1,8 +1,7 @@ package com.fastasyncworldedit.core.regions; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.regions.IDelegateRegion; import com.sk89q.worldedit.regions.Region; public class FaweMask implements IDelegateRegion { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java index 64e0d3ed6..782dbe1ec 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.core.regions; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.regions.general.RegionFilter; +import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.sk89q.worldedit.entity.Player; import java.util.Locale; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/FuzzyRegion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/FuzzyRegion.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java index 3f9b197ba..2120c12e6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/FuzzyRegion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FuzzyRegion.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.regions; +package com.fastasyncworldedit.core.regions; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; +import com.fastasyncworldedit.core.math.BlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/IDelegateRegion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/IDelegateRegion.java similarity index 94% rename from worldedit-core/src/main/java/com/sk89q/worldedit/regions/IDelegateRegion.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/IDelegateRegion.java index 4f8e90ed1..d4a81ee97 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/IDelegateRegion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/IDelegateRegion.java @@ -1,8 +1,10 @@ -package com.sk89q.worldedit.regions; +package com.fastasyncworldedit.core.regions; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.world.World; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/PolyhedralRegion.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java similarity index 91% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/PolyhedralRegion.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java index feb270a18..56adf797a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/PolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/PolyhedralRegion.java @@ -1,23 +1,4 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.fastasyncworldedit.core.object.regions; +package com.fastasyncworldedit.core.regions; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RegionWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RegionWrapper.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java index 5f17a8418..b3da7e73b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RegionWrapper.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/RegionWrapper.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.regions; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/Triangle.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/Triangle.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java index 49096b219..59f1fc8d8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/Triangle.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/Triangle.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.regions; +package com.fastasyncworldedit.core.regions; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.StringMan; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/CuboidRegionFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java similarity index 94% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/CuboidRegionFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java index c9d7d1443..2ad9b3c4c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/CuboidRegionFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/CuboidRegionFilter.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.regions.general; +package com.fastasyncworldedit.core.regions.filter; -import com.fastasyncworldedit.core.object.collection.LongHashSet; +import com.fastasyncworldedit.core.util.collection.LongHashSet; import com.sk89q.worldedit.math.BlockVector2; public abstract class CuboidRegionFilter implements RegionFilter { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/RegionFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/RegionFilter.java similarity index 71% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/RegionFilter.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/RegionFilter.java index f3a32ba88..86147eda6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/general/RegionFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/filter/RegionFilter.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.regions.general; +package com.fastasyncworldedit.core.regions.filter; public interface RegionFilter { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/FuzzyRegionSelector.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/FuzzyRegionSelector.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/FuzzyRegionSelector.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/FuzzyRegionSelector.java index 5bd49be57..81f7e0f91 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/FuzzyRegionSelector.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/FuzzyRegionSelector.java @@ -1,7 +1,7 @@ -package com.fastasyncworldedit.core.object.regions.selector; +package com.fastasyncworldedit.core.regions.selector; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.regions.FuzzyRegion; +import com.fastasyncworldedit.core.regions.FuzzyRegion; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.MaskTraverser; @@ -10,7 +10,7 @@ import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.PassthroughExtent; +import com.fastasyncworldedit.core.extent.PassthroughExtent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/PolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/PolyhedralRegionSelector.java similarity index 85% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/PolyhedralRegionSelector.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/PolyhedralRegionSelector.java index 6c3bd8b9c..d0ba0c0a6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/regions/selector/PolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/selector/PolyhedralRegionSelector.java @@ -1,26 +1,7 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ +package com.fastasyncworldedit.core.regions.selector; -package com.fastasyncworldedit.core.object.regions.selector; - -import com.fastasyncworldedit.core.object.regions.PolyhedralRegion; -import com.fastasyncworldedit.core.object.regions.Triangle; +import com.fastasyncworldedit.core.regions.PolyhedralRegion; +import com.fastasyncworldedit.core.regions.Triangle; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/RegistryItem.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/RegistryItem.java similarity index 68% rename from worldedit-core/src/main/java/com/sk89q/worldedit/registry/RegistryItem.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/RegistryItem.java index 98b3251d7..9f56c1e10 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/RegistryItem.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/RegistryItem.java @@ -1,5 +1,4 @@ - -package com.sk89q.worldedit.registry; +package com.fastasyncworldedit.core.registry; public interface RegistryItem { void setInternalId(int internalId); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyGroup.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyGroup.java similarity index 97% rename from worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyGroup.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyGroup.java index 0105909cb..f4784fa06 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyGroup.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyGroup.java @@ -1,5 +1,6 @@ -package com.sk89q.worldedit.registry.state; +package com.fastasyncworldedit.core.registry.state; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKey.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKey.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKey.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKey.java index 4a25ddc8a..759559862 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKey.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKey.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.registry.state; +package com.fastasyncworldedit.core.registry.state; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKeySet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKeySet.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKeySet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKeySet.java index 7787ec2aa..c936212c0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/PropertyKeySet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/registry/state/PropertyKeySet.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.registry.state; +package com.fastasyncworldedit.core.registry.state; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/BrushCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/BrushCache.java index 33537e40e..3aec24a73 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/BrushCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/BrushCache.java @@ -75,7 +75,7 @@ public final class BrushCache { return null; } - public static final BrushTool setTool(BaseItem item, BrushTool tool) { + public static BrushTool setTool(BaseItem item, BrushTool tool) { if (item.getNativeItem() == null) { return null; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/CachedMathMan.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/CachedMathMan.java index 3c0f41224..46ffe9914 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/CachedMathMan.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/CachedMathMan.java @@ -20,7 +20,7 @@ public class CachedMathMan { } } - private static float[] ANGLES = new float[65536]; + private static final float[] ANGLES = new float[65536]; static { for (int i = 0; i < 65536; ++i) { @@ -28,7 +28,7 @@ public class CachedMathMan { } } - private static char[] SQRT = new char[65536]; + private static final char[] SQRT = new char[65536]; static { for (int i = 0; i < SQRT.length; i++) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/EditSessionBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/EditSessionBuilder.java index 3dbc32aa5..cebccab68 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/EditSessionBuilder.java @@ -2,32 +2,32 @@ package com.fastasyncworldedit.core.util; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.IQueueChunk; -import com.fastasyncworldedit.core.beta.IQueueExtent; -import com.fastasyncworldedit.core.beta.implementation.lighting.NullRelighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelightProcessor; -import com.fastasyncworldedit.core.beta.implementation.lighting.Relighter; -import com.fastasyncworldedit.core.beta.implementation.processors.HeightmapProcessor; -import com.fastasyncworldedit.core.beta.implementation.processors.LimitExtent; -import com.fastasyncworldedit.core.beta.implementation.queue.ParallelQueueExtent; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightProcessor; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.extent.processor.HeightmapProcessor; +import com.fastasyncworldedit.core.extent.processor.LimitExtent; +import com.fastasyncworldedit.core.queue.implementation.ParallelQueueExtent; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.logging.RollbackOptimizedHistory; +import com.fastasyncworldedit.core.history.RollbackOptimizedHistory; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.HistoryExtent; -import com.fastasyncworldedit.core.object.NullChangeSet; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.RelightMode; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; -import com.fastasyncworldedit.core.object.changeset.BlockBagChangeSet; -import com.fastasyncworldedit.core.object.changeset.DiskStorageHistory; -import com.fastasyncworldedit.core.object.changeset.MemoryOptimizedHistory; -import com.fastasyncworldedit.core.object.extent.FaweRegionExtent; -import com.fastasyncworldedit.core.object.extent.MultiRegionExtent; -import com.fastasyncworldedit.core.object.extent.NullExtent; -import com.fastasyncworldedit.core.object.extent.SingleRegionExtent; -import com.fastasyncworldedit.core.object.extent.SlowExtent; -import com.fastasyncworldedit.core.object.extent.StripNBTExtent; +import com.fastasyncworldedit.core.extent.HistoryExtent; +import com.fastasyncworldedit.core.history.changeset.NullChangeSet; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.history.changeset.BlockBagChangeSet; +import com.fastasyncworldedit.core.history.DiskStorageHistory; +import com.fastasyncworldedit.core.history.MemoryOptimizedHistory; +import com.fastasyncworldedit.core.extent.FaweRegionExtent; +import com.fastasyncworldedit.core.extent.MultiRegionExtent; +import com.fastasyncworldedit.core.extent.NullExtent; +import com.fastasyncworldedit.core.extent.SingleRegionExtent; +import com.fastasyncworldedit.core.extent.SlowExtent; +import com.fastasyncworldedit.core.extent.StripNBTExtent; import com.fastasyncworldedit.core.wrappers.WorldWrapper; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ImgurUtility.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ImgurUtility.java index 886ca871f..368201b91 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ImgurUtility.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ImgurUtility.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.core.util; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.google.gson.Gson; import com.google.gson.JsonObject; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/JoinedCharSequence.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/JoinedCharSequence.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/JoinedCharSequence.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/JoinedCharSequence.java index 84eb925e1..3e197fab8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/JoinedCharSequence.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/JoinedCharSequence.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.string; +package com.fastasyncworldedit.core.util; public class JoinedCharSequence implements CharSequence { private char join; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java index f943b463b..2fb869a29 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java @@ -3,14 +3,14 @@ package com.fastasyncworldedit.core.util; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.FaweInputStream; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.RunnableVal; -import com.fastasyncworldedit.core.object.RunnableVal2; -import com.fastasyncworldedit.core.object.changeset.FaweStreamChangeSet; -import com.fastasyncworldedit.core.object.io.AbstractDelegateOutputStream; -import com.fastasyncworldedit.core.object.io.zstd.ZstdInputStream; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.fastasyncworldedit.core.util.task.RunnableVal2; +import com.fastasyncworldedit.core.history.changeset.FaweStreamChangeSet; +import com.fastasyncworldedit.core.internal.io.AbstractDelegateOutputStream; +import com.github.luben.zstd.ZstdInputStream; import com.github.luben.zstd.ZstdOutputStream; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.DoubleTag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MaskTraverser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MaskTraverser.java index 023ad3b05..e775daf1a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MaskTraverser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MaskTraverser.java @@ -1,6 +1,6 @@ package com.fastasyncworldedit.core.util; -import com.fastasyncworldedit.core.object.mask.ResettableMask; +import com.fastasyncworldedit.core.function.mask.ResettableMask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.AbstractExtentMask; import com.sk89q.worldedit.function.mask.Mask; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MemUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MemUtil.java index fbdf2295f..a093999ca 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MemUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MemUtil.java @@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class MemUtil { - private static AtomicBoolean memory = new AtomicBoolean(false); + private static final AtomicBoolean memory = new AtomicBoolean(false); public static boolean isMemoryFree() { return !memory.get(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/MutableCharSequence.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MutableCharSequence.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/MutableCharSequence.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MutableCharSequence.java index a017e3e38..8af0587aa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/string/MutableCharSequence.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MutableCharSequence.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.string; +package com.fastasyncworldedit.core.util; public class MutableCharSequence implements CharSequence { private String str; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/nbt/NbtUtils.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/NbtUtils.java similarity index 55% rename from worldedit-core/src/main/java/com/sk89q/worldedit/util/nbt/NbtUtils.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/NbtUtils.java index 2c032e8bc..bbcdb0af5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/nbt/NbtUtils.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/NbtUtils.java @@ -1,24 +1,8 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.util.nbt; +package com.fastasyncworldedit.core.util; +import com.sk89q.worldedit.util.nbt.BinaryTag; +import com.sk89q.worldedit.util.nbt.BinaryTagType; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.world.storage.InvalidFormatException; public class NbtUtils { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java index ee4198d96..cb91d6631 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java @@ -1,9 +1,9 @@ package com.fastasyncworldedit.core.util; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.implementation.queue.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RunnableVal; +import com.fastasyncworldedit.core.util.task.RunnableVal; import com.sk89q.worldedit.internal.util.LogManagerCompat; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TextureUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TextureUtil.java index 0926695ac..e8a433b75 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TextureUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TextureUtil.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.core.util; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.beta.implementation.filter.block.SingleFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.SingleFilterBlock; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.util.image.ImageUtil; import com.google.gson.Gson; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java index a6b321d52..b70402042 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java @@ -2,9 +2,9 @@ package com.fastasyncworldedit.core.util; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.extent.NullExtent; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.extent.NullExtent; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedMap.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedMap.java index b8664657d..1f6047f5f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import org.jetbrains.annotations.NotNull; @@ -71,7 +71,7 @@ public class AdaptedMap implements IAdaptedMap { return Collections.emptySet(); } return new AdaptedSetCollection<>(getParent().entrySet(), new com.google.common.base.Function, Entry>() { - private AdaptedPair entry = new AdaptedPair(); + private final AdaptedPair entry = new AdaptedPair(); @Override public Entry apply(@javax.annotation.Nullable Entry input) { entry.input = input; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedSetCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedSetCollection.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedSetCollection.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedSetCollection.java index 6cb191daa..bc82386de 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/AdaptedSetCollection.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/AdaptedSetCollection.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import com.google.common.base.Function; import com.google.common.collect.Collections2; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java index 15dd2b01c..aadf1c6ad 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/BlockSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/BlockSet.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CleanableThreadLocal.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CleanableThreadLocal.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CleanableThreadLocal.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CleanableThreadLocal.java index eb25ccab1..0c433ba13 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CleanableThreadLocal.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CleanableThreadLocal.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import java.io.IOException; import java.util.concurrent.atomic.LongAdder; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CpuBlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CpuBlockSet.java similarity index 98% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CpuBlockSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CpuBlockSet.java index 974e16e53..ca3911ae5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/CpuBlockSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/CpuBlockSet.java @@ -1,4 +1,4 @@ -//package com.boydti.fawe.object.collection; +//package com.fastasyncworldedit.core.util.collection; // //import com.sk89q.worldedit.math.BlockVector2; //import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastRandomCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/FastRandomCollection.java similarity index 95% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastRandomCollection.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/FastRandomCollection.java index 39fdd1321..be82c08c2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/FastRandomCollection.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/FastRandomCollection.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; -import com.fastasyncworldedit.core.object.random.SimpleRandom; +import com.fastasyncworldedit.core.math.random.SimpleRandom; import com.fastasyncworldedit.core.util.MathMan; import java.util.ArrayList; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/IAdaptedMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/IAdaptedMap.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/IAdaptedMap.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/IAdaptedMap.java index 5b1074424..da61adf66 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/IAdaptedMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/IAdaptedMap.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import com.google.common.base.Function; import org.jetbrains.annotations.NotNull; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LongHashSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/LongHashSet.java similarity index 81% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LongHashSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/LongHashSet.java index b3f3e7d4b..b10b04689 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/LongHashSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/LongHashSet.java @@ -1,23 +1,4 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import java.util.Arrays; @@ -60,13 +41,13 @@ public class LongHashSet { public void add(long key) { int mainIdx = (int) (key & 255); - long outer[][] = this.values[mainIdx]; + long[][] outer = this.values[mainIdx]; if (outer == null) { this.values[mainIdx] = outer = new long[256][]; } int outerIdx = (int) ((key >> 32) & 255); - long inner[] = outer[outerIdx]; + long[] inner = outer[outerIdx]; if (inner == null) { synchronized (this) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MemBlockSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MemBlockSet.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java index 0092adb2e..4c6133134 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MemBlockSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MemBlockSet.java @@ -1,10 +1,10 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import com.fastasyncworldedit.core.FaweCache; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector2; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import org.jetbrains.annotations.NotNull; import java.util.AbstractSet; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MutablePair.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MutablePair.java similarity index 88% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MutablePair.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MutablePair.java index 7d6da9366..d1c2b35f8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/MutablePair.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/MutablePair.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/RandomCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/RandomCollection.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/RandomCollection.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/RandomCollection.java index bc4de19f1..5b486b770 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/RandomCollection.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/RandomCollection.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; -import com.fastasyncworldedit.core.object.random.SimpleRandom; +import com.fastasyncworldedit.core.math.random.SimpleRandom; import java.util.Map; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SimpleRandomCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SimpleRandomCollection.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java index 4d6b9fa71..d4db3cba6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SimpleRandomCollection.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java @@ -1,6 +1,6 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; -import com.fastasyncworldedit.core.object.random.SimpleRandom; +import com.fastasyncworldedit.core.math.random.SimpleRandom; import java.util.Map; import java.util.NavigableMap; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedColorTable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SummedColorTable.java similarity index 99% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedColorTable.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SummedColorTable.java index 3c87b6989..f52e4619a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/SummedColorTable.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SummedColorTable.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import com.fastasyncworldedit.core.util.MathMan; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/YieldIterable.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/YieldIterable.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/YieldIterable.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/YieldIterable.java index e5998fcef..9c43415d4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/collection/YieldIterable.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/YieldIterable.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.collection; +package com.fastasyncworldedit.core.util.collection; import org.jetbrains.annotations.Nullable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java index 5558a608d..914845f52 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java @@ -6,7 +6,7 @@ import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; +import com.fastasyncworldedit.core.extension.platform.binding.ProvideBindings; import com.sk89q.worldedit.util.formatting.text.TextComponent; import java.awt.Graphics2D; @@ -136,7 +136,6 @@ public class ImageUtil { default: alpha = MathMan.clamp((int) (alpha * alphaScale), 0, 255); raw[i] = (color & 0x00FFFFFF) + (alpha << 24); - continue; } } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/ChatProgressTracker.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/ChatProgressTracker.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/ChatProgressTracker.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/ChatProgressTracker.java index 9cfc2367d..bb8b4c112 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/ChatProgressTracker.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/ChatProgressTracker.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.progress; +package com.fastasyncworldedit.core.util.progress; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.util.formatting.text.Component; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/DefaultProgressTracker.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java similarity index 96% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/DefaultProgressTracker.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java index db9e9d722..d85cdf91c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/progress/DefaultProgressTracker.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.progress; +package com.fastasyncworldedit.core.util.progress; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; @@ -91,13 +91,13 @@ public class DefaultProgressTracker implements BiConsumer implements Runnable, BiConsumer { public void accept(T t, U u) { run(t, u); } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal3.java similarity index 90% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal3.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal3.java index 555df2f04..daa0a1227 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal3.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.util.task; public abstract class RunnableVal3 implements Runnable { public T value1; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal4.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal4.java similarity index 92% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal4.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal4.java index b734efba7..1df45d5b9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/RunnableVal4.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/RunnableVal4.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object; +package com.fastasyncworldedit.core.util.task; public abstract class RunnableVal4 implements Runnable { public T value1; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/SingleThreadIntervalQueue.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/SingleThreadIntervalQueue.java similarity index 97% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/SingleThreadIntervalQueue.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/SingleThreadIntervalQueue.java index 9008cfa4c..a8fbbd404 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/SingleThreadIntervalQueue.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/SingleThreadIntervalQueue.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.task; +package com.fastasyncworldedit.core.util.task; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.util.TaskManager; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/ThrowableSupplier.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/ThrowableSupplier.java similarity index 64% rename from worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/ThrowableSupplier.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/ThrowableSupplier.java index d53e65147..d1bf3cc8e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/object/task/ThrowableSupplier.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/ThrowableSupplier.java @@ -1,4 +1,4 @@ -package com.fastasyncworldedit.core.object.task; +package com.fastasyncworldedit.core.util.task; public interface ThrowableSupplier { Object get() throws T; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java similarity index 81% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java index d17d0a31a..e57c07766 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/SimpleWorld.java @@ -1,23 +1,4 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General default 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 Lesser General default License - * for more details. - * - * You should have received a copy of the GNU Lesser General default License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world; +package com.fastasyncworldedit.core.world; import com.fastasyncworldedit.core.Fawe; import com.sk89q.worldedit.EditSession; @@ -33,6 +14,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; @@ -46,7 +28,6 @@ import javax.annotation.Nullable; /** * An abstract implementation of {@link World}. - * Added by FAWE. */ public interface SimpleWorld extends World { @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlanketBaseBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlanketBaseBlock.java similarity index 82% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlanketBaseBlock.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlanketBaseBlock.java index 5d1ee427c..3c19faa94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlanketBaseBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlanketBaseBlock.java @@ -1,6 +1,8 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; import org.jetbrains.annotations.NotNull; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockID.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockID.java similarity index 99% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockID.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockID.java index 47d74fe97..ffef82386 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockID.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockID.java @@ -1,7 +1,12 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; +/** + * An internal FAWE class used for switch statements on blocks. + * Using IDs to register items is pre 1.13 days. This class is + * deprecated for removal with replacement of namespaced IDs. + */ +@Deprecated(forRemoval = true) public class BlockID { - // Used for switch statements on blocks public static final int __RESERVED__ = 0; public static final int AIR = 1; public static final int CAVE_AIR = 2; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitch.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitch.java similarity index 76% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitch.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitch.java index 13a75ddb8..5f50c9f17 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitch.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitch.java @@ -1,4 +1,6 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; + +import com.sk89q.worldedit.world.block.BlockType; import java.util.function.Function; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitchBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitchBuilder.java similarity index 84% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitchBuilder.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitchBuilder.java index 11b1c3d4b..5739304c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeSwitchBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/BlockTypeSwitchBuilder.java @@ -1,4 +1,8 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; + +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; import java.util.function.Predicate; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java similarity index 64% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java index 9ec410eec..4310d6523 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java @@ -1,6 +1,8 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; -import com.fastasyncworldedit.core.beta.ITileInput; +import com.fastasyncworldedit.core.queue.ITileInput; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; public enum CompoundInput { NULL, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/ItemTypesCache.java similarity index 94% rename from worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java rename to worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/ItemTypesCache.java index 9c376a761..be8909e2d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/ItemTypesCache.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.world.block; +package com.fastasyncworldedit.core.world.block; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Capability; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java index 2e2f0aabf..f95b33581 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/AsyncPlayer.java @@ -1,7 +1,7 @@ package com.fastasyncworldedit.core.wrappers; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.object.RunnableVal; +import com.fastasyncworldedit.core.util.task.RunnableVal; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.EditSession; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java index 1e9c52859..90198424b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/wrappers/WorldWrapper.java @@ -1,8 +1,8 @@ package com.fastasyncworldedit.core.wrappers; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; -import com.fastasyncworldedit.core.object.RunnableVal; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.util.task.RunnableVal; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.jnbt.CompoundTag; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java index a1065cced..094a7c9bb 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteArrayTag.java @@ -56,11 +56,11 @@ public final class ByteArrayTag extends Tag { return innerTag; } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_BYTE_ARRAY; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java index ce90b9a60..6068b2af0 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ByteTag.java @@ -56,11 +56,11 @@ public final class ByteTag extends Tag { return innerTag; } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_BYTE; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java index eddf565b0..8ce0a00ec 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/CompoundTag.java @@ -19,7 +19,7 @@ package com.sk89q.jnbt; -import com.sk89q.jnbt.fawe.NumberTag; +import com.fastasyncworldedit.core.jnbt.NumberTag; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Location; @@ -338,7 +338,7 @@ public class CompoundTag extends Tag { } - // FAWE Start + //FAWE start public UUID getUUID() { long most = getLong("UUIDMost"); long least = getLong("UUIDLeast"); @@ -376,6 +376,6 @@ public class CompoundTag extends Tag { } return raw; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java index 1ad649d91..da0890ea6 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/DoubleTag.java @@ -19,7 +19,7 @@ package com.sk89q.jnbt; -import com.sk89q.jnbt.fawe.NumberTag; +import com.fastasyncworldedit.core.jnbt.NumberTag; import com.sk89q.worldedit.util.nbt.DoubleBinaryTag; /** @@ -57,11 +57,11 @@ public final class DoubleTag extends NumberTag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_DOUBLE; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java index f2f34f2da..18347d928 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/EndTag.java @@ -39,11 +39,11 @@ public final class EndTag extends Tag { return EndBinaryTag.get(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_END; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java index b750728f6..2e1533827 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/FloatTag.java @@ -19,7 +19,7 @@ package com.sk89q.jnbt; -import com.sk89q.jnbt.fawe.NumberTag; +import com.fastasyncworldedit.core.jnbt.NumberTag; import com.sk89q.worldedit.util.nbt.FloatBinaryTag; /** @@ -57,11 +57,11 @@ public final class FloatTag extends NumberTag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_FLOAT; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java index 990e4454c..76d8fac74 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/IntArrayTag.java @@ -59,11 +59,11 @@ public final class IntArrayTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_INT_ARRAY; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java index 4da079385..c6ff80252 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/IntTag.java @@ -56,11 +56,11 @@ public final class IntTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_INT; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java index c6a0b7376..615e13fbf 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ListTag.java @@ -389,7 +389,7 @@ public final class ListTag extends Tag { ); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_LIST; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java index 417e9e3af..81c6e3376 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongArrayTag.java @@ -59,11 +59,11 @@ public class LongArrayTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_LONG_ARRAY; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java index 526751bd8..84a443746 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/LongTag.java @@ -56,11 +56,11 @@ public final class LongTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_LONG; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java index 19c957d2c..fe3327ebd 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/NBTOutputStream.java @@ -19,7 +19,7 @@ package com.sk89q.jnbt; -import com.fastasyncworldedit.core.object.io.LittleEndianOutputStream; +import com.fastasyncworldedit.core.internal.io.LittleEndianOutputStream; import java.io.Closeable; import java.io.DataOutput; diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java index c0849a583..abbd06b3f 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/ShortTag.java @@ -56,11 +56,11 @@ public final class ShortTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_SHORT; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java index ef5ff44c1..483263752 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/StringTag.java @@ -59,11 +59,11 @@ public final class StringTag extends Tag { return innerTag.value(); } - // FAWE Start + //FAWE start @Override public int getTypeCode() { return NBTConstants.TYPE_STRING; } - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java b/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java index 2bad9d965..900b87121 100644 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java +++ b/worldedit-core/src/main/java/com/sk89q/jnbt/Tag.java @@ -41,12 +41,12 @@ public abstract class Tag implements BinaryTagLike { return asBinaryTag().toString(); } - // FAWE Start + //FAWE start public Object toRaw() { return getValue(); } public abstract int getTypeCode(); - // FAWE End + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/package-info.java b/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/package-info.java deleted file mode 100644 index e86928e02..000000000 --- a/worldedit-core/src/main/java/com/sk89q/jnbt/fawe/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * These are classes added by FAWE. They do not exist in WorldEdit - */ -package com.sk89q.jnbt.fawe; diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Command.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Command.java index 9fe5603c9..017d6563e 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Command.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Command.java @@ -90,10 +90,12 @@ public @interface Command { */ boolean anyFlags() default false; + //FAWE start /** * Should the command be queued * @return true if so */ boolean queued() default true; + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java b/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java index 15a7c6cb9..0cd8418a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/util/ReflectionUtil.java @@ -26,6 +26,7 @@ public final class ReflectionUtil { private ReflectionUtil() { } + //FAWE start @SuppressWarnings("unchecked") public static T getField(Object from, String name) { if (from instanceof Class) { @@ -34,6 +35,7 @@ public final class ReflectionUtil { return getField(from.getClass(), from, name); } } + //FAWE end @SuppressWarnings("unchecked") public static T getField(Class checkClass, Object from, String name) { diff --git a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java index f7b4bedaf..81edd363c 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/util/StringUtil.java @@ -333,6 +333,7 @@ public final class StringUtil { return parsableBlocks; } + //FAWE start /** * Splits a string respecting enclosing quotes. * @@ -365,4 +366,5 @@ public final class StringUtil { } return split; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 8cac29d14..61f6179c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -20,25 +20,25 @@ package com.sk89q.worldedit; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.implementation.lighting.NullRelighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.Relighter; +import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.RunnableVal; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; -import com.fastasyncworldedit.core.object.changeset.BlockBagChangeSet; -import com.fastasyncworldedit.core.object.clipboard.WorldCopyClipboard; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; -import com.fastasyncworldedit.core.object.extent.FaweRegionExtent; -import com.fastasyncworldedit.core.object.extent.ProcessedWEExtent; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; -import com.fastasyncworldedit.core.object.extent.SingleRegionExtent; -import com.fastasyncworldedit.core.object.extent.SourceMaskExtent; -import com.fastasyncworldedit.core.object.function.SurfaceRegionFunction; -import com.fastasyncworldedit.core.object.mask.ResettableMask; -import com.fastasyncworldedit.core.object.pattern.ExistingPattern; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.history.changeset.BlockBagChangeSet; +import com.fastasyncworldedit.core.extent.clipboard.WorldCopyClipboard; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; +import com.fastasyncworldedit.core.extent.FaweRegionExtent; +import com.fastasyncworldedit.core.extent.ProcessedWEExtent; +import com.fastasyncworldedit.core.extent.ResettableExtent; +import com.fastasyncworldedit.core.extent.SingleRegionExtent; +import com.fastasyncworldedit.core.extent.SourceMaskExtent; +import com.fastasyncworldedit.core.function.SurfaceRegionFunction; +import com.fastasyncworldedit.core.function.mask.ResettableMask; +import com.fastasyncworldedit.core.function.pattern.ExistingPattern; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.MaskTraverser; @@ -52,42 +52,41 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.ChangeSetExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.MaskingExtent; -import com.sk89q.worldedit.extent.PassthroughExtent; +import com.fastasyncworldedit.core.extent.PassthroughExtent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBagExtent; import com.sk89q.worldedit.extent.world.SurvivalModeExtent; import com.sk89q.worldedit.extent.world.WatchdogTickingExtent; import com.sk89q.worldedit.function.GroundFunction; -import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.block.SnowSimulator; import com.sk89q.worldedit.function.generator.ForestGenerator; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; -import com.sk89q.worldedit.function.generator.GenBase; -import com.sk89q.worldedit.function.generator.OreGen; -import com.sk89q.worldedit.function.generator.SchemGen; +import com.fastasyncworldedit.core.function.mask.BlockMaskBuilder; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.OreGen; +import com.fastasyncworldedit.core.function.generator.SchemGen; import com.sk89q.worldedit.function.mask.BlockStateMask; import com.sk89q.worldedit.function.mask.BlockTypeMask; import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.MaskIntersection; -import com.sk89q.worldedit.function.mask.MaskUnion; +import com.fastasyncworldedit.core.function.mask.MaskUnion; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.mask.NoiseFilter2D; import com.sk89q.worldedit.function.mask.RegionMask; -import com.sk89q.worldedit.function.mask.SingleBlockTypeMask; -import com.sk89q.worldedit.function.mask.SolidBlockMask; -import com.sk89q.worldedit.function.mask.WallMakeMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; +import com.fastasyncworldedit.core.function.mask.WallMakeMask; import com.sk89q.worldedit.function.operation.ChangeSetExecutor; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.WaterloggedRemover; import com.sk89q.worldedit.function.util.RegionOffset; -import com.sk89q.worldedit.function.visitor.DirectionalVisitor; +import com.fastasyncworldedit.core.function.visitor.DirectionalVisitor; import com.sk89q.worldedit.function.visitor.DownwardVisitor; import com.sk89q.worldedit.function.visitor.FlatRegionVisitor; import com.sk89q.worldedit.function.visitor.LayerVisitor; @@ -105,8 +104,8 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MathUtils; -import com.sk89q.worldedit.math.MutableBlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector2; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.interpolation.Interpolation; @@ -174,7 +173,12 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY; * using the {@link ChangeSetExtent}.

*/ @SuppressWarnings({"FieldCanBeLocal"}) +/* FAWE start - extends PassthroughExtent > implements Extent +Make sure, that all edits go thru it, else history etc. can have issues. +PassthroughExtent has some for loops that then delegate to methods editsession overrides. + */ public class EditSession extends PassthroughExtent implements AutoCloseable { +//FAWE end private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -215,24 +219,27 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @SuppressWarnings("ProtectedField") protected final World world; + //FAWE start private final FaweLimit originalLimit; private final FaweLimit limit; private final Player player; private AbstractChangeSet changeSet; private boolean history; - private final MutableBlockVector3 mutablebv = new MutableBlockVector3(); + private final MutableBlockVector3 mutableBlockVector3 = new MutableBlockVector3(); private int changes = 0; private final BlockBag blockBag; private final Extent bypassHistory; - private Extent bypassAll; + private final Extent bypassAll; private final int minY; private final int maxY; + //FAWE end private final List watchdogExtents = new ArrayList<>(2); + //FAWE start private final Relighter relighter; private final boolean wnaMode; @@ -247,6 +254,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @Nullable BlockBag blockBag, @Nullable EditSessionEvent event) { this(new EditSessionBuilder(world).player(player).limit(limit).changeSet(changeSet).allowedRegions(allowedRegions).autoQueue(autoQueue).fastmode(fastmode).checkMemory(checkMemory).combineStages(combineStages).blockBag(blockBag).eventBus(bus).event(event)); } + //FAWE end /** * Construct the object with a maximum number of blocks and a block bag. @@ -257,6 +265,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param blockBag an optional {@link BlockBag} to use, otherwise null * @param event the event to call with the extent */ + //FAWE start - EditSessionEvent public EditSession(@NotNull EventBus eventBus, World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) { this(eventBus, world, null, null, null, null, true, null, null, null, blockBag, event); } @@ -359,6 +368,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { boolean commitRequired() { return false; } + //FAWE end /** * Turns on specific features for a normal WorldEdit session, such as @@ -375,6 +385,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param reorderMode The reorder mode */ public void setReorderMode(ReorderMode reorderMode) { + //FAWE start - we don't do physics so we don't need this switch (reorderMode) { case MULTI_STAGE: enableQueue(); @@ -386,6 +397,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { default: throw new UnsupportedOperationException("Not implemented: " + reorderMode); } + //FAWE end } /** @@ -457,7 +469,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ @Deprecated public boolean isQueueEnabled() { + //FAWE start - see reorder comment, we don't need this return true; + //FAWE end } /** @@ -468,7 +482,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ @Deprecated public void enableQueue() { + //FAWE start - see reorder comment, we don't need this super.enableQueue(); + //FAWE end } /** @@ -476,7 +492,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ @Deprecated public void disableQueue() { + //FAWE start - see reorder comment, we don't need this super.disableQueue(); + //FAWE end } /** @@ -485,14 +503,17 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return mask, may be null */ public Mask getMask() { + //FAWE start - ExtendTraverser & MaskingExtents ExtentTraverser maskingExtent = new ExtentTraverser<>(getExtent()).find(MaskingExtent.class); return maskingExtent != null ? maskingExtent.get().getMask() : null; + //FAWE end } + //FAWE start /** - * Get the mask. + * Get the source mask. * - * @return mask, may be null + * @return source mask, may be null */ public Mask getSourceMask() { ExtentTraverser maskingExtent = new ExtentTraverser<>(getExtent()).find(SourceMaskExtent.class); @@ -518,7 +539,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return null; } + //FAWE end + //FAWE start - use source mast > mask /** * Set a mask. * @@ -558,7 +581,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } setSourceMask(mask); } + //FAWE end + //FAWE start - use MaskingExtent & ExtentTraverser /** * Set a mask. * @@ -581,7 +606,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { addProcessor(new MaskingExtent(getExtent(), mask)); } } + //FAWE end + //FAWE start - ExtentTraverser /** * Get the {@link SurvivalModeExtent}. * @@ -597,7 +624,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return survival; } } + //FAWE end + //FAWE start - our fastmode works different to upstream /** * Set whether fast mode is enabled. * @@ -610,7 +639,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public void setFastMode(boolean enabled) { disableHistory(enabled); } + //FAWE end + //FAWE start - we don't use this (yet) /** * Set which block updates should occur. * @@ -624,7 +655,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //Do nothing; TODO: SideEffects currently not fully implemented in FAWE. return SideEffectSet.defaults(); } + //FAWE end + //FAWE start /** * Disable history (or re-enable) * @@ -646,7 +679,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } } + //FAWE end + //FAWE start - See comment on setFastMode /** * Return fast mode status. * @@ -659,7 +694,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public boolean hasFastMode() { return getChangeSet() == null; } + //FAWE end + //FAWE start - Don't use blockBagExtent /** * Get the {@link BlockBag} is used. * @@ -668,7 +705,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public BlockBag getBlockBag() { return this.blockBag; } + //FAWE end + //FAWE start /** * Set a {@link BlockBag} to use. * @@ -678,7 +717,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //Not Supported in FAWE throw new UnsupportedOperationException("TODO - this is never called anyway"); } + //FAWE end + //FAWE start @Override public String toString() { return super.toString() + ":" + getExtent(); @@ -730,7 +771,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return Collections.emptyMap(); } + //FAWE end + //FAWE start - We don't use this method /** * Returns chunk batching status. * @@ -739,6 +782,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public boolean isBatchingChunks() { return false; } + //FAWE end /** * Enable or disable chunk batching. Disabling will flush the session. @@ -746,11 +790,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @param batchingChunks {@code true} to enable, {@code false} to disable */ public void setBatchingChunks(boolean batchingChunks) { + //FAWE start - altered by our lifecycle if (batchingChunks) { enableQueue(); } else { disableQueue(); } + //FAWE end } /** @@ -760,7 +806,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @see #setBatchingChunks(boolean) */ public void disableBuffering() { + //FAWE start - see comment on reorder mode disableQueue(); + //FAWE end } /** @@ -804,20 +852,24 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { + //FAWE start - use extent if (position.getY() < this.minY || position.getY() > this.maxY) { return false; } this.changes++; return this.getExtent().setBiome(position, biome); + //FAWE end } @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { + //FAWE start - use extent if (y < this.minY || y > this.maxY) { return false; } this.changes++; return this.getExtent().setBiome(x, y, z, biome); + //FAWE end } /** @@ -830,10 +882,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return height of highest block found or 'minY' */ public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { + //FAWE start - check movement blocker for (int y = maxY; y >= minY; --y) { if (getBlock(x, y, z).getBlockType().getMaterial().isMovementBlocker()) { return y; } + //FAWE end } return minY; } @@ -850,7 +904,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) { for (int y = maxY; y >= minY; --y) { - if (filter.test(mutablebv.setComponents(x, y, z))) { + //FAWE start - get position from mutable vector + if (filter.test(mutableBlockVector3.setComponents(x, y, z))) { + //FAWE end return y; } } @@ -858,9 +914,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return minY; } + //FAWE start public BlockType getBlockType(int x, int y, int z) { return getBlock(x, y, z).getBlockType(); } + //FAWE end /** * Set a block, bypassing both history and block re-ordering. @@ -873,6 +931,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ @Deprecated public > boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException { + //FAWE start - accumulate changes if (position.getBlockY() < this.minY || position.getBlockY() > this.maxY) { return false; } @@ -886,10 +945,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { case BEFORE_REORDER: return bypassAll.setBlock(position, block); } + //FAWE end throw new RuntimeException("New enum entry added that is unhandled here"); } + //FAWE start - see former comment /** * Set a block, bypassing both history and block re-ordering. * @@ -910,7 +971,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { throw new RuntimeException("Unexpected exception", e); } } + //FAWE end + //FAWE start - we use this /** * Set a block, bypassing history but still utilizing block re-ordering. * @@ -980,7 +1043,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { this.changes++; try { - BlockVector3 bv = mutablebv.setComponents(x, y, z); + BlockVector3 bv = mutableBlockVector3.setComponents(x, y, z); return pattern.apply(getExtent(), bv, bv); } catch (WorldEditException e) { throw new RuntimeException("Unexpected exception", e); @@ -1017,7 +1080,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { return this.changes = super.setBlocks(region, pattern); } + //FAWE end + //FAWE start /** * Restores all blocks to their initial state. * @@ -1025,6 +1090,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ public void undo(EditSession editSession) { UndoContext context = new UndoContext(); + //FAWE start - listen for inventory, flush & prepare changeset context.setExtent(editSession.bypassAll); ChangeSet changeSet = getChangeSet(); setChangeSet(null); @@ -1033,6 +1099,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { editSession.changes = 1; } + //FAWE start public void setBlocks(ChangeSet changeSet, ChangeSetExecutor.Type type) { final UndoContext context = new UndoContext(); context.setExtent(bypassAll); @@ -1040,6 +1107,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { flushQueue(); changes = 1; } + //FAWE end /** * Sets to new state. @@ -1048,6 +1116,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { */ public void redo(EditSession editSession) { UndoContext context = new UndoContext(); + //FAWE start - listen for inventory, flush & prepare changeset context.setExtent(editSession.bypassAll); ChangeSet changeSet = getChangeSet(); setChangeSet(null); @@ -1055,6 +1124,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { flushQueue(); editSession.changes = 1; } + //FAWE end /** * Get the number of changed blocks. @@ -1065,9 +1135,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return getBlockChangeCount(); } + //FAWE start public void setSize(int size) { this.changes = size; } + //FAWE end /** * Closing an EditSession flushes its buffers to the world, and performs other @@ -1089,6 +1161,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { flushQueue(); } + //FAWE start /** * Finish off the queue. */ @@ -1222,6 +1295,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Operations.completeBlindly(visitor); return this.changes = visitor.getAffected(); } + //FAWE end /** * Fills an area recursively in the X/Z directions. @@ -1279,7 +1353,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { // Execute Operations.completeLegacy(visitor); + //FAWE start return this.changes = visitor.getAffected(); + //FAWE end } /** @@ -1449,13 +1525,16 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { checkNotNull(region); checkNotNull(pattern); + //FAWE start int blocksChanged = 0; for (Region wall : CuboidRegion.makeCuboid(region).getWalls().getRegions()) { blocksChanged += setBlocks(wall, pattern); } return blocksChanged; + //FAWE end } + //FAWE start /** * Make the walls of the given region. The method by which the walls are found * may be inefficient, because there may not be an efficient implementation supported @@ -1477,6 +1556,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return changes; } + //FAWE end /** * Places a layer of blocks on top of ground blocks in the given region @@ -1510,10 +1590,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { BlockReplace replace = new BlockReplace(this, pattern); RegionOffset offset = new RegionOffset(BlockVector3.UNIT_Y, replace); + //FAWE start int minY = region.getMinimumPoint().getBlockY(); int maxY = Math.min(getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockY() + 1); SurfaceRegionFunction surface = new SurfaceRegionFunction(this, offset, minY, maxY); FlatRegionVisitor visitor = new FlatRegionVisitor(asFlatRegion(region), surface); + //FAWE end Operations.completeBlindly(visitor); return this.changes = visitor.getAffected(); } @@ -1551,6 +1633,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return stackCuboidRegion(region, dir, count, true, false, copyAir ? null : new ExistingBlockMask(this)); } + //FAWE start /** * Stack a cuboid region. * @@ -1590,6 +1673,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Operations.completeLegacy(copy); return this.changes = copy.getAffected(); } + //FAWE end /** * Move the blocks in a region a certain direction. @@ -1605,11 +1689,13 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int moveRegion(Region region, BlockVector3 dir, int distance, boolean copyAir, boolean moveEntities, boolean copyBiomes, Pattern replacement) throws MaxChangedBlocksException { + //FAWE start Mask mask = null; if (!copyAir) { mask = new ExistingBlockMask(this); } return moveRegion(region, dir, distance, moveEntities, copyBiomes, mask, replacement); + //FAWE end } /** @@ -1633,6 +1719,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { checkArgument(distance >= 1, "distance >= 1 required"); checkArgument(!copyBiomes || region instanceof FlatRegion, "can't copy biomes from non-flat region"); + //FAWE start - add up distance BlockVector3 to = region.getMinimumPoint().add(dir.multiply(distance)); final BlockVector3 displace = dir.multiply(distance); @@ -1673,6 +1760,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } Operations.completeBlindly(copy); return this.changes = copy.getAffected(); + //FAWE end } /** @@ -1729,22 +1817,30 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { checkNotNull(origin); checkArgument(radius >= 0, "radius >= 0 required"); + //FAWE start - liquidmask Mask liquidMask; if (plants) { liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER, - BlockTypes.KELP_PLANT, BlockTypes.KELP, BlockTypes.SEAGRASS, BlockTypes.TALL_SEAGRASS); + BlockTypes.KELP_PLANT, BlockTypes.KELP, BlockTypes.SEAGRASS, BlockTypes.TALL_SEAGRASS); } else { - liquidMask = new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER); + liquidMask = new BlockMaskBuilder() + .addTypes(BlockTypes.WATER, BlockTypes.LAVA) + .build(this); } + //FAWE end if (waterlogged) { Map stateMap = new HashMap<>(); stateMap.put("waterlogged", "true"); + //FAWE start liquidMask = new MaskUnion(liquidMask, new BlockStateMask(this, stateMap, true)); + //FAWE end } Mask mask = new MaskIntersection( - new BoundedHeightMask(0, getWorld().getMaxY()), + new BoundedHeightMask(getWorld().getMinY(), getWorld().getMaxY()), new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), + //FAWE start liquidMask); + //FAWE end BlockReplace replace; if (waterlogged) { replace = new BlockReplace(this, new WaterloggedRemover(this)); @@ -1762,7 +1858,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Operations.completeLegacy(visitor); + //FAWE start return this.changes = visitor.getAffected(); + //FAWE end } /** @@ -1786,7 +1884,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { // There are boundaries that the routine needs to stay in Mask mask = new MaskIntersection( - new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())), + new BoundedHeightMask(getWorld().getMinY(), Math.min(origin.getBlockY(), getWorld().getMaxY())), new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), blockMask ); @@ -1837,34 +1935,43 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return makeCylinder(pos, block, radiusX, radiusZ, height, 0, filled); } + //FAWE start public int makeHollowCylinder(BlockVector3 pos, final Pattern block, double radiusX, double radiusZ, int height, double thickness) throws MaxChangedBlocksException { return makeCylinder(pos, block, radiusX, radiusZ, height, thickness, false); } + //FAWE end - private int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness, boolean filled) throws MaxChangedBlocksException { + public int makeCylinder(BlockVector3 pos, Pattern block, double radiusX, double radiusZ, int height, double thickness, boolean filled) throws MaxChangedBlocksException { radiusX += 0.5; radiusZ += 0.5; - MutableBlockVector3 posv = new MutableBlockVector3(pos); + //FAWE start + MutableBlockVector3 mutableBlockVector3 = new MutableBlockVector3(pos); + //FAWE end if (height == 0) { return 0; } else if (height < 0) { height = -height; - posv.mutY(posv.getY() - height); + //FAWE start + mutableBlockVector3.mutY(mutableBlockVector3.getY() - height); + //FAWE end } - if (posv.getBlockY() < 0) { - posv.mutY(0); - } else if (posv.getBlockY() + height - 1 > maxY) { - height = maxY - posv.getBlockY() + 1; + //FAWE start + if (mutableBlockVector3.getBlockY() < getWorld().getMinY()) { + mutableBlockVector3.mutY(world.getMinY()); + } else if (mutableBlockVector3.getBlockY() + height - 1 > maxY) { + height = maxY - mutableBlockVector3.getBlockY() + 1; } + //FAWE end final double invRadiusX = 1 / radiusX; final double invRadiusZ = 1 / radiusZ; - int px = posv.getBlockX(); - int py = posv.getBlockY(); - int pz = posv.getBlockZ(); + //FAWE start + int px = mutableBlockVector3.getBlockX(); + int py = mutableBlockVector3.getBlockY(); + int pz = mutableBlockVector3.getBlockZ(); MutableBlockVector3 mutable = new MutableBlockVector3(); final int ceilRadiusX = (int) Math.ceil(radiusX); @@ -1914,6 +2021,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } } else { + //FAWE end forX: for (int x = 0; x <= ceilRadiusX; ++x) { final double xn = nextXn; nextXn = (x + 1) * invRadiusX; @@ -1938,16 +2046,20 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } for (int y = 0; y < height; ++y) { + //FAWE start - mutable this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block); this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block); this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block); this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block); + //FAWE end } } } } + //FAWE start return this.changes; + //FAWE end } /** @@ -1965,6 +2077,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return moveRegion(region, dir, distance, true, false, copyAir ? new ExistingBlockMask(this) : null, replacement); } + //FAWE start public int makeCircle(BlockVector3 pos, final Pattern block, double radiusX, double radiusY, double radiusZ, boolean filled, Vector3 normal) throws MaxChangedBlocksException { radiusX += 0.5; radiusY += 0.5; @@ -2061,6 +2174,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return changes; } + //FAWE end /** * Makes a sphere. @@ -2105,7 +2219,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final int ceilRadiusY = (int) Math.ceil(radiusY); final int ceilRadiusZ = (int) Math.ceil(radiusZ); + //FAWE start int yy; + //FAWE end double nextXn = 0; forX: for (int x = 0; x <= ceilRadiusX; ++x) { @@ -2141,6 +2257,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { continue; } } + //FAWE start yy = py + y; if (yy <= maxY) { this.setBlock(px + x, py + y, pz + z, block); @@ -2171,6 +2288,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return changes; + //FAWE end } /** @@ -2184,6 +2302,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int makePyramid(BlockVector3 position, Pattern block, int size, boolean filled) throws MaxChangedBlocksException { + //FAWE start - abbreviated logic int bx = position.getX(); int by = position.getY(); int bz = position.getZ(); @@ -2206,6 +2325,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return changes; + //FAWE end } /** @@ -2266,6 +2386,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { ++affected; } } else if (id == BlockTypes.SNOW) { + //FAWE start if (setBlock(pt, air)) { if (y > 0 ) { BlockState block = getBlock(below); @@ -2275,6 +2396,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } } + //FAWE end ++affected; } } else if (id.getMaterial().isAir()) { @@ -2419,6 +2541,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return makePumpkinPatches(position, apothem, 0.02); } + //FAWE start - support density public int makePumpkinPatches(BlockVector3 position, int apothem, double density) throws MaxChangedBlocksException { // We want to generate pumpkins GardenPatchGenerator generator = new GardenPatchGenerator(this); @@ -2436,6 +2559,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Operations.completeLegacy(visitor); return this.changes = ground.getAffected(); } + //FAWE end /** * Makes a forest. @@ -2476,6 +2600,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return the results */ public List> getBlockDistribution(Region region, boolean separateStates) { + //FAWE start - get distr if (separateStates) { return getBlockDistributionWithData(region); } @@ -2484,6 +2609,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { for (Countable count : normalDistr) { distribution.add(new Countable<>(count.getID().getDefaultState(), count.getAmount())); } + //FAWE end return distribution; } @@ -2631,41 +2757,40 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero); expression.setEnvironment(environment); + //FAWE start final Vector3 zero2 = zero.add(0.5, 0.5, 0.5); - RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() { + RegionVisitor visitor = new RegionVisitor(region, position -> { + try { + // offset, scale + final Vector3 scaled = position.toVector3().subtract(zero).divide(unit); - @Override - public boolean apply(BlockVector3 position) throws WorldEditException { - try { - // offset, scale - final Vector3 scaled = position.toVector3().subtract(zero).divide(unit); + // transform + expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout); + int xv = (int) (x.getValue() * unit.getX() + zero2.getX()); + int yv = (int) (y.getValue() * unit.getY() + zero2.getY()); + int zv = (int) (z.getValue() * unit.getZ() + zero2.getZ()); - // transform - expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout); - int xv = (int) (x.getValue() * unit.getX() + zero2.getX()); - int yv = (int) (y.getValue() * unit.getY() + zero2.getY()); - int zv = (int) (z.getValue() * unit.getZ() + zero2.getZ()); - - BlockState get; - if (yv >= 0 && yv < 256) { - get = getBlock(xv, yv, zv); - } else { - get = BlockTypes.AIR.getDefaultState(); - } - - // read block from world - return setBlock(position, get); - } catch (EvaluationException e) { - throw new RuntimeException(e); + BlockState get; + if (yv >= 0 && yv < 256) { + get = getBlock(xv, yv, zv); + } else { + get = BlockTypes.AIR.getDefaultState(); } + + // read block from world + return setBlock(position, get); + } catch (EvaluationException e) { + throw new RuntimeException(e); } }); Operations.completeBlindly(visitor); changes += visitor.getAffected(); return changes; + //FAWE end } + //FAWE start - respect Mask /** * Hollows out the region (Semi-well-defined for non-cuboid selections). * @@ -2676,10 +2801,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int hollowOutRegion(Region region, int thickness, Pattern pattern) throws MaxChangedBlocksException { - return hollowOutRegion(region, thickness, pattern, new SolidBlockMask(this)); - } - public int hollowOutRegion(Region region, int thickness, Pattern pattern, Mask mask) { try { final Set outside = new LocalBlockVectorSet(); @@ -2747,6 +2868,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return changes; } + //FAWE end public int drawLine(Pattern pattern, BlockVector3 pos1, BlockVector3 pos2, double radius, boolean filled) throws MaxChangedBlocksException { return drawLine(pattern, pos1, pos2, radius, filled, false); @@ -2770,7 +2892,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { throws MaxChangedBlocksException { LocalBlockVectorSet vset = new LocalBlockVectorSet(); + //FAWE start boolean notdrawn = true; + //FAWE end int x1 = pos1.getBlockX(); int y1 = pos1.getBlockY(); @@ -2787,11 +2911,15 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { if (dx + dy + dz == 0) { vset.add(BlockVector3.at(tipx, tipy, tipz)); + //FAWE start notdrawn = false; + //FAWE end } int dMax = Math.max(Math.max(dx, dy), dz); + //FAWE start - notdrawn if (dMax == dx && notdrawn) { + //FAWE end for (int domstep = 0; domstep <= dx; domstep++) { tipx = x1 + domstep * (x2 - x1 > 0 ? 1 : -1); tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dx * (y2 - y1 > 0 ? 1 : -1)); @@ -2799,7 +2927,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { vset.add(BlockVector3.at(tipx, tipy, tipz)); } + //FAWE start - notdrawn } else if (dMax == dy && notdrawn) { + //FAWE end for (int domstep = 0; domstep <= dy; domstep++) { tipy = y1 + domstep * (y2 - y1 > 0 ? 1 : -1); tipx = (int) Math.round(x1 + domstep * (double) dx / (double) dy * (x2 - x1 > 0 ? 1 : -1)); @@ -2807,7 +2937,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { vset.add(BlockVector3.at(tipx, tipy, tipz)); } + //FAWE start - notdrawn } else if (dMax == dz && notdrawn) { + //FAWE end for (int domstep = 0; domstep <= dz; domstep++) { tipz = z1 + domstep * (z2 - z1 > 0 ? 1 : -1); tipy = (int) Math.round(y1 + domstep * (double) dy / (double) dz * (y2 - y1 > 0 ? 1 : -1)); @@ -2816,6 +2948,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { vset.add(BlockVector3.at(tipx, tipy, tipz)); } } + //FAWE start - set BV3 Set newVset; if (flat) { newVset = getStretched(vset, radius); @@ -2829,6 +2962,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } } return this.changes += setBlocks(newVset, pattern); + //FAWE end } /** @@ -2983,6 +3117,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { return returnset; } + //FAWE start public static Set getStretched(Set vset, double radius) { if (radius < 1) { return vset; @@ -3021,6 +3156,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } return returnset; } + //FAWE end public Set getHollowed(Set vset) { final Set returnset = new LocalBlockVectorSet(); @@ -3126,6 +3262,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { Direction.DOWN.toBlockVector(), }; + //FAWE start public boolean regenerate(Region region) { return regenerate(region, this); } @@ -3298,4 +3435,5 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { faweClipboard.setOrigin(region.getMinimumPoint()); return faweClipboard; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index fdc54a887..41b96be64 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -23,7 +23,7 @@ import com.google.common.collect.Lists; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.function.mask.BlockMask; -import com.sk89q.worldedit.function.mask.BlockMaskBuilder; +import com.fastasyncworldedit.core.function.mask.BlockMaskBuilder; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.util.formatting.component.TextUtils; import com.sk89q.worldedit.util.io.file.ArchiveNioSupports; @@ -101,7 +101,7 @@ public abstract class LocalConfiguration { protected String[] getDefaultDisallowedBlocks() { List blockTypes = Lists.newArrayList( - /* + /* FAWE start BlockTypes.OAK_SAPLING, BlockTypes.JUNGLE_SAPLING, BlockTypes.DARK_OAK_SAPLING, @@ -163,7 +163,7 @@ public abstract class LocalConfiguration { BlockTypes.SUGAR_CANE, // ores and stuff BlockTypes.BEDROCK - */ + FAWE end*/ ); return blockTypes.stream().filter(Objects::nonNull).map(BlockType::getId).toArray(String[]::new); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 7e791fab8..8cc0bc0a7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -20,14 +20,14 @@ package com.sk89q.worldedit; import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.FaweInputStream; +import com.fastasyncworldedit.core.internal.io.FaweInputStream; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.FaweOutputStream; -import com.fastasyncworldedit.core.object.changeset.DiskStorageHistory; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; -import com.fastasyncworldedit.core.object.collection.SparseBitSet; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; +import com.fastasyncworldedit.core.internal.io.FaweOutputStream; +import com.fastasyncworldedit.core.history.DiskStorageHistory; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.fastasyncworldedit.core.util.BrushCache; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.MainUtil; @@ -76,6 +76,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.snapshot.experimental.Snapshot; +import com.zaxxer.sparsebits.SparseBitSet; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import java.io.File; @@ -85,11 +86,9 @@ import java.io.IOException; import java.time.ZoneId; import java.util.Calendar; import java.util.Collections; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -import java.util.Map; import java.util.Objects; import java.util.TimeZone; import java.util.UUID; @@ -122,6 +121,7 @@ public class LocalSession implements TextureHolder { // Session related private transient RegionSelector selector = new CuboidRegionSelector(); private transient boolean placeAtPos1 = false; + //FAWE start private final transient List history = Collections.synchronizedList(new LinkedList<>() { @Override public Object get(int index) { @@ -139,12 +139,17 @@ public class LocalSession implements TextureHolder { } }); private transient volatile Integer historyNegativeIndex; + private transient final Lock historyWriteLock = new ReentrantLock(true); + private final transient Int2ObjectOpenHashMap tools = new Int2ObjectOpenHashMap<>(0); + private transient Mask sourceMask; + private transient TextureUtil texture; + private transient ResettableExtent transform = null; + private transient World currentWorld; + //FAWE end private transient ClipboardHolder clipboard; private transient final Object clipboardLock = new Object(); - private transient final Lock historyWriteLock = new ReentrantLock(true); private transient boolean superPickaxe = false; private transient BlockTool pickaxeMode = new SinglePickaxe(); - private final transient Int2ObjectOpenHashMap tools = new Int2ObjectOpenHashMap<>(0); private transient int maxBlocksChanged = -1; private transient int maxTimeoutTime; private transient boolean useInventory; @@ -152,11 +157,7 @@ public class LocalSession implements TextureHolder { private transient Snapshot snapshotExperimental; private transient SideEffectSet sideEffectSet = SideEffectSet.defaults(); private transient Mask mask; - private transient Mask sourceMask; - private transient TextureUtil texture; - private transient ResettableExtent transform = null; private transient ZoneId timezone = ZoneId.systemDefault(); - private transient World currentWorld; private transient UUID uuid; private transient volatile long historySize = 0; @@ -174,7 +175,6 @@ public class LocalSession implements TextureHolder { private boolean useServerCUI = false; // Save this to not annoy players. private ItemType wandItem; private ItemType navWandItem; - private Map macros = new HashMap<>(); /** * Construct the object. @@ -213,6 +213,7 @@ public class LocalSession implements TextureHolder { } } + //FAWE start public boolean loadSessionHistoryFromDisk(UUID uuid, World world) { if (world == null || uuid == null) { return false; @@ -307,19 +308,7 @@ public class LocalSession implements TextureHolder { file.delete(); } } - - public Map getMacros() { - return Collections.unmodifiableMap(this.macros); - } - - public void setMacro(String key, String value) { - this.macros.put(key, value); - setDirty(); - } - - public String getMacro(String key) { - return this.macros.get(key); - } + //FAWE end /** * Get whether this session is "dirty" and has changes that needs to @@ -338,6 +327,7 @@ public class LocalSession implements TextureHolder { dirty.set(true); } + //FAWE start public int getHistoryIndex() { return history.size() - 1 - (historyNegativeIndex == null ? 0 : historyNegativeIndex); } @@ -360,6 +350,7 @@ public class LocalSession implements TextureHolder { } return false; } + //FAWE end /** * Get whether this session is "dirty" and has changes that needs to @@ -395,9 +386,11 @@ public class LocalSession implements TextureHolder { */ public void clearHistory() { history.clear(); + //FAWE start historyNegativeIndex = 0; historySize = 0; currentWorld = null; + //FAWE end } /** @@ -414,6 +407,7 @@ public class LocalSession implements TextureHolder { return; } + //FAWE start Player player = editSession.getPlayer(); int limit = player == null ? Integer.MAX_VALUE : player.getLimit().MAX_HISTORY; remember(editSession, true, limit); @@ -552,6 +546,7 @@ public class LocalSession implements TextureHolder { historyWriteLock.unlock(); } } + //FAWE end /** * Performs an undo. @@ -562,6 +557,7 @@ public class LocalSession implements TextureHolder { */ public EditSession undo(@Nullable BlockBag newBlockBag, Actor actor) { checkNotNull(actor); + //FAWE start - use our logic World world = ((Player) actor).getWorldForEditing(); loadSessionHistoryFromDisk(actor.getUniqueId(), world); if (getHistoryNegativeIndex() < history.size()) { @@ -590,6 +586,7 @@ public class LocalSession implements TextureHolder { } return null; } + //FAWE end } /** @@ -599,6 +596,7 @@ public class LocalSession implements TextureHolder { * @param actor the actor * @return whether anything was redone */ + //FAWE start - use our logic public EditSession redo(@Nullable BlockBag newBlockBag, Actor actor) { checkNotNull(actor); World world = ((Player) actor).getWorldForEditing(); @@ -620,6 +618,7 @@ public class LocalSession implements TextureHolder { return newEditSession; } } + //FAWE end return null; } @@ -775,14 +774,17 @@ public class LocalSession implements TextureHolder { * @throws EmptyClipboardException thrown if no clipboard is set */ public ClipboardHolder getClipboard() throws EmptyClipboardException { + //FAWE start synchronized (clipboardLock) { if (clipboard == null) { throw new EmptyClipboardException(); } + //FAWE end return clipboard; } } + //FAWE start @Nullable public ClipboardHolder getExistingClipboard() { synchronized (clipboardLock) { @@ -810,6 +812,7 @@ public class LocalSession implements TextureHolder { } setClipboard(multi); } + //FAWE end /** * Sets the clipboard. @@ -819,6 +822,7 @@ public class LocalSession implements TextureHolder { * @param clipboard the clipboard, or null if the clipboard is to be cleared */ public void setClipboard(@Nullable ClipboardHolder clipboard) { + //FAWE start synchronized (clipboardLock) { if (this.clipboard == clipboard) { return; @@ -829,6 +833,7 @@ public class LocalSession implements TextureHolder { this.clipboard.close(); } } + //FAWE end this.clipboard = clipboard; } } @@ -967,7 +972,9 @@ public class LocalSession implements TextureHolder { @Nullable public BlockBag getBlockBag(Player player) { checkNotNull(player); + //FAWE start - inventory mode if (!useInventory && player.getLimit().INVENTORY_MODE == 0) { + //FAWE end return null; } return player.getInventoryBlockBag(); @@ -1044,6 +1051,7 @@ public class LocalSession implements TextureHolder { } } + //FAWE start @Nullable public Tool getTool(Player player) { loadDefaults(player, false); @@ -1087,7 +1095,9 @@ public class LocalSession implements TextureHolder { } } } + //FAWE end + //FAWE start - see deprecation note /** * Get the brush tool assigned to the item. If there is no tool assigned * or the tool is not assigned, the slot will be replaced with the @@ -1114,7 +1124,7 @@ public class LocalSession implements TextureHolder { public BrushTool getBrushTool(BaseItem item, Player player, boolean create) throws InvalidToolBindException { if (item.getType().hasBlockType()) { - throw new InvalidToolBindException(item.getType(), "Blocks can't be used"); + throw new InvalidToolBindException(item.getType(), Caption.of("worldedit.error.blocks-cant-be-used")); } Tool tool = getTool(item, player); if (!(tool instanceof BrushTool)) { @@ -1128,7 +1138,9 @@ public class LocalSession implements TextureHolder { return (BrushTool) tool; } + //FAWE end + //FAWE start - see note of getBrushTool /** * Set the tool. * @@ -1138,7 +1150,7 @@ public class LocalSession implements TextureHolder { */ public void setTool(ItemType item, @Nullable Tool tool) throws InvalidToolBindException { if (item.hasBlockType()) { - throw new InvalidToolBindException(item, "Blocks can't be used"); + throw new InvalidToolBindException(item, Caption.of("worldedit.error.blocks-cant-be-used")); } if (tool instanceof SelectionWand) { changeTool(this.wandItem, this.wandItem = item, tool); @@ -1175,7 +1187,7 @@ public class LocalSession implements TextureHolder { public void setTool(BaseItem item, @Nullable Tool tool, Player player) throws InvalidToolBindException { ItemType type = item.getType(); if (type.hasBlockType() && type.getBlockType().getMaterial().isAir()) { - throw new InvalidToolBindException(type, "Blocks can't be used"); + throw new InvalidToolBindException(type, Caption.of("worldedit.error.blocks-cant-be-used")); } else if (tool instanceof SelectionWand) { changeTool(this.wandItem, this.wandItem = item.getType(), tool); setDirty(); @@ -1208,6 +1220,7 @@ public class LocalSession implements TextureHolder { } } } + //FAWE end /** * Returns whether inventory usage is enabled for this session. @@ -1380,7 +1393,9 @@ public class LocalSession implements TextureHolder { public void describeCUI(Actor actor) { checkNotNull(actor); + //FAWE start // TODO preload + //FAWE end if (!hasCUISupport) { return; @@ -1518,6 +1533,7 @@ public class LocalSession implements TextureHolder { } // Create an edit session + //FAWE start - we don't use the edit session builder yet EditSession editSession; EditSessionBuilder builder = new EditSessionBuilder(world); if (actor.isPlayer() && actor instanceof Player) { @@ -1543,6 +1559,7 @@ public class LocalSession implements TextureHolder { return editSession; } + //FAWE end private void prepareEditingExtents(EditSession editSession, Actor actor) { editSession.setSideEffectApplier(sideEffectSet); @@ -1617,6 +1634,7 @@ public class LocalSession implements TextureHolder { return mask; } + //FAWE start /** * Get the mask. * @@ -1625,6 +1643,7 @@ public class LocalSession implements TextureHolder { public Mask getSourceMask() { return sourceMask; } + //FAWE end /** * Set a mask. @@ -1635,6 +1654,7 @@ public class LocalSession implements TextureHolder { this.mask = mask; } + //FAWE start /** * Set a mask. * @@ -1662,6 +1682,7 @@ public class LocalSession implements TextureHolder { } return tmp; } + //FAWE end /** * Get the preferred wand item for this user, or {@code null} to use the default diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java index 7127e6d76..256504cd3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/TracedEditSession.java @@ -24,7 +24,10 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.World; -public class TracedEditSession extends EditSession { +/** + * Internal use only. + */ +class TracedEditSession extends EditSession { TracedEditSession(EventBus eventBus, World world, int maxBlocks, BlockBag blockBag, EditSessionEvent event) { super(eventBus, world, maxBlocks, blockBag, event); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index e4cbe67af..c87d35a15 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -59,7 +59,6 @@ import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.util.formatting.text.TextComponent; -import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException; import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameResolutionException; @@ -123,10 +122,12 @@ public final class WorldEdit { private final SessionManager sessions = new SessionManager(this); private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s")); private final Supervisor supervisor = new SimpleSupervisor(); + //FAWE start private final LazyReference translationManager = LazyReference.from(() -> new TranslationManager( WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.CONFIGURATION).getResourceLoader() )); + //FAWE end private final BlockFactory blockFactory = new BlockFactory(this); private final ItemFactory itemFactory = new ItemFactory(this); @@ -423,6 +424,7 @@ public final class WorldEdit { } } + //FAWE start public void checkMaxBrushRadius(Expression radius) throws MaxBrushRadiusException { double val = radius.evaluate(); checkArgument(val >= 0, "Radius must be a positive number."); @@ -432,6 +434,7 @@ public final class WorldEdit { } } } + //FAWE end /** * Get a file relative to the defined working directory. If the specified @@ -462,7 +465,7 @@ public final class WorldEdit { return getConfiguration().getWorkingDirectoryPath().resolve(path); } - //FAWE + //FAWE start /** * Gets the path to the folder in which schematics are saved by default * @@ -471,6 +474,7 @@ public final class WorldEdit { public Path getSchematicsFolderPath() { return getWorkingDirectoryPath(getConfiguration().saveDir); } + //FAWE end /** * Get the direction vector for a player's direction. @@ -782,7 +786,7 @@ public final class WorldEdit { logger.warn("Failed to execute script", e); } finally { for (EditSession editSession : scriptContext.getEditSessions()) { - editSession.flushSession(); + editSession.close(); session.remember(editSession); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java index 503d40e43..e21b72515 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditException.java @@ -28,7 +28,9 @@ import java.util.Locale; /** * Parent for all WorldEdit exceptions. */ +//FAWE start - RuntimeException > Exception public abstract class WorldEditException extends RuntimeException { +//FAWE end private final Component message; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java index 8c1a01e54..dfaa5a117 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItem.java @@ -42,7 +42,9 @@ public class BaseItem implements NbtValued { private ItemType itemType; @Nullable + //FAWE start - Use LR & CBT over CompoundTag private LazyReference nbtData; + //FAWE end /** * Construct the object. @@ -54,6 +56,25 @@ public class BaseItem implements NbtValued { this.itemType = itemType; } + /** + * Get the type of item. + * + * @return the type + */ + public ItemType getType() { + return this.itemType; + } + + /** + * Set the type of the item. + * + * @param itemType The type to set + */ + public void setType(ItemType itemType) { + this.itemType = itemType; + } + + //FAWE start /** * Construct the object. * @@ -83,24 +104,6 @@ public class BaseItem implements NbtValued { return null; } - /** - * Get the type of item. - * - * @return the type - */ - public ItemType getType() { - return this.itemType; - } - - /** - * Set the type of the item. - * - * @param itemType The type to set - */ - public void setType(ItemType itemType) { - this.itemType = itemType; - } - @Nullable @Override public LazyReference getNbtReference() { @@ -126,4 +129,5 @@ public class BaseItem implements NbtValued { return getType().getId() + nbtString; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java index 8d9e4ab07..fd835d6a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseItemStack.java @@ -70,18 +70,6 @@ public class BaseItemStack extends BaseItem { this.amount = amount; } - /** - * Construct the object. - * - * @param id The item type - * @param tag Tag value - * @param amount amount in the stack - */ - public BaseItemStack(ItemType id, LazyReference tag, int amount) { - super(id, tag); - this.amount = amount; - } - /** * Get the number of items in the stack. * @@ -104,4 +92,18 @@ public class BaseItemStack extends BaseItem { return WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getRichName(this); } + + //FAWE start + /** + * Construct the object. + * + * @param id The item type + * @param tag Tag value + * @param amount amount in the stack + */ + public BaseItemStack(ItemType id, LazyReference tag, int amount) { + super(id, tag); + this.amount = amount; + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/TileEntityBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/TileEntityBlock.java index ec2608876..8abaacee2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/TileEntityBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/TileEntityBlock.java @@ -37,6 +37,7 @@ public interface TileEntityBlock extends NbtValued { * * @return tile entity ID, non-null string */ + //FAWE start - Handle method here default String getNbtId() { CompoundTag nbtData = getNbtData(); if (nbtData == null) { @@ -48,6 +49,7 @@ public interface TileEntityBlock extends NbtValued { } else { return ""; } + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java index c9c6cedc5..a7a329ef2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ApplyBrushCommands.java @@ -34,7 +34,7 @@ import com.sk89q.worldedit.command.util.PermissionCondition; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.function.factory.Apply; +import com.sk89q.worldedit.function.factory.ApplyRegion; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; @@ -97,7 +97,7 @@ public class ApplyBrushCommands { double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class)); RegionFactory regionFactory = REGION_FACTORY.value(parameters).asSingle(RegionFactory.class); BrushCommands.setOperationBasedBrush(player, localSession, Expression.compile(Double.toString(radius)), - new Apply(generatorFactory), regionFactory, "worldedit.brush.apply"); + new ApplyRegion(generatorFactory), regionFactory, "worldedit.brush.apply"); } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 9fbea73d9..47bfbe237 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -23,43 +23,42 @@ import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.brush.BlendBall; -import com.fastasyncworldedit.core.object.brush.BlobBrush; -import com.fastasyncworldedit.core.object.brush.BrushSettings; -import com.fastasyncworldedit.core.object.brush.CatenaryBrush; -import com.fastasyncworldedit.core.object.brush.CircleBrush; -import com.fastasyncworldedit.core.object.brush.CommandBrush; -import com.fastasyncworldedit.core.object.brush.CopyPastaBrush; -import com.fastasyncworldedit.core.object.brush.ErodeBrush; -import com.fastasyncworldedit.core.object.brush.FallingSphere; -import com.fastasyncworldedit.core.object.brush.FlattenBrush; -import com.fastasyncworldedit.core.object.brush.HeightBrush; -import com.fastasyncworldedit.core.object.brush.ImageBrush; -import com.fastasyncworldedit.core.object.brush.LayerBrush; -import com.fastasyncworldedit.core.object.brush.LineBrush; -import com.fastasyncworldedit.core.object.brush.PopulateSchem; -import com.fastasyncworldedit.core.object.brush.RaiseBrush; -import com.fastasyncworldedit.core.object.brush.RecurseBrush; -import com.fastasyncworldedit.core.object.brush.ScatterBrush; -import com.fastasyncworldedit.core.object.brush.ScatterCommand; -import com.fastasyncworldedit.core.object.brush.ScatterOverlayBrush; -import com.fastasyncworldedit.core.object.brush.ShatterBrush; -import com.fastasyncworldedit.core.object.brush.SplatterBrush; -import com.fastasyncworldedit.core.object.brush.SplineBrush; -import com.fastasyncworldedit.core.object.brush.StencilBrush; -import com.fastasyncworldedit.core.object.brush.SurfaceSphereBrush; -import com.fastasyncworldedit.core.object.brush.SurfaceSpline; -import com.fastasyncworldedit.core.object.brush.heightmap.ScalableHeightMap; -import com.fastasyncworldedit.core.object.brush.heightmap.ScalableHeightMap.Shape; -import com.fastasyncworldedit.core.object.brush.sweep.SweepBrush; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; -import com.fastasyncworldedit.core.object.io.PGZIPOutputStream; -import com.fastasyncworldedit.core.object.mask.IdMask; +import com.fastasyncworldedit.core.command.tool.brush.BlendBall; +import com.fastasyncworldedit.core.command.tool.brush.BlobBrush; +import com.fastasyncworldedit.core.command.tool.brush.BrushSettings; +import com.fastasyncworldedit.core.command.tool.brush.CatenaryBrush; +import com.fastasyncworldedit.core.command.tool.brush.CircleBrush; +import com.fastasyncworldedit.core.command.tool.brush.CommandBrush; +import com.fastasyncworldedit.core.command.tool.brush.CopyPastaBrush; +import com.fastasyncworldedit.core.command.tool.brush.ErodeBrush; +import com.fastasyncworldedit.core.command.tool.brush.FallingSphere; +import com.fastasyncworldedit.core.command.tool.brush.FlattenBrush; +import com.fastasyncworldedit.core.command.tool.brush.HeightBrush; +import com.fastasyncworldedit.core.command.tool.brush.ImageBrush; +import com.fastasyncworldedit.core.command.tool.brush.LayerBrush; +import com.fastasyncworldedit.core.command.tool.brush.LineBrush; +import com.fastasyncworldedit.core.command.tool.brush.PopulateSchem; +import com.fastasyncworldedit.core.command.tool.brush.RaiseBrush; +import com.fastasyncworldedit.core.command.tool.brush.RecurseBrush; +import com.fastasyncworldedit.core.command.tool.brush.ScatterBrush; +import com.fastasyncworldedit.core.command.tool.brush.ScatterCommand; +import com.fastasyncworldedit.core.command.tool.brush.ScatterOverlayBrush; +import com.fastasyncworldedit.core.command.tool.brush.ShatterBrush; +import com.fastasyncworldedit.core.command.tool.brush.SplatterBrush; +import com.fastasyncworldedit.core.command.tool.brush.SplineBrush; +import com.fastasyncworldedit.core.command.tool.brush.StencilBrush; +import com.fastasyncworldedit.core.command.tool.brush.SurfaceSphereBrush; +import com.fastasyncworldedit.core.command.tool.brush.SurfaceSpline; +import com.fastasyncworldedit.core.extent.processor.heightmap.ScalableHeightMap; +import com.fastasyncworldedit.core.extent.processor.heightmap.ScalableHeightMap.Shape; +import com.fastasyncworldedit.core.command.tool.sweep.SweepBrush; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.function.mask.IdMask; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.StringMan; import com.fastasyncworldedit.core.util.image.ImageUtil; -import com.sk89q.minecraft.util.commands.Step; +import com.sk89q.worldedit.command.util.annotation.Step; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; @@ -93,10 +92,10 @@ import com.sk89q.worldedit.function.factory.Deform; import com.sk89q.worldedit.function.factory.Paint; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.SingleBlockTypeMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.internal.annotation.PatternList; +import com.sk89q.worldedit.command.util.annotation.PatternList; import com.sk89q.worldedit.internal.annotation.ClipboardMask; import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.math.BlockVector3; @@ -108,10 +107,11 @@ import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.event.ClickEvent; -import com.sk89q.worldedit.world.block.BlockID; +import com.fastasyncworldedit.core.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import org.anarres.parallelgzip.ParallelGZIPOutputStream; import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.param.Arg; @@ -158,6 +158,7 @@ public class BrushCommands { this.worldEdit = worldEdit; } + //FAWE start @Command(name = "blendball", aliases = { "bb", @@ -403,6 +404,622 @@ public class BrushCommands { set(context, brush).setSize(max).setFill(fill); } + @Command( + name = "shatter", + aliases = { "partition", "split"}, + desc = "Creates random lines to break the terrain into pieces", + descFooter = "Creates uneven lines separating terrain into multiple pieces\n" + + "Pic: https://i.imgur.com/2xKsZf2.png" + ) + @CommandPermissions("worldedit.brush.shatter") + public void shatterBrush(EditSession editSession, InjectedValueAccess context, + @Arg(desc = "Pattern") + Pattern fill, + @Arg(desc = "The radius to sample for blending", def = "10") + Expression radius, + @Arg(desc = "Lines", def = "10") + int count) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + set(context, new ShatterBrush(count)).setSize(radius).setFill(fill) + .setMask(new ExistingBlockMask(editSession)); + } + + @Command( + name = "stencil", + desc = "Use a height map to paint a surface", + descFooter = "Use a height map to paint any surface." + ) + @CommandPermissions("worldedit.brush.stencil") + public void stencilBrush(LocalSession session, InjectedValueAccess context, + @Arg(desc = "Pattern") + Pattern fill, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Arg(desc = "String", def = "") + String image, + @Arg(def = "0", desc = "rotation") + @Range(from = 0, to = 360) + int rotation, + @Arg(desc = "double", def = "1") + double yscale, + @Switch(name = 'w', desc = "Apply at maximum saturation") + boolean onlyWhite, + @Switch(name = 'r', desc = "Apply random rotation") + boolean randomRotate) + throws WorldEditException, FileNotFoundException { + worldEdit.checkMaxBrushRadius(radius); + InputStream stream = getHeightmapStream(image); + HeightBrush brush; + try { + brush = new StencilBrush(stream, rotation, yscale, onlyWhite, + "#clipboard".equalsIgnoreCase(image) + ? session.getClipboard().getClipboard() : null); + } catch (EmptyClipboardException ignored) { + brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null); + } + if (randomRotate) { + brush.setRandomRotate(true); + } + set(context, brush).setSize(radius).setFill(fill); + } + + @Command(name = "image", + desc = "Use a height map to paint a surface", + descFooter = "Use a height map to paint any surface.\n") + @CommandPermissions("worldedit.brush.image") + public void imageBrush(LocalSession session, + InjectedValueAccess context, + @Arg(desc = "Image URL (imgur only)") String imageURL, + @Arg(desc = "The size of the brush", def = "5") Expression radius, + @Arg(def = "1", desc = "scale height") double yscale, + @Switch(name = 'a', desc = "Use image Alpha") boolean alpha, + @Switch(name = 'f', desc = "Blend the image with existing terrain") boolean fadeOut) + throws WorldEditException, IOException { + URL url = new URL(imageURL); + if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { + throw new IOException("Only i.imgur.com links are allowed!"); + } + BufferedImage image = MainUtil.readImage(url); + worldEdit.checkMaxBrushRadius(radius); + if (yscale != 1) { + ImageUtil.scaleAlpha(image, yscale); + alpha = true; + } + if (fadeOut) { + ImageUtil.fadeAlpha(image); + alpha = true; + } + ImageBrush brush = new ImageBrush(image, session, alpha); + set(context, brush).setSize(radius); + } + + @Command( + name = "surface", + aliases = { "surf" }, + desc = "Use a height map to paint a surface", + descFooter = "Use a height map to paint any surface." + ) + @CommandPermissions("worldedit.brush.surface") + public void surfaceBrush(InjectedValueAccess context, + @Arg(desc = "Pattern") + Pattern fill, + @Arg(desc = "Expression", def = "5") + Expression radius) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); + } + + @Command( + name = "scatter", + desc = "Scatter a pattern on a surface", + descFooter = + "Set a number of blocks randomly on a surface each a certain distance apart.\n" + + "Video: https://youtu.be/RPZIaTbqoZw?t=34s" + ) + @CommandPermissions("worldedit.brush.scatter") + public void scatterBrush(InjectedValueAccess context, + @Arg(desc = "Pattern") + Pattern fill, + @Arg(desc = "radius", def = "5") + Expression radius, + @Arg(desc = "points", def = "5") + double points, + @Arg(desc = "distance", def = "1") + double distance, + @Switch(name = 'o', desc = "Overlay the block") + boolean overlay) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + Brush brush; + if (overlay) { + brush = new ScatterOverlayBrush((int) points, (int) distance); + } else { + brush = new ScatterBrush((int) points, (int) distance); + } + set(context, brush).setSize(radius).setFill(fill); + } + + @Command( + name = "populateschematic", + aliases = { + "populateschem", + "popschem", + "pschem", + "ps" + }, + desc = "Scatter a schematic on a surface" + ) + @CommandPermissions("worldedit.brush.populateschematic") + public void scatterSchemBrush(Player player, InjectedValueAccess context, + @Arg(desc = "Mask") + Mask mask, + @Arg(name = "clipboard", desc = "Clipboard uri") + String clipboardStr, + @Arg(desc = "Expression", def = "30") + Expression radius, + @Arg(desc = "double", def = "50") + double density, + @Switch(name = 'r', desc = "Apply random rotation") + boolean rotate) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + try { + MultiClipboardHolder clipboards = + ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true); + if (clipboards == null) { + player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr)); + return; + } + List holders = clipboards.getHolders(); + if (holders == null) { + player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr)); + return; + } + + set(context, new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Command( + name = "layer", + desc = "Replaces terrain with a layer.", + descFooter = "Replaces terrain with a layer.\n" + + "Example: /br layer oak_planks orange_stained_glass magenta_stained_glass black_wool - Places several layers on a surface\n" + + "Pic: https://i.imgur.com/XV0vYoX.png" + ) + @CommandPermissions("worldedit.brush.layer") + public void surfaceLayer(InjectedValueAccess context, + @Arg(desc = "Expression") + Expression radius, + @Arg(desc = "List of comma-separated patterns") + @PatternList() + List patternLayers) + throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + set(context, new LayerBrush(patternLayers.toArray(new Pattern[0]))).setSize(radius); + } + + @Command( + name = "splatter", + desc = "Splatter a pattern on a surface", + descFooter = "Sets a bunch of blocks randomly on a surface.\n" + + "Pic: https://i.imgur.com/hMD29oO.png\n" + + "Example: /br splatter stone,dirt 30 15\n" + + "Note: The seeds define how many splotches there are, recursion defines how large, " + + "solid defines whether the pattern is applied per seed, else per block." + ) + @CommandPermissions("worldedit.brush.splatter") + public void splatterBrush(InjectedValueAccess context, + @Arg(desc = "Pattern") + Pattern fill, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Arg(desc = "double", def = "1") + double points, + @Arg(desc = "double", def = "5") + double recursion, + @Arg(desc = "boolean", def = "true") + boolean solid) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius) + .setFill(fill); + } + + @Command( + name = "scattercommand", + aliases = { + "scattercmd", + "scmd", + "scommand" + }, + desc = "Run commands at random points on a surface", + descFooter = "Run commands at random points on a surface\n" + + " - Your selection will be expanded to the specified size around each point\n" + + " - Placeholders: {x}, {y}, {z}, {world}, {size}" + ) + @CommandPermissions("worldedit.brush.scattercommand") + public void scatterCommandBrush(Player player, InjectedValueAccess context, + @Arg(desc = "The minimum distance between each point") + Expression radius, + @Arg(desc = "double", def = "1") + double points, + @Arg(desc = "double", def = "1") + double distance, + @Arg(desc = "List of comma-separated commands") + List commandStr) + throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + set(context, + new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "))) + .setSize(radius); + } + + @Command( + name = "height", + aliases = { "heightmap" }, + desc = "Raise or lower terrain using a heightmap", + descFooter = "This brush raises and lowers land.\n" + + "Note: Use a negative yscale to reduce height\n" + + "Snow Pic: https://i.imgur.com/Hrzn0I4.png" + ) + @CommandPermissions("worldedit.brush.height") + public void heightBrush(LocalSession session, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Arg(desc = "String", def = "") + String image, + @Arg(def = "0", desc = "rotation") + @Range(from = 0, to = 360) + int rotation, + @Arg(desc = "double", def = "1") + double yscale, + @Switch(name = 'r', desc = "Random off-axis rotation") + boolean randomRotate, + @Switch(name = 'l', desc = "Work on snow layers") + boolean layers, + @Switch(name = 's', desc = "Disable smoothing") + boolean dontSmooth, InjectedValueAccess context) + throws WorldEditException, FileNotFoundException { + terrainBrush(session, radius, image, rotation, yscale, false, randomRotate, layers, + !dontSmooth, ScalableHeightMap.Shape.CONE, context); + } + + @Command( + name = "cliff", + aliases = { "flatcylinder" }, + desc = "Cliff brush", + descFooter = "This brush flattens terrain and creates cliffs." + ) + @CommandPermissions("worldedit.brush.height") + public void cliffBrush(LocalSession session, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Arg(desc = "String", def = "") + String image, + @Arg(def = "0", desc = "rotation") + @Step(90) + @Range(from = 0, to = 360) + int rotation, + @Arg(desc = "double", def = "1") + double yscale, + @Switch(name = 'r', desc = "Enables random off-axis rotation") + boolean randomRotate, + @Switch(name = 'l', desc = "Will work on snow layers") + boolean layers, + @Switch(name = 's', desc = "Disables smoothing") + boolean dontSmooth, InjectedValueAccess context) + throws WorldEditException, FileNotFoundException { + terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, + !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); + } + + @Command( + name = "flatten", + aliases = { + "flatmap", + "flat" + }, + desc = "This brush raises or lowers land towards the clicked point" + ) + @CommandPermissions("worldedit.brush.height") + public void flattenBrush(LocalSession session, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Arg(desc = "String", def = "") + String image, + @Arg(def = "0", desc = "rotation") + @Step(90) + @Range(from = 0, to = 360) + int rotation, + @Arg(desc = "double", def = "1") + double yscale, + @Switch(name = 'r', desc = "Enables random off-axis rotation") + boolean randomRotate, + @Switch(name = 'l', desc = "Will work on snow layers") + boolean layers, + @Switch(name = 's', desc = "Disables smoothing") + boolean dontSmooth, InjectedValueAccess context) + throws WorldEditException, FileNotFoundException { + terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, + !dontSmooth, ScalableHeightMap.Shape.CONE, context); + } + + private void terrainBrush(LocalSession session, Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context) + throws WorldEditException, FileNotFoundException { + worldEdit.checkMaxBrushRadius(radius); + InputStream stream = getHeightmapStream(image); + HeightBrush brush; + if (flat) { + try { + brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, + "#clipboard".equalsIgnoreCase(image) + ? session.getClipboard().getClipboard() : null, shape); + } catch (EmptyClipboardException ignored) { + brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape); + } + } else { + try { + brush = new HeightBrush(stream, rotation, yscale, layers, smooth, + "#clipboard".equalsIgnoreCase(image) + ? session.getClipboard().getClipboard() : null); + } catch (EmptyClipboardException ignored) { + brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null); + } + } + if (randomRotate) { + brush.setRandomRotate(true); + } + set(context, brush).setSize(radius); + } + + private InputStream getHeightmapStream(String filename) throws FileNotFoundException { + if (filename == null || "none".equalsIgnoreCase(filename)) { + return null; + } + String filenamePng = filename.endsWith(".png") ? filename : filename + ".png"; + File file = new File(Fawe.imp().getDirectory(), + Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng); + if (file.exists()) { + return new FileInputStream(file); + } + URI uri = ImageUtil.getImageURI(filename); + return ImageUtil.getInputStream(uri); + } + + + @Command( + name = "copypaste", + aliases = { + "cp", + "copypasta" + }, + desc = "Copy Paste brush", + descFooter = "Left click the base of an object to copy.\n" + "Right click to paste\n" + + "Note: Works well with the clipboard scroll action\n" + + "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" + ) + @CommandPermissions("worldedit.brush.copy") + public void copy(Player player, LocalSession session, InjectedValueAccess context, + @Arg(desc = "Expression", def = "5") + Expression radius, + @Switch(name = 'r', desc = "Apply random rotation on paste") + boolean randomRotate, + @Switch(name = 'a', desc = "Apply auto view based rotation on paste") + boolean autoRotate) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius))); + + set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate)).setSize(radius); + } + + @Command( + name = "command", + aliases = { "cmd" }, + desc = "Command brush", + descFooter = "Run the commands at the clicked position.\n" + + " - Your selection will be expanded to the specified size around each point\n" + + " - Placeholders: {x}, {y}, {z}, {world}, {size}" + ) + @CommandPermissions("worldedit.brush.command") + public void command(InjectedValueAccess context, + @Arg(desc = "Expression") + Expression radius, + @Arg(desc = "Command to run") + List input) throws WorldEditException { + worldEdit.checkMaxBrushRadius(radius); + String cmd = StringMan.join(input, " "); + set(context, new CommandBrush(cmd)).setSize(radius); + } + + @Command( + name = "savebrush", + aliases = { "save" }, + desc = "Save your current brush" + ) + @CommandPermissions("worldedit.brush.save") + public void saveBrush(Player player, LocalSession session, + @Arg(desc = "String name") + String name, + @Switch(name = 'g', desc = "Save the brush globally") + boolean root) throws WorldEditException, IOException { + BrushTool tool = session.getBrushTool(player); + if (tool != null) { + root |= name.startsWith("../"); + name = FileSystems.getDefault().getPath(name).getFileName().toString(); + File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); + name = name.endsWith(".jsgz") ? name : name + ".jsgz"; + File file; + if (root && player.hasPermission("worldedit.brush.save.other")) { + file = new File(folder, name); + } else { + file = new File(folder, player.getUniqueId() + File.separator + name); + } + File parent = file.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + file.createNewFile(); + try (DataOutputStream out = new DataOutputStream( + new ParallelGZIPOutputStream(new FileOutputStream(file)))) { + out.writeUTF(tool.toString()); + } catch (Throwable e) { + e.printStackTrace(); + } + player.print(Caption.of("fawe.worldedit.schematic.schematic.saved", name)); + } else { + player.print(Caption.of("fawe.worldedit.brush.brush.none")); + } + } + + // TODO: Write a Brush standard format. + /* @Command( + name = "loadbrush", + aliases = {"load"}, + desc = "Load a brush" + ) + @CommandPermissions("worldedit.brush.load") + public void loadBrush(Player player, LocalSession session, @Arg(desc = "String name") String name) + throws WorldEditException, IOException { + name = FileSystems.getDefault().getPath(name).getFileName().toString(); + File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); + name = name.endsWith(".jsgz") ? name : name + ".jsgz"; + File file = new File(folder, player.getUniqueId() + File.separator + name); + if (!file.exists()) { + file = new File(folder, name); + } + if (!file.exists()) { + File[] files = folder.listFiles(pathname -> false); + player.print(Caption.of("fawe.error.brush.not.found", name)); + return; + } + try (DataInputStream in = new DataInputStream( + new GZIPInputStream(new FileInputStream(file)))) { + String json = in.readUTF(); + BrushTool tool = BrushTool.fromString(player, session, json); + BaseItem item = player.getItemInHand(HandSide.MAIN_HAND); + session.setTool(item, tool, player); + player.print(Caption.of("fawe.worldedit.brush.brush.equipped", name)); + } catch (Throwable e) { + e.printStackTrace(); + player.print(Caption.of("fawe.error.brush.incompatible")); + } + } */ + + @Command( + name = "/listbrush", + desc = "List saved brushes", + descFooter = "List all brushes in the brush directory") + @CommandPermissions("worldedit.brush.list") + public void list(Actor actor, InjectedValueAccess args, + @ArgFlag(name = 'p', desc = "Prints the requested page", def = "0") + int page) throws WorldEditException { + String baseCmd = "/brush loadbrush"; + File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); + // TODO NOT IMPLEMENTED + // UtilityCommands.list(dir, actor, args, page, null, true, baseCmd); + } + + static void setOperationBasedBrush(Player player, LocalSession session, Expression radius, Contextual factory, RegionFactory shape, String permission) + throws WorldEditException { + WorldEdit.getInstance().checkMaxBrushRadius(radius); + BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + tool.setSize(radius); + tool.setFill(null); + tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission); + + player.print(TextComponent.of("Set brush to " + factory)); + } + + @Command( + name = "deform", + desc = "Deform brush, applies an expression to an area" + ) + @CommandPermissions("worldedit.brush.deform") + public void deform(Player player, LocalSession localSession, + @Arg(desc = "The shape of the region") + RegionFactory shape, + @Arg(desc = "The size of the brush", def = "5") + double radius, + @Arg(desc = "Expression to apply", def = "y-=0.2") + String expression, + @Switch(name = 'r', desc = "Use the game's coordinate origin") + boolean useRawCoords, + @Switch(name = 'o', desc = "Use the placement position as the origin") + boolean usePlacement) throws WorldEditException { + Deform deform = new Deform(expression); + if (useRawCoords) { + deform.setMode(Deform.Mode.RAW_COORD); + } else if (usePlacement) { + deform.setMode(Deform.Mode.OFFSET); + deform.setOffset(localSession.getPlacementPosition(player).toVector3()); + } + setOperationBasedBrush(player, localSession, radius, + deform, shape, "worldedit.brush.deform"); + } + + @Command( + name = "set", + desc = "Set brush, sets all blocks in the area" + ) + @CommandPermissions("worldedit.brush.set") + public void set(Player player, LocalSession localSession, + @Arg(desc = "The shape of the region") + RegionFactory shape, + @Arg(desc = "The size of the brush", def = "5") + Expression radius, + @Arg(desc = "The pattern of blocks to set") + Pattern pattern) throws WorldEditException { + setOperationBasedBrush(player, localSession, radius, + new Apply(new ReplaceFactory(pattern)), shape, "worldedit.brush.set"); + } + + @Command( + name = "forest", + desc = "Forest brush, creates a forest in the area" + ) + @CommandPermissions("worldedit.brush.forest") + public void forest(Player player, LocalSession localSession, + @Arg(desc = "The shape of the region") + RegionFactory shape, + @Arg(desc = "The size of the brush", def = "5") + Expression radius, + @Arg(desc = "The density of the brush", def = "20") + double density, + @Arg(desc = "The type of tree to use") + TreeGenerator.TreeType type) throws WorldEditException { + setOperationBasedBrush(player, localSession, radius, + new Paint(new TreeGeneratorFactory(type), density / 100), shape, "worldedit.brush.forest"); + } + + @Command( + name = "raise", + desc = "Raise brush, raise all blocks by one" + ) + @CommandPermissions("worldedit.brush.raise") + public void raise(Player player, LocalSession localSession, + @Arg(desc = "The shape of the region") + RegionFactory shape, + @Arg(desc = "The size of the brush", def = "5") + Expression radius) throws WorldEditException { + setOperationBasedBrush(player, localSession, radius, + new Deform("y-=1"), shape, "worldedit.brush.raise"); + } + + @Command( + name = "lower", + desc = "Lower brush, lower all blocks by one" + ) + @CommandPermissions("worldedit.brush.lower") + public void lower(Player player, LocalSession localSession, + @Arg(desc = "The shape of the region") + RegionFactory shape, + @Arg(desc = "The size of the brush", def = "5") + Expression radius) throws WorldEditException { + setOperationBasedBrush(player, localSession, radius, + new Deform("y+=1"), shape, "worldedit.brush.lower"); + } + //FAWE end + @Command( name = "sphere", aliases = { "s" }, @@ -423,6 +1040,7 @@ public class BrushCommands { if (hollow) { brush = new HollowSphereBrush(); } else { + //FAWE start - Suggest different brush material if sand or gravel is used if (pattern instanceof BlockStateHolder) { BlockType type = ((BlockStateHolder) pattern).getBlockType(); switch (type.getInternalId()) { @@ -443,259 +1061,10 @@ public class BrushCommands { } } + //FAWE end set(context, brush).setSize(radius).setFill(pattern); } - @Command( - name = "shatter", - aliases = { "partition", "split"}, - desc = "Creates random lines to break the terrain into pieces", - descFooter = "Creates uneven lines separating terrain into multiple pieces\n" - + "Pic: https://i.imgur.com/2xKsZf2.png" - ) - @CommandPermissions("worldedit.brush.shatter") - public void shatterBrush(EditSession editSession, InjectedValueAccess context, - @Arg(desc = "Pattern") - Pattern fill, - @Arg(desc = "The radius to sample for blending", def = "10") - Expression radius, - @Arg(desc = "Lines", def = "10") - int count) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - set(context, new ShatterBrush(count)).setSize(radius).setFill(fill) - .setMask(new ExistingBlockMask(editSession)); - } - - @Command( - name = "stencil", - desc = "Use a height map to paint a surface", - descFooter = "Use a height map to paint any surface." - ) - @CommandPermissions("worldedit.brush.stencil") - public void stencilBrush(LocalSession session, InjectedValueAccess context, - @Arg(desc = "Pattern") - Pattern fill, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Arg(desc = "String", def = "") - String image, - @Arg(def = "0", desc = "rotation") - @Range(from = 0, to = 360) - int rotation, - @Arg(desc = "double", def = "1") - double yscale, - @Switch(name = 'w', desc = "Apply at maximum saturation") - boolean onlyWhite, - @Switch(name = 'r', desc = "Apply random rotation") - boolean randomRotate) - throws WorldEditException, FileNotFoundException { - worldEdit.checkMaxBrushRadius(radius); - InputStream stream = getHeightmapStream(image); - HeightBrush brush; - try { - brush = new StencilBrush(stream, rotation, yscale, onlyWhite, - "#clipboard".equalsIgnoreCase(image) - ? session.getClipboard().getClipboard() : null); - } catch (EmptyClipboardException ignored) { - brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null); - } - if (randomRotate) { - brush.setRandomRotate(true); - } - set(context, brush).setSize(radius).setFill(fill); - } - - @Command(name = "image", - desc = "Use a height map to paint a surface", - descFooter = "Use a height map to paint any surface.\n") - @CommandPermissions("worldedit.brush.image") - public void imageBrush(LocalSession session, - InjectedValueAccess context, - @Arg(desc = "Image URL (imgur only)") String imageURL, - @Arg(desc = "The size of the brush", def = "5") Expression radius, - @Arg(def = "1", desc = "scale height") double yscale, - @Switch(name = 'a', desc = "Use image Alpha") boolean alpha, - @Switch(name = 'f', desc = "Blend the image with existing terrain") boolean fadeOut) - throws WorldEditException, IOException { - URL url = new URL(imageURL); - if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { - throw new IOException("Only i.imgur.com links are allowed!"); - } - BufferedImage image = MainUtil.readImage(url); - worldEdit.checkMaxBrushRadius(radius); - if (yscale != 1) { - ImageUtil.scaleAlpha(image, yscale); - alpha = true; - } - if (fadeOut) { - ImageUtil.fadeAlpha(image); - alpha = true; - } - ImageBrush brush = new ImageBrush(image, session, alpha); - set(context, brush).setSize(radius); - } - - @Command( - name = "surface", - aliases = { "surf" }, - desc = "Use a height map to paint a surface", - descFooter = "Use a height map to paint any surface." - ) - @CommandPermissions("worldedit.brush.surface") - public void surfaceBrush(InjectedValueAccess context, - @Arg(desc = "Pattern") - Pattern fill, - @Arg(desc = "Expression", def = "5") - Expression radius) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); - } - - @Command( - name = "scatter", - desc = "Scatter a pattern on a surface", - descFooter = - "Set a number of blocks randomly on a surface each a certain distance apart.\n" - + "Video: https://youtu.be/RPZIaTbqoZw?t=34s" - ) - @CommandPermissions("worldedit.brush.scatter") - public void scatterBrush(InjectedValueAccess context, - @Arg(desc = "Pattern") - Pattern fill, - @Arg(desc = "radius", def = "5") - Expression radius, - @Arg(desc = "points", def = "5") - double points, - @Arg(desc = "distance", def = "1") - double distance, - @Switch(name = 'o', desc = "Overlay the block") - boolean overlay) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - Brush brush; - if (overlay) { - brush = new ScatterOverlayBrush((int) points, (int) distance); - } else { - brush = new ScatterBrush((int) points, (int) distance); - } - set(context, brush).setSize(radius).setFill(fill); - } - - @Command( - name = "populateschematic", - aliases = { - "populateschem", - "popschem", - "pschem", - "ps" - }, - desc = "Scatter a schematic on a surface" - ) - @CommandPermissions("worldedit.brush.populateschematic") - public void scatterSchemBrush(Player player, InjectedValueAccess context, - @Arg(desc = "Mask") - Mask mask, - @Arg(name = "clipboard", desc = "Clipboard uri") - String clipboardStr, - @Arg(desc = "Expression", def = "30") - Expression radius, - @Arg(desc = "double", def = "50") - double density, - @Switch(name = 'r', desc = "Apply random rotation") - boolean rotate) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - try { - MultiClipboardHolder clipboards = - ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true); - if (clipboards == null) { - player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr)); - return; - } - List holders = clipboards.getHolders(); - if (holders == null) { - player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr)); - return; - } - - set(context, new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Command( - name = "layer", - desc = "Replaces terrain with a layer.", - descFooter = "Replaces terrain with a layer.\n" - + "Example: /br layer oak_planks orange_stained_glass magenta_stained_glass black_wool - Places several layers on a surface\n" - + "Pic: https://i.imgur.com/XV0vYoX.png" - ) - @CommandPermissions("worldedit.brush.layer") - public void surfaceLayer(InjectedValueAccess context, - @Arg(desc = "Expression") - Expression radius, - @Arg(desc = "List of comma-separated patterns") - @PatternList() - List patternLayers) - throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - set(context, new LayerBrush(patternLayers.toArray(new Pattern[0]))).setSize(radius); - } - - @Command( - name = "splatter", - desc = "Splatter a pattern on a surface", - descFooter = "Sets a bunch of blocks randomly on a surface.\n" - + "Pic: https://i.imgur.com/hMD29oO.png\n" - + "Example: /br splatter stone,dirt 30 15\n" - + "Note: The seeds define how many splotches there are, recursion defines how large, " - + "solid defines whether the pattern is applied per seed, else per block." - ) - @CommandPermissions("worldedit.brush.splatter") - public void splatterBrush(InjectedValueAccess context, - @Arg(desc = "Pattern") - Pattern fill, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Arg(desc = "double", def = "1") - double points, - @Arg(desc = "double", def = "5") - double recursion, - @Arg(desc = "boolean", def = "true") - boolean solid) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius) - .setFill(fill); - } - - @Command( - name = "scattercommand", - aliases = { - "scattercmd", - "scmd", - "scommand" - }, - desc = "Run commands at random points on a surface", - descFooter = "Run commands at random points on a surface\n" - + " - Your selection will be expanded to the specified size around each point\n" - + " - Placeholders: {x}, {y}, {z}, {world}, {size}" - ) - @CommandPermissions("worldedit.brush.scattercommand") - public void scatterCommandBrush(Player player, InjectedValueAccess context, - @Arg(desc = "The minimum distance between each point") - Expression radius, - @Arg(desc = "double", def = "1") - double points, - @Arg(desc = "double", def = "1") - double distance, - @Arg(desc = "List of comma-separated commands") - List commandStr) - throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - set(context, - new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "))) - .setSize(radius); - } - @Command( name = "cylinder", aliases = { "cyl", "c" }, @@ -815,183 +1184,6 @@ public class BrushCommands { set(context, new GravityBrush(fromMaxY)).setSize(radius); } - @Command( - name = "height", - aliases = { "heightmap" }, - desc = "Raise or lower terrain using a heightmap", - descFooter = "This brush raises and lowers land.\n" - + "Note: Use a negative yscale to reduce height\n" - + "Snow Pic: https://i.imgur.com/Hrzn0I4.png" - ) - @CommandPermissions("worldedit.brush.height") - public void heightBrush(LocalSession session, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Arg(desc = "String", def = "") - String image, - @Arg(def = "0", desc = "rotation") - @Range(from = 0, to = 360) - int rotation, - @Arg(desc = "double", def = "1") - double yscale, - @Switch(name = 'r', desc = "Random off-axis rotation") - boolean randomRotate, - @Switch(name = 'l', desc = "Work on snow layers") - boolean layers, - @Switch(name = 's', desc = "Disable smoothing") - boolean dontSmooth, InjectedValueAccess context) - throws WorldEditException, FileNotFoundException { - terrainBrush(session, radius, image, rotation, yscale, false, randomRotate, layers, - !dontSmooth, ScalableHeightMap.Shape.CONE, context); - } - - @Command( - name = "cliff", - aliases = { "flatcylinder" }, - desc = "Cliff brush", - descFooter = "This brush flattens terrain and creates cliffs." - ) - @CommandPermissions("worldedit.brush.height") - public void cliffBrush(LocalSession session, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Arg(desc = "String", def = "") - String image, - @Arg(def = "0", desc = "rotation") - @Step(90) - @Range(from = 0, to = 360) - int rotation, - @Arg(desc = "double", def = "1") - double yscale, - @Switch(name = 'r', desc = "Enables random off-axis rotation") - boolean randomRotate, - @Switch(name = 'l', desc = "Will work on snow layers") - boolean layers, - @Switch(name = 's', desc = "Disables smoothing") - boolean dontSmooth, InjectedValueAccess context) - throws WorldEditException, FileNotFoundException { - terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, - !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); - } - - @Command( - name = "flatten", - aliases = { - "flatmap", - "flat" - }, - desc = "This brush raises or lowers land towards the clicked point" - ) - @CommandPermissions("worldedit.brush.height") - public void flattenBrush(LocalSession session, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Arg(desc = "String", def = "") - String image, - @Arg(def = "0", desc = "rotation") - @Step(90) - @Range(from = 0, to = 360) - int rotation, - @Arg(desc = "double", def = "1") - double yscale, - @Switch(name = 'r', desc = "Enables random off-axis rotation") - boolean randomRotate, - @Switch(name = 'l', desc = "Will work on snow layers") - boolean layers, - @Switch(name = 's', desc = "Disables smoothing") - boolean dontSmooth, InjectedValueAccess context) - throws WorldEditException, FileNotFoundException { - terrainBrush(session, radius, image, rotation, yscale, true, randomRotate, layers, - !dontSmooth, ScalableHeightMap.Shape.CONE, context); - } - - private void terrainBrush(LocalSession session, Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context) - throws WorldEditException, FileNotFoundException { - worldEdit.checkMaxBrushRadius(radius); - InputStream stream = getHeightmapStream(image); - HeightBrush brush; - if (flat) { - try { - brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, - "#clipboard".equalsIgnoreCase(image) - ? session.getClipboard().getClipboard() : null, shape); - } catch (EmptyClipboardException ignored) { - brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape); - } - } else { - try { - brush = new HeightBrush(stream, rotation, yscale, layers, smooth, - "#clipboard".equalsIgnoreCase(image) - ? session.getClipboard().getClipboard() : null); - } catch (EmptyClipboardException ignored) { - brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null); - } - } - if (randomRotate) { - brush.setRandomRotate(true); - } - set(context, brush).setSize(radius); - } - - private InputStream getHeightmapStream(String filename) throws FileNotFoundException { - if (filename == null || "none".equalsIgnoreCase(filename)) { - return null; - } - String filenamePng = filename.endsWith(".png") ? filename : filename + ".png"; - File file = new File(Fawe.imp().getDirectory(), - Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng); - if (file.exists()) { - return new FileInputStream(file); - } - URI uri = ImageUtil.getImageURI(filename); - return ImageUtil.getInputStream(uri); - } - - - @Command( - name = "copypaste", - aliases = { - "cp", - "copypasta" - }, - desc = "Copy Paste brush", - descFooter = "Left click the base of an object to copy.\n" + "Right click to paste\n" - + "Note: Works well with the clipboard scroll action\n" - + "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" - ) - @CommandPermissions("worldedit.brush.copy") - public void copy(Player player, LocalSession session, InjectedValueAccess context, - @Arg(desc = "Expression", def = "5") - Expression radius, - @Switch(name = 'r', desc = "Apply random rotation on paste") - boolean randomRotate, - @Switch(name = 'a', desc = "Apply auto view based rotation on paste") - boolean autoRotate) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius))); - - set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate)).setSize(radius); - } - - @Command( - name = "command", - aliases = { "cmd" }, - desc = "Command brush", - descFooter = "Run the commands at the clicked position.\n" - + " - Your selection will be expanded to the specified size around each point\n" - + " - Placeholders: {x}, {y}, {z}, {world}, {size}" - ) - @CommandPermissions("worldedit.brush.command") - public void command(InjectedValueAccess context, - @Arg(desc = "Expression") - Expression radius, - @Arg(desc = "Command to run") - List input) throws WorldEditException { - worldEdit.checkMaxBrushRadius(radius); - String cmd = StringMan.join(input, " "); - set(context, new CommandBrush(cmd)).setSize(radius); - } - @Command( name = "butcher", aliases = { "kill" }, @@ -1035,6 +1227,7 @@ public class BrushCommands { set(context, new ButcherBrush(flags)).setSize(radius); } + //FAWE start public BrushSettings process(Player player, Arguments arguments, BrushSettings settings) throws WorldEditException { LocalSession session = worldEdit.getSessionManager().get(player); @@ -1081,194 +1274,6 @@ public class BrushCommands { return process(player, arguments, bs); } - @Command( - name = "savebrush", - aliases = { "save" }, - desc = "Save your current brush" - ) - @CommandPermissions("worldedit.brush.save") - public void saveBrush(Player player, LocalSession session, - @Arg(desc = "String name") - String name, - @Switch(name = 'g', desc = "Save the brush globally") - boolean root) throws WorldEditException, IOException { - BrushTool tool = session.getBrushTool(player); - if (tool != null) { - root |= name.startsWith("../"); - name = FileSystems.getDefault().getPath(name).getFileName().toString(); - File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); - name = name.endsWith(".jsgz") ? name : name + ".jsgz"; - File file; - if (root && player.hasPermission("worldedit.brush.save.other")) { - file = new File(folder, name); - } else { - file = new File(folder, player.getUniqueId() + File.separator + name); - } - File parent = file.getParentFile(); - if (!parent.exists()) { - parent.mkdirs(); - } - file.createNewFile(); - try (DataOutputStream out = new DataOutputStream( - new PGZIPOutputStream(new FileOutputStream(file)))) { - out.writeUTF(tool.toString()); - } catch (Throwable e) { - e.printStackTrace(); - } - player.print(Caption.of("fawe.worldedit.schematic.schematic.saved", name)); - } else { - player.print(Caption.of("fawe.worldedit.brush.brush.none")); - } - } - - // TODO: Write a Brush standard format. - /* @Command( - name = "loadbrush", - aliases = {"load"}, - desc = "Load a brush" - ) - @CommandPermissions("worldedit.brush.load") - public void loadBrush(Player player, LocalSession session, @Arg(desc = "String name") String name) - throws WorldEditException, IOException { - name = FileSystems.getDefault().getPath(name).getFileName().toString(); - File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); - name = name.endsWith(".jsgz") ? name : name + ".jsgz"; - File file = new File(folder, player.getUniqueId() + File.separator + name); - if (!file.exists()) { - file = new File(folder, name); - } - if (!file.exists()) { - File[] files = folder.listFiles(pathname -> false); - player.print(Caption.of("fawe.error.brush.not.found", name)); - return; - } - try (DataInputStream in = new DataInputStream( - new GZIPInputStream(new FileInputStream(file)))) { - String json = in.readUTF(); - BrushTool tool = BrushTool.fromString(player, session, json); - BaseItem item = player.getItemInHand(HandSide.MAIN_HAND); - session.setTool(item, tool, player); - player.print(Caption.of("fawe.worldedit.brush.brush.equipped", name)); - } catch (Throwable e) { - e.printStackTrace(); - player.print(Caption.of("fawe.error.brush.incompatible")); - } - } */ - - @Command( - name = "/listbrush", - desc = "List saved brushes", - descFooter = "List all brushes in the brush directory") - @CommandPermissions("worldedit.brush.list") - public void list(Actor actor, InjectedValueAccess args, - @ArgFlag(name = 'p', desc = "Prints the requested page", def = "0") - int page) throws WorldEditException { - String baseCmd = "/brush loadbrush"; - File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); - // TODO NOT IMPLEMENTED - // UtilityCommands.list(dir, actor, args, page, null, true, baseCmd); - } - - static void setOperationBasedBrush(Player player, LocalSession session, Expression radius, Contextual factory, RegionFactory shape, String permission) - throws WorldEditException { - WorldEdit.getInstance().checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); - tool.setSize(radius); - tool.setFill(null); - tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission); - - player.print(TextComponent.of("Set brush to " + factory)); - } - - @Command( - name = "deform", - desc = "Deform brush, applies an expression to an area" - ) - @CommandPermissions("worldedit.brush.deform") - public void deform(Player player, LocalSession localSession, - @Arg(desc = "The shape of the region") - RegionFactory shape, - @Arg(desc = "The size of the brush", def = "5") - double radius, - @Arg(desc = "Expression to apply", def = "y-=0.2") - String expression, - @Switch(name = 'r', desc = "Use the game's coordinate origin") - boolean useRawCoords, - @Switch(name = 'o', desc = "Use the placement position as the origin") - boolean usePlacement) throws WorldEditException { - Deform deform = new Deform(expression); - if (useRawCoords) { - deform.setMode(Deform.Mode.RAW_COORD); - } else if (usePlacement) { - deform.setMode(Deform.Mode.OFFSET); - deform.setOffset(localSession.getPlacementPosition(player).toVector3()); - } - setOperationBasedBrush(player, localSession, radius, - deform, shape, "worldedit.brush.deform"); - } - - @Command( - name = "set", - desc = "Set brush, sets all blocks in the area" - ) - @CommandPermissions("worldedit.brush.set") - public void set(Player player, LocalSession localSession, - @Arg(desc = "The shape of the region") - RegionFactory shape, - @Arg(desc = "The size of the brush", def = "5") - Expression radius, - @Arg(desc = "The pattern of blocks to set") - Pattern pattern) throws WorldEditException { - setOperationBasedBrush(player, localSession, radius, - new Apply(new ReplaceFactory(pattern)), shape, "worldedit.brush.set"); - } - - @Command( - name = "forest", - desc = "Forest brush, creates a forest in the area" - ) - @CommandPermissions("worldedit.brush.forest") - public void forest(Player player, LocalSession localSession, - @Arg(desc = "The shape of the region") - RegionFactory shape, - @Arg(desc = "The size of the brush", def = "5") - Expression radius, - @Arg(desc = "The density of the brush", def = "20") - double density, - @Arg(desc = "The type of tree to use") - TreeGenerator.TreeType type) throws WorldEditException { - setOperationBasedBrush(player, localSession, radius, - new Paint(new TreeGeneratorFactory(type), density / 100), shape, "worldedit.brush.forest"); - } - - @Command( - name = "raise", - desc = "Raise brush, raise all blocks by one" - ) - @CommandPermissions("worldedit.brush.raise") - public void raise(Player player, LocalSession localSession, - @Arg(desc = "The shape of the region") - RegionFactory shape, - @Arg(desc = "The size of the brush", def = "5") - Expression radius) throws WorldEditException { - setOperationBasedBrush(player, localSession, radius, - new Deform("y-=1"), shape, "worldedit.brush.raise"); - } - - @Command( - name = "lower", - desc = "Lower brush, lower all blocks by one" - ) - @CommandPermissions("worldedit.brush.lower") - public void lower(Player player, LocalSession localSession, - @Arg(desc = "The shape of the region") - RegionFactory shape, - @Arg(desc = "The size of the brush", def = "5") - Expression radius) throws WorldEditException { - setOperationBasedBrush(player, localSession, radius, - new Deform("y+=1"), shape, "worldedit.brush.lower"); - } - static void setOperationBasedBrush(Player player, LocalSession session, double radius, Contextual factory, RegionFactory shape, @@ -1282,4 +1287,5 @@ public class BrushCommands { player.print(Caption.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString()))); ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index 2119bdfd5..0a3365c93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -27,6 +27,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.command.util.Logging; +import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.anvil.ChunkDeleter; @@ -38,6 +39,7 @@ import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.formatting.component.PaginationBox; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.formatting.text.event.ClickEvent; import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.world.World; @@ -100,6 +102,12 @@ public class ChunkCommands { @ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException { final Region region = session.getSelection(world); + WorldEditAsyncCommandBuilder.createAndSendMessage(actor, + () -> new ChunkListPaginationBox(region).create(page), + TranslatableComponent.of( + "worldedit.listchunks.listfor", + TextComponent.of(actor.getName()) + )); actor.print(new ChunkListPaginationBox(region).create(page)); actor.print(Caption.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName()))); } @@ -178,6 +186,10 @@ public class ChunkCommands { ChunkListPaginationBox(Region region) { super("Selected Chunks", "/listchunks -p %page%"); + // TODO make efficient/streamable/calculable implementations of this + // for most region types, so we can just store the region and random-access get one page of chunks + // (this is non-trivial for some types of selections...) + //this.region = region.clone(); this.chunks = new ArrayList<>(region.getChunks()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index 30543ab64..295cc6a5e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -24,13 +24,13 @@ import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.RunnableVal; -import com.fastasyncworldedit.core.object.clipboard.DiskOptimizedClipboard; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; -import com.fastasyncworldedit.core.object.clipboard.ReadOnlyClipboard; -import com.fastasyncworldedit.core.object.clipboard.URIClipboardHolder; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard; +import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.fastasyncworldedit.core.util.ImgurUtility; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MaskTraverser; @@ -45,7 +45,7 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.command.util.Logging; import com.sk89q.worldedit.command.util.annotation.Confirm; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.event.extent.PasteEvent; +import com.fastasyncworldedit.core.event.extent.PasteEvent; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -119,6 +119,7 @@ public class ClipboardCommands { boolean copyEntities, @Switch(name = 'b', desc = "Also copy biomes") boolean copyBiomes, + //FAWE start @Switch(name = 'c', desc = "Set the origin of the clipboard to the center of the copied region") boolean centerClipboard, @ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "") @@ -165,8 +166,10 @@ public class ClipboardCommands { session.setClipboard(new ClipboardHolder(clipboard)); copy.getStatusMessages().forEach(actor::print); + //FAWE end } + //FAWE start @Command( name = "/lazycopy", desc = "Lazily copy the selection to the clipboard" @@ -223,6 +226,7 @@ public class ClipboardCommands { session.setClipboard(new ClipboardHolder(lazyClipboard)); actor.print(Caption.of("fawe.worldedit.cut.command.cut.lazy", region.getArea())); }*/ + //FAWE end @Command( name = "/cut", @@ -243,6 +247,7 @@ public class ClipboardCommands { boolean copyBiomes, @ArgFlag(name = 'm', desc = "Set the exclude mask, non-matching blocks become air") Mask mask) throws WorldEditException { + //FAWE start - Inject limits & respect source mask BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); @@ -289,8 +294,10 @@ public class ClipboardCommands { actor.print(Caption.of("fawe.tips.tip.lazycut")); } copy.getStatusMessages().forEach(actor::print); + //FAWE end } + //FAWE start @Command( name = "download", aliases = { "/download" }, @@ -329,7 +336,7 @@ public class ClipboardCommands { final LocalConfiguration config = WorldEdit.getInstance().getConfiguration(); final File working = WorldEdit.getInstance().getWorkingDirectoryFile(config.saveDir).getAbsoluteFile(); - url = MainUtil.upload(null, null, "zip", new RunnableVal() { + url = MainUtil.upload(null, null, "zip", new RunnableVal<>() { @Override public void run(OutputStream out) { try (ZipOutputStream zos = new ZipOutputStream(out)) { @@ -388,6 +395,61 @@ public class ClipboardCommands { } } + @Command( + name = "/place", + desc = "Place the clipboard's contents without applying transformations (e.g. rotate)" + ) + @CommandPermissions("worldedit.clipboard.place") + @Logging(PLACEMENT) + public void place(Actor actor, World world, LocalSession session, final EditSession editSession, + @Switch(name = 'a', desc = "Skip air blocks") + boolean ignoreAirBlocks, + @Switch(name = 'o', desc = "Paste at the original position") + boolean atOrigin, + @Switch(name = 's', desc = "Select the region after pasting") + boolean selectPasted, + @Switch(name = 'e', desc = "Paste entities if available") + boolean pasteEntities, + @Switch(name = 'b', desc = "Paste biomes if available") + boolean pasteBiomes) throws WorldEditException { + ClipboardHolder holder = session.getClipboard(); + final Clipboard clipboard = holder.getClipboard(); + final BlockVector3 origin = clipboard.getOrigin(); + final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(actor); + checkPaste(actor, editSession, to, holder, clipboard); + + clipboard.paste(editSession, to, !ignoreAirBlocks, pasteEntities, pasteBiomes); + + Region region = clipboard.getRegion().clone(); + if (selectPasted) { + BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); + BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint()); + BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint()); + RegionSelector selector = new CuboidRegionSelector(world, realTo, max); + session.setRegionSelector(world, selector); + selector.learnChanges(); + selector.explainRegionAdjust(actor, session); + } + actor.print(Caption.of("fawe.worldedit.paste.command.paste", to)); + + if (!actor.hasPermission("fawe.tips")) { + actor.print(Caption.of("fawe.tips.tip.copypaste")); + } + } + + private void saveDiskClipboard(Clipboard clipboard) { + DiskOptimizedClipboard c; + if (clipboard instanceof DiskOptimizedClipboard) + c = (DiskOptimizedClipboard) clipboard; + else if (clipboard instanceof BlockArrayClipboard + && ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) + c = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent(); + else + return; + c.flush(); + } + //FAWE end + @Command( name = "/paste", aliases = {"/p", "/pa"}, @@ -414,8 +476,10 @@ public class ClipboardCommands { ClipboardHolder holder = session.getClipboard(); if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) { + //FAWE start - use place place(actor, world, session, editSession, ignoreAirBlocks, atOrigin, selectPasted, pasteEntities, pasteBiomes); + //FAWE end return; } Clipboard clipboard = holder.getClipboard(); @@ -423,7 +487,9 @@ public class ClipboardCommands { List messages = Lists.newArrayList(); BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor); + //FAWE start checkPaste(actor, editSession, to, holder, clipboard); + //FAWE end if (!onlySelect) { Operation operation = holder @@ -456,6 +522,7 @@ public class ClipboardCommands { messages.forEach(actor::print); } + //FAWE start private void checkPaste(Actor player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) { URI uri = null; if (holder instanceof URIClipboardHolder) { @@ -467,48 +534,7 @@ public class ClipboardCommands { throw new FaweException(Caption.of("fawe.cancel.worldedit.cancel.reason.manual")); } } - - @Command( - name = "/place", - desc = "Place the clipboard's contents without applying transformations (e.g. rotate)" - ) - @CommandPermissions("worldedit.clipboard.place") - @Logging(PLACEMENT) - public void place(Actor actor, World world, LocalSession session, final EditSession editSession, - @Switch(name = 'a', desc = "Skip air blocks") - boolean ignoreAirBlocks, - @Switch(name = 'o', desc = "Paste at the original position") - boolean atOrigin, - @Switch(name = 's', desc = "Select the region after pasting") - boolean selectPasted, - @Switch(name = 'e', desc = "Paste entities if available") - boolean pasteEntities, - @Switch(name = 'b', desc = "Paste biomes if available") - boolean pasteBiomes) throws WorldEditException { - ClipboardHolder holder = session.getClipboard(); - final Clipboard clipboard = holder.getClipboard(); - final BlockVector3 origin = clipboard.getOrigin(); - final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(actor); - checkPaste(actor, editSession, to, holder, clipboard); - - clipboard.paste(editSession, to, !ignoreAirBlocks, pasteEntities, pasteBiomes); - - Region region = clipboard.getRegion().clone(); - if (selectPasted) { - BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin()); - BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint()); - BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint()); - RegionSelector selector = new CuboidRegionSelector(world, realTo, max); - session.setRegionSelector(world, selector); - selector.learnChanges(); - selector.explainRegionAdjust(actor, session); - } - actor.print(Caption.of("fawe.worldedit.paste.command.paste", to)); - - if (!actor.hasPermission("fawe.tips")) { - actor.print(Caption.of("fawe.tips.tip.copypaste")); - } - } + //FAWE end @Command( name = "/rotate", @@ -559,16 +585,4 @@ public class ClipboardCommands { session.setClipboard(null); actor.print(Caption.of("worldedit.clearclipboard.cleared")); } - - private void saveDiskClipboard(Clipboard clipboard) { - DiskOptimizedClipboard c; - if (clipboard instanceof DiskOptimizedClipboard) - c = (DiskOptimizedClipboard) clipboard; - else if (clipboard instanceof BlockArrayClipboard - && ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) - c = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent(); - else - return; - c.flush(); - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java index 50eebbce4..eb43a4000 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java @@ -83,7 +83,8 @@ public class FlattenedClipboardTransform { minimum.withZ(maximum.getZ()), maximum.withX(minimum.getX()), maximum.withY(minimum.getY()), - maximum.withZ(minimum.getZ()) }; + maximum.withZ(minimum.getZ()) + }; for (int i = 0; i < corners.length; i++) { corners[i] = transformAround.apply(corners[i]); @@ -112,10 +113,12 @@ public class FlattenedClipboardTransform { * @return the operation */ public Operation copyTo(Extent target) { + //FAWE start Extent extent = original; if (transform != null && !transform.isIdentity()) { extent = new BlockTransformExtent(original, transform); } + //FAWE end ForwardExtentCopy copy = new ForwardExtentCopy(extent, original.getRegion(), original.getOrigin(), target, original.getOrigin()); copy.setTransform(transform); if (original.hasBiomes()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 9652fe1cf..39c962548 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.fastasyncworldedit.core.util.CachedTextureUtil; import com.fastasyncworldedit.core.util.CleanTextureUtil; import com.fastasyncworldedit.core.util.MathMan; @@ -48,6 +48,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; import com.sk89q.worldedit.internal.command.CommandUtil; +import com.sk89q.worldedit.internal.cui.ServerCUIHandler; import com.sk89q.worldedit.util.SideEffect; import com.sk89q.worldedit.util.SideEffectSet; import com.sk89q.worldedit.util.auth.AuthorizationException; @@ -102,7 +103,7 @@ public class GeneralCommands { Set commands = collect.getAllCommands() .collect(Collectors.toSet()); for (org.enginehub.piston.Command command : commands) { - /*if in FAWE, //fast will remain for now + /*FAWE start - if in FAWE, //fast will remain for now (command.getName().equals("/fast")) { // deprecate to `//perf` @@ -211,30 +212,6 @@ public class GeneralCommands { actor.print(component); } - @Command( - name = "/fast", - desc = "Toggle fast mode" - ) - @CommandPermissions("worldedit.fast") - @Deprecated - void fast(Actor actor, LocalSession session, - @Arg(desc = "The new fast mode state", def = "") - Boolean fastMode) { - boolean hasFastMode = session.hasFastMode(); - if (fastMode != null && fastMode == hasFastMode) { - actor.print(Caption.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already")); - return; - } - - if (hasFastMode) { - session.setFastMode(false); - actor.print(Caption.of("worldedit.fast.disabled")); - } else { - session.setFastMode(true); - actor.print(Caption.of("worldedit.fast.enabled")); - } - } - @Command( name = "/perf", desc = "Toggle side effects for performance", @@ -338,7 +315,8 @@ public class GeneralCommands { } else { session.setUseServerCUI(true); session.updateServerCUI(player); - player.print(Caption.of("worldedit.drawsel.enabled")); + int maxSize = ServerCUIHandler.getMaxServerCuiSize(); + player.print(Caption.of("worldedit.drawsel.enabled", TextComponent.of(maxSize), TextComponent.of(maxSize), TextComponent.of(maxSize))); } } @@ -487,6 +465,7 @@ public class GeneralCommands { } } + //FAWE start @Command( name = "/gtexture", aliases = {"gtexture"}, @@ -601,4 +580,29 @@ public class GeneralCommands { player.print(Caption.of("fawe.info.worldedit.toggle.tips.off")); } } + + @Command( + name = "/fast", + desc = "Toggle fast mode" + ) + @CommandPermissions("worldedit.fast") + @Deprecated + void fast(Actor actor, LocalSession session, + @Arg(desc = "The new fast mode state", def = "") + Boolean fastMode) { + boolean hasFastMode = session.hasFastMode(); + if (fastMode != null && fastMode == hasFastMode) { + actor.print(Caption.of(fastMode ? "worldedit.fast.enabled.already" : "worldedit.fast.disabled.already")); + return; + } + + if (hasFastMode) { + session.setFastMode(false); + actor.print(Caption.of("worldedit.fast.disabled")); + } else { + session.setFastMode(true); + actor.print(Caption.of("worldedit.fast.enabled")); + } + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index 9cf12b3ac..1360c7cd6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -34,7 +34,7 @@ import com.sk89q.worldedit.command.util.Logging; import com.sk89q.worldedit.command.util.annotation.Confirm; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.function.generator.CavesGen; +import com.fastasyncworldedit.core.function.generator.CavesGen; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; @@ -87,111 +87,6 @@ public class GenerationCommands { this.worldEdit = worldEdit; } - @Command( - name = "/caves", - desc = "Generates a cave network" - ) - @CommandPermissions("worldedit.generation.caves") - @Logging(PLACEMENT) - @Confirm(Confirm.Processor.REGION) - public void caves(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, - @Arg(name = "size", desc = "TODO", def = "8") int sizeOpt, - @Arg(name = "frequency", desc = "TODO", def = "40") int frequencyOpt, - @Arg(name = "rarity", desc = "TODO", def = "7") int rarityOpt, - @Arg(name = "minY", desc = "TODO", def = "8") int minYOpt, - @Arg(name = "maxY", desc = "TODO", def = "127") int maxYOpt, - @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequencyOpt, - @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarityOpt, - @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChanceOpt, - @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMinOpt, - @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException { - CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt); - editSession.generate(region, gen); - actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); - } - - - @Command( - name = "/ores", - desc = "Generates ores" - ) - @CommandPermissions("worldedit.generation.ore") - @Logging(PLACEMENT) - @Confirm(Confirm.Processor.REGION) - public void ores(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask) throws WorldEditException { - editSession.addOres(region, mask); - actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); - } - - @Command( - name = "/img", - aliases = { "/image", "image" }, - desc = "Generate an image" - ) - @CommandPermissions("worldedit.generation.image") - @Logging(PLACEMENT) - public void image(Actor actor, - LocalSession session, - EditSession editSession, - @Arg(desc = "Image URL (imgur only)") String imageURL, - @Arg(desc = "boolean", def = "true") boolean randomize, - @Arg(desc = "TODO", def = "100") int threshold, - @Arg(desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException { - TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); - URL url = new URL(imageURL); - if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { - throw new IOException("Only i.imgur.com links are allowed!"); - } - BufferedImage image = MainUtil.readImage(url); - if (dimensions != null) { - image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), - RenderingHints.VALUE_INTERPOLATION_BILINEAR, false); - } - - BlockVector3 pos1 = session.getPlacementPosition(actor); - BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1); - CuboidRegion region = new CuboidRegion(pos1, pos2); - int[] count = new int[1]; - final BufferedImage finalImage = image; - RegionVisitor visitor = new RegionVisitor(region, pos -> { - try { - int x = pos.getBlockX() - pos1.getBlockX(); - int z = pos.getBlockZ() - pos1.getBlockZ(); - int color = finalImage.getRGB(x, z); - BlockType block = tu.getNearestBlock(color); - count[0]++; - if (block != null) { - return editSession.setBlock(pos, block.getDefaultState()); - } - return false; - } catch (Throwable e) { - e.printStackTrace(); - } - return false; - }); - Operations.completeBlindly(visitor); - actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); - } - - @Command(name = "/ore", desc = "Generates ores") - @CommandPermissions("worldedit.generation.ore") - @Logging(PLACEMENT) - @Confirm(Confirm.Processor.REGION) - public void ore(Actor actor, - LocalSession session, - EditSession editSession, - @Selection Region region, - @Arg(desc = "Mask") Mask mask, - @Arg(desc = "Pattern") Pattern material, - @Arg(desc = "Ore vein size") @Range(from = 0, to = Integer.MAX_VALUE) int size, - @Arg(desc = "Ore vein frequency (number of times to attempt to place ore)", def = "10") @Range(from = 0, to = Integer.MAX_VALUE) int freq, - @Arg(desc = "Ore vein rarity (% chance each attempt is placed)", def = "100") @Range(from = 0, to = 100) int rarity, - @Arg(desc = "Ore vein min y", def = "0") @Range(from = 0, to = 255) int minY, - @Arg(desc = "Ore vein max y", def = "63") @Range(from = 0, to = 255) int maxY) throws WorldEditException { - editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY); - actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); - } - @Command( name = "/hcyl", desc = "Generates a hollow cylinder." @@ -539,4 +434,111 @@ public class GenerationCommands { } } + //FAWE start + @Command( + name = "/caves", + desc = "Generates a cave network" + ) + @CommandPermissions("worldedit.generation.caves") + @Logging(PLACEMENT) + @Confirm(Confirm.Processor.REGION) + public void caves(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, + @Arg(name = "size", desc = "TODO", def = "8") int sizeOpt, + @Arg(name = "frequency", desc = "TODO", def = "40") int frequencyOpt, + @Arg(name = "rarity", desc = "TODO", def = "7") int rarityOpt, + @Arg(name = "minY", desc = "TODO", def = "8") int minYOpt, + @Arg(name = "maxY", desc = "TODO", def = "127") int maxYOpt, + @Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequencyOpt, + @Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarityOpt, + @Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChanceOpt, + @Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMinOpt, + @Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException { + CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt); + editSession.generate(region, gen); + actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); + } + + + @Command( + name = "/ores", + desc = "Generates ores" + ) + @CommandPermissions("worldedit.generation.ore") + @Logging(PLACEMENT) + @Confirm(Confirm.Processor.REGION) + public void ores(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask) throws WorldEditException { + editSession.addOres(region, mask); + actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); + } + + @Command( + name = "/img", + aliases = { "/image", "image" }, + desc = "Generate an image" + ) + @CommandPermissions("worldedit.generation.image") + @Logging(PLACEMENT) + public void image(Actor actor, + LocalSession session, + EditSession editSession, + @Arg(desc = "Image URL (imgur only)") String imageURL, + @Arg(desc = "boolean", def = "true") boolean randomize, + @Arg(desc = "TODO", def = "100") int threshold, + @Arg(desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException { + TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); + URL url = new URL(imageURL); + if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { + throw new IOException("Only i.imgur.com links are allowed!"); + } + BufferedImage image = MainUtil.readImage(url); + if (dimensions != null) { + image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), + RenderingHints.VALUE_INTERPOLATION_BILINEAR, false); + } + + BlockVector3 pos1 = session.getPlacementPosition(actor); + BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1); + CuboidRegion region = new CuboidRegion(pos1, pos2); + int[] count = new int[1]; + final BufferedImage finalImage = image; + RegionVisitor visitor = new RegionVisitor(region, pos -> { + try { + int x = pos.getBlockX() - pos1.getBlockX(); + int z = pos.getBlockZ() - pos1.getBlockZ(); + int color = finalImage.getRGB(x, z); + BlockType block = tu.getNearestBlock(color); + count[0]++; + if (block != null) { + return editSession.setBlock(pos, block.getDefaultState()); + } + return false; + } catch (Throwable e) { + e.printStackTrace(); + } + return false; + }); + Operations.completeBlindly(visitor); + actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); + } + + @Command(name = "/ore", desc = "Generates ores") + @CommandPermissions("worldedit.generation.ore") + @Logging(PLACEMENT) + @Confirm(Confirm.Processor.REGION) + public void ore(Actor actor, + LocalSession session, + EditSession editSession, + @Selection Region region, + @Arg(desc = "Mask") Mask mask, + @Arg(desc = "Pattern") Pattern material, + @Arg(desc = "Ore vein size") @Range(from = 0, to = Integer.MAX_VALUE) int size, + @Arg(desc = "Ore vein frequency (number of times to attempt to place ore)", def = "10") @Range(from = 0, to = Integer.MAX_VALUE) int freq, + @Arg(desc = "Ore vein rarity (% chance each attempt is placed)", def = "100") @Range(from = 0, to = 100) int rarity, + @Arg(desc = "Ore vein min y", def = "0") @Range(from = 0, to = 255) int minY, + @Arg(desc = "Ore vein max y", def = "63") @Range(from = 0, to = 255) int maxY) throws WorldEditException { + editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY); + actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount())); + } + //FAWE end + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index a5b601bb6..9138b00b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -68,10 +68,12 @@ public class HistoryCommands { String playerName) throws WorldEditException { times = Math.max(1, times); LocalSession undoSession = session; + //FAWE start - Add fastmode check if (session.hasFastMode()) { actor.print(Caption.of("fawe.worldedit.history.command.undo.disabled")); return; } + //FAWE end if (playerName != null) { actor.checkPermission("worldedit.history.undo.other"); undoSession = worldEdit.getSessionManager().findByName(playerName); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index b7809ee5f..e4f1f4b83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -6,9 +6,9 @@ import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.database.DBHandler; import com.fastasyncworldedit.core.database.RollbackDatabase; -import com.fastasyncworldedit.core.logging.RollbackOptimizedHistory; -import com.fastasyncworldedit.core.object.RegionWrapper; -import com.fastasyncworldedit.core.object.changeset.SimpleChangeSetSummary; +import com.fastasyncworldedit.core.history.RollbackOptimizedHistory; +import com.fastasyncworldedit.core.regions.RegionWrapper; +import com.fastasyncworldedit.core.history.changeset.SimpleChangeSetSummary; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.StringMan; import com.google.common.base.Function; @@ -22,8 +22,8 @@ import com.sk89q.worldedit.command.util.annotation.Confirm; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.history.changeset.ChangeSet; -import com.sk89q.worldedit.internal.annotation.AllowedRegion; -import com.sk89q.worldedit.internal.annotation.Time; +import com.sk89q.worldedit.command.util.annotation.AllowedRegion; +import com.sk89q.worldedit.command.util.annotation.Time; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; @@ -76,7 +76,7 @@ public class HistorySubCommands { + " - The time uses s, m, h, d, y.\n" + " - Import from disk: /history import" ) - @CommandPermissions("worldedit.history.redo") + @CommandPermissions("worldedit.history.restore") @Confirm public synchronized void rerun(Player player, World world, RollbackDatabase database, @AllowedRegion Region[] allowedRegions, @@ -96,7 +96,7 @@ public class HistorySubCommands { desc = "Undo a specific edit. " + " - The time uses s, m, h, d, y." ) - @CommandPermissions("worldedit.history.undo") + @CommandPermissions("worldedit.history.rollback") @Confirm public synchronized void rollback(Player player, World world, RollbackDatabase database, @AllowedRegion Region[] allowedRegions, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index f87759fbb..baf55ac29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -151,20 +151,22 @@ public class NavigationCommands { } @Command( - name = "jumpto", - aliases = { "j", "/jumpto", "/j" }, - desc = "Teleport to a location" + name = "jumpto", + aliases = { "j", "/jumpto", "/j" }, + desc = "Teleport to a location" ) @CommandPermissions("worldedit.navigation.jumpto.command") public void jumpTo(Player player, - @Arg(desc = "Location to jump to", def = "") - Location pos, - @Switch(name = 'f', desc = "force teleport") - boolean force) throws WorldEditException { + @Arg(desc = "Location to jump to", def = "") + Location pos, + //FAWE start + @Switch(name = 'f', desc = "force teleport") + boolean force) throws WorldEditException { if (pos == null) { pos = player.getSolidBlockTrace(300); } + //FAWE end if (pos != null) { player.findFreePosition(pos); player.print(Caption.of("worldedit.jumpto.moved")); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index f04d4b6ab..29ca4ce88 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -23,7 +23,7 @@ import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.RelightMode; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 4aae1afe7..c48a8552d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -21,9 +21,9 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; -import com.fastasyncworldedit.core.object.clipboard.URIClipboardHolder; -import com.fastasyncworldedit.core.object.schematic.MinecraftStructure; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.io.schematic.MinecraftStructure; import com.fastasyncworldedit.core.util.MainUtil; import com.google.common.base.Function; import com.google.common.collect.Multimap; @@ -36,7 +36,7 @@ import com.sk89q.worldedit.command.util.AsyncCommandBuilder; import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.event.extent.ActorSaveClipboardEvent; +import com.fastasyncworldedit.core.event.extent.ActorSaveClipboardEvent; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; @@ -115,6 +115,7 @@ public class SchematicCommands { this.worldEdit = worldEdit; } + //FAWE start //TODO filtering for directories, global, and private scheamtics needs to be reimplemented here private static List getFiles(File root, String filter, ClipboardFormat format) { File[] files = root.listFiles(); @@ -215,6 +216,76 @@ public class SchematicCommands { player.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found", fileName)); } + //FAWE start + @Command( + name = "move", + aliases = {"m"}, + desc = "Move your loaded schematic" + ) + @CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"}) + public void move(Player player, LocalSession session, String directory) throws WorldEditException, IOException { + LocalConfiguration config = worldEdit.getConfiguration(); + File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile(); + File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working; + File destDir = new File(dir, directory); + if (!MainUtil.isInSubDirectory(working, destDir)) { + player.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir)))); + return; + } + if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { + player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other")); + return; + } + ClipboardHolder clipboard = session.getClipboard(); + List sources = getFiles(clipboard); + if (sources.isEmpty()) { + player.print(Caption.of("fawe.worldedit.schematic.schematic.none")); + return; + } + if (!destDir.exists() && !destDir.mkdirs()) { + player.print(Caption.of("worldedit.schematic.file-perm-fail", TextComponent.of(String.valueOf(destDir)))); + return; + } + for (File source : sources) { + File destFile = new File(destDir, source.getName()); + if (destFile.exists()) { + player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile)); + continue; + } + if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(dir, destFile) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) { + player.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile, + Caption.of("fawe.error.no-perm", ("worldedit.schematic.move.other")))); + continue; + } + try { + File cached = new File(source.getParentFile(), "." + source.getName() + ".cached"); + Files.move(source.toPath(), destFile.toPath()); + if (cached.exists()) { + Files.move(cached.toPath(), destFile.toPath()); + } + player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success", source, destFile)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + private List getFiles(ClipboardHolder clipboard) { + Collection uris = Collections.emptyList(); + if (clipboard instanceof URIClipboardHolder) { + uris = ((URIClipboardHolder) clipboard).getURIs(); + } + List files = new ArrayList<>(); + for (URI uri : uris) { + File file = new File(uri); + if (file.exists()) { + files.add(file); + } + } + return files; + } + //FAWE end + @Command( name = "load", desc = "Load a schematic into your clipboard" @@ -227,6 +298,7 @@ public class SchematicCommands { String formatName) throws FilenameException { LocalConfiguration config = worldEdit.getConfiguration(); + //FAWE start ClipboardFormat format = null; InputStream in = null; try { @@ -313,6 +385,7 @@ public class SchematicCommands { } } } + //FAWE end } @Command( @@ -327,8 +400,10 @@ public class SchematicCommands { String formatName, @Switch(name = 'f', desc = "Overwrite an existing file.") boolean allowOverwrite, + //FAWE start @Switch(name = 'g', desc = "Bypasses per-player-schematic folders") boolean global) throws WorldEditException { + //FAWE end if (worldEdit.getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion() == -1) { actor.printError(TranslatableComponent.of("worldedit.schematic.unsupported-minecraft-version")); return; @@ -338,6 +413,7 @@ public class SchematicCommands { File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile(); + //FAWE start if (!global && Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) { dir = new File(dir, actor.getUniqueId().toString()); } @@ -361,6 +437,7 @@ public class SchematicCommands { } } + //FAWE end File f = worldEdit.getSafeSaveFile(actor, dir, filename, format.getPrimaryFileExtension()); boolean overwrite = f.exists(); @@ -394,80 +471,12 @@ public class SchematicCommands { SchematicSaveTask task = new SchematicSaveTask(actor, f, dir, format, holder, overwrite); AsyncCommandBuilder.wrap(task, actor) .registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename) - .sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving")) + .setDelayMessage(Caption.of("worldedit.schematic.save.saving")) .onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null) .onFailure(Caption.of("worldedit.schematic.failed-to-save"), worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter()) .buildAndExec(worldEdit.getExecutorService()); } - @Command( - name = "move", - aliases = {"m"}, - desc = "Move your loaded schematic" - ) - @CommandPermissions({"worldedit.schematic.move", "worldedit.schematic.move.other"}) - public void move(Player player, LocalSession session, String directory) throws WorldEditException, IOException { - LocalConfiguration config = worldEdit.getConfiguration(); - File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile(); - File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working; - File destDir = new File(dir, directory); - if (!MainUtil.isInSubDirectory(working, destDir)) { - player.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir)))); - return; - } - if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { - player.print(Caption.of("fawe.error.no-perm", "worldedit.schematic.move.other")); - return; - } - ClipboardHolder clipboard = session.getClipboard(); - List sources = getFiles(clipboard); - if (sources.isEmpty()) { - player.print(Caption.of("fawe.worldedit.schematic.schematic.none")); - return; - } - if (!destDir.exists() && !destDir.mkdirs()) { - player.print(Caption.of("worldedit.schematic.file-perm-fail", TextComponent.of(String.valueOf(destDir)))); - return; - } - for (File source : sources) { - File destFile = new File(destDir, source.getName()); - if (destFile.exists()) { - player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile)); - continue; - } - if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(dir, destFile) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) { - player.print(Caption.of("fawe.worldedit.schematic.schematic.move.failed", destFile, - Caption.of("fawe.error.no-perm", ("worldedit.schematic.move.other")))); - continue; - } - try { - File cached = new File(source.getParentFile(), "." + source.getName() + ".cached"); - Files.move(source.toPath(), destFile.toPath()); - if (cached.exists()) { - Files.move(cached.toPath(), destFile.toPath()); - } - player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success", source, destFile)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - - private List getFiles(ClipboardHolder clipboard) { - Collection uris = Collections.emptyList(); - if (clipboard instanceof URIClipboardHolder) { - uris = ((URIClipboardHolder) clipboard).getURIs(); - } - List files = new ArrayList<>(); - for (URI uri : uris) { - File file = new File(uri); - if (file.exists()) { - files.add(file); - } - } - return files; - } - @Command( name = "formats", aliases = {"listformats", "f"}, @@ -514,6 +523,7 @@ public class SchematicCommands { if (oldFirst && newFirst) { throw new StopExecutionException(Caption.of("worldedit.schematic.sorting-old-new")); } + //FAWE start String pageCommand = "/" + arguments.get(); LocalConfiguration config = worldEdit.getConfiguration(); File dir = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile(); @@ -621,6 +631,7 @@ public class SchematicCommands { PaginationBox paginationBox = PaginationBox.fromComponents(fullHeader, pageCommand, components); actor.print(paginationBox.create(page)); } + //FAWE end } @@ -635,6 +646,7 @@ public class SchematicCommands { String filename) throws WorldEditException, IOException { LocalConfiguration config = worldEdit.getConfiguration(); File working = worldEdit.getWorkingDirectoryPath(config.saveDir).toFile(); + //FAWE start File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, actor.getUniqueId().toString()) : working; List files = new ArrayList<>(); @@ -664,8 +676,10 @@ public class SchematicCommands { } actor.print(Caption.of("worldedit.schematic.delete.deleted", filename)); } + //FAWE end } + //FAWE start private boolean deleteFile(File file) { if (file.delete()) { new File(file.getParentFile(), "." + file.getName() + ".cached").delete(); @@ -673,6 +687,7 @@ public class SchematicCommands { } return false; } + //FAWE end private static class SchematicLoadTask implements Callable { private final Actor actor; @@ -722,6 +737,7 @@ public class SchematicCommands { Transform transform = holder.getTransform(); Clipboard target; + //FAWE start boolean checkFilesize = false; if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS @@ -782,6 +798,7 @@ public class SchematicCommands { }; } } + //FAWE end // If we have a transform, bake it into the copy if (transform.isIdentity()) { @@ -797,6 +814,7 @@ public class SchematicCommands { FileOutputStream fos = closer.register(new FileOutputStream(file)); BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos)); ClipboardWriter writer = closer.register(format.getWriter(bos)); + //FAWE start URI uri = null; if (holder instanceof URIClipboardHolder) { uri = ((URIClipboardHolder) holder).getURI(clipboard); @@ -857,6 +875,7 @@ public class SchematicCommands { actor.print(Caption.of("fawe.cancel.worldedit.cancel.reason.manual")); } } + //FAWE end return null; } } @@ -890,6 +909,7 @@ public class SchematicCommands { return ErrorFormat.wrap("No schematics found."); } + //FAWE start File[] files = new File[fileList.size()]; fileList.toArray(files); // cleanup file list @@ -912,12 +932,14 @@ public class SchematicCommands { return res; }); + //FAWE end PaginationBox paginationBox = new SchematicPaginationBox(prefix, files, pageCommand); return paginationBox.create(page); } } private static class SchematicPaginationBox extends PaginationBox { + //FAWE start - Expand to per player schematics private final String prefix; private final File[] files; @@ -925,11 +947,13 @@ public class SchematicCommands { super("worldedit.schematic.available", pageCommand); this.prefix = rootDir == null ? "" : rootDir; this.files = files; + //FAWE end } @Override public Component getComponent(int number) { checkArgument(number < files.length && number >= 0); + //FAWE start - Per player schematic support & translatable things File file = files[number]; Multimap exts = ClipboardFormats.getFileExtensionMap(); String format = exts.get(com.google.common.io.Files.getFileExtension(file.getName())) @@ -948,6 +972,7 @@ public class SchematicCommands { .append(TextComponent.of(path) .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format)))) .build(); + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index 58f5a887f..07f7b092e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -20,10 +20,10 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.clipboard.URIClipboardHolder; -import com.fastasyncworldedit.core.object.mask.IdMask; -import com.fastasyncworldedit.core.object.regions.selector.FuzzyRegionSelector; -import com.fastasyncworldedit.core.object.regions.selector.PolyhedralRegionSelector; +import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; +import com.fastasyncworldedit.core.function.mask.IdMask; +import com.fastasyncworldedit.core.regions.selector.FuzzyRegionSelector; +import com.fastasyncworldedit.core.regions.selector.PolyhedralRegionSelector; import com.google.common.base.Strings; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; @@ -47,7 +47,6 @@ import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.MultiDirection; -import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; @@ -94,6 +93,8 @@ import java.util.stream.Stream; import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION; import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION; +import static com.sk89q.worldedit.world.storage.ChunkStore.CHUNK_SHIFTS; +import static com.sk89q.worldedit.world.storage.ChunkStore.CHUNK_SHIFTS_Y; /** * Selection commands. @@ -118,10 +119,12 @@ public class SelectionCommands { @Arg(desc = "Coordinates to set position 1 to", def = "") BlockVector3 coordinates) throws WorldEditException { Location pos; + //FAWE start - clamp if (coordinates != null) { pos = new Location(world, coordinates.toVector3().clampY(0, world.getMaxY())); } else if (actor instanceof Locatable) { pos = ((Locatable) actor).getBlockLocation().clampY(0, world.getMaxY()); + //FAWE end } else { actor.print(Caption.of("worldedit.pos.console-require-coords")); return; @@ -148,9 +151,11 @@ public class SelectionCommands { BlockVector3 coordinates) throws WorldEditException { Location pos; if (coordinates != null) { + //FAWE start - clamp pos = new Location(world, coordinates.toVector3().clampY(0, world.getMaxY())); } else if (actor instanceof Locatable) { pos = ((Locatable) actor).getBlockLocation().clampY(0, world.getMaxY()); + //Fawe end } else { actor.print(Caption.of("worldedit.pos.console-require-coords")); return; @@ -218,7 +223,7 @@ public class SelectionCommands { @CommandPermissions("worldedit.selection.chunk") public void chunk(Actor actor, World world, LocalSession session, @Arg(desc = "The chunk to select", def = "") - BlockVector2 coordinates, + BlockVector3 coordinates, @Switch(name = 's', desc = "Expand your selection to encompass all chunks that are part of it") boolean expandSelection, @Switch(name = 'c', desc = "Use chunk coordinates instead of block coordinates") @@ -228,40 +233,49 @@ public class SelectionCommands { if (expandSelection) { Region region = session.getSelection(world); - final BlockVector2 min2D = ChunkStore.toChunk(region.getMinimumPoint()); - final BlockVector2 max2D = ChunkStore.toChunk(region.getMaximumPoint()); + int minChunkY = world.getMinY() >> CHUNK_SHIFTS_Y; + int maxChunkY = world.getMaxY() >> CHUNK_SHIFTS_Y; - min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); - max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); + BlockVector3 minChunk = ChunkStore.toChunk3d(region.getMinimumPoint()) + .clampY(minChunkY, maxChunkY); + BlockVector3 maxChunk = ChunkStore.toChunk3d(region.getMaximumPoint()) + .clampY(minChunkY, maxChunkY); + + min = minChunk.shl(CHUNK_SHIFTS, CHUNK_SHIFTS_Y, CHUNK_SHIFTS); + max = maxChunk.shl(CHUNK_SHIFTS, CHUNK_SHIFTS_Y, CHUNK_SHIFTS).add(15, world.getMaxY(), 15); actor.print(Caption.of( "worldedit.chunk.selected-multiple", - TextComponent.of(min2D.getBlockX()), - TextComponent.of(min2D.getBlockZ()), - TextComponent.of(max2D.getBlockX()), - TextComponent.of(max2D.getBlockZ()) + TextComponent.of(minChunk.getBlockX()), + TextComponent.of(minChunk.getBlockY()), + TextComponent.of(minChunk.getBlockZ()), + TextComponent.of(maxChunk.getBlockX()), + TextComponent.of(maxChunk.getBlockY()), + TextComponent.of(maxChunk.getBlockZ()) )); } else { - final BlockVector2 min2D; + BlockVector3 minChunk; if (coordinates != null) { // coords specified - min2D = useChunkCoordinates + minChunk = useChunkCoordinates ? coordinates - : ChunkStore.toChunk(coordinates.toBlockVector3()); + : ChunkStore.toChunk3d(coordinates); } else { // use player loc if (actor instanceof Locatable) { - min2D = ChunkStore.toChunk(((Locatable) actor).getBlockLocation().toVector().toBlockPoint()); + minChunk = ChunkStore.toChunk3d(((Locatable) actor).getBlockLocation().toVector().toBlockPoint()); } else { throw new StopExecutionException(TextComponent.of("A player or coordinates are required.")); } } - min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); + min = minChunk.shl(CHUNK_SHIFTS, CHUNK_SHIFTS_Y, CHUNK_SHIFTS); max = min.add(15, world.getMaxY(), 15); - actor.print(Caption.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()), - TextComponent.of(min2D.getBlockZ()))); + actor.print(Caption.of("worldedit.chunk.selected", + TextComponent.of(minChunk.getBlockX()), + TextComponent.of(minChunk.getBlockY()), + TextComponent.of(minChunk.getBlockZ()))); } final CuboidRegionSelector selector; @@ -285,7 +299,9 @@ public class SelectionCommands { @CommandPermissions("worldedit.wand") public void wand(Player player, LocalSession session, @Switch(name = 'n', desc = "Get a navigation wand") boolean navWand) throws WorldEditException { + //FAWE start session.loadDefaults(player, true); + //FAWE end String wandId = navWand ? session.getNavWandItem() : session.getWandItem(); if (wandId == null) { wandId = navWand ? we.getConfiguration().navigationWand : we.getConfiguration().wandItem; @@ -296,12 +312,14 @@ public class SelectionCommands { return; } player.giveItem(new BaseItemStack(itemType, 1)); + //FAWE start - instance-iate session if (navWand) { session.setTool(itemType, NavigationWand.INSTANCE); player.print(Caption.of("worldedit.wand.navwand.info")); } else { session.setTool(itemType, SelectionWand.INSTANCE); player.print(Caption.of("worldedit.wand.selwand.info")); + //FAWE end } } @@ -459,6 +477,7 @@ public class SelectionCommands { boolean clipboardInfo) throws WorldEditException { Region region; if (clipboardInfo) { + //FAWE start - Modify for cross server clipboards ClipboardHolder root = session.getClipboard(); int index = 0; for (ClipboardHolder holder : root.getHolders()) { @@ -488,6 +507,7 @@ public class SelectionCommands { index++; } return; + //FAWE end } else { region = session.getSelection(world); @@ -572,7 +592,9 @@ public class SelectionCommands { aliases = { ";", "/desel", "/deselect" }, desc = "Choose a region selector" ) + //FAWE start @CommandPermissions("worldedit.analysis.sel") + //FAWE end public void select(Actor actor, World world, LocalSession session, @Arg(desc = "Selector to switch to", def = "") SelectorChoice selector, @@ -625,6 +647,7 @@ public class SelectionCommands { limit.ifPresent(integer -> actor.print(Caption.of("worldedit.select.convex.limit-message", TextComponent.of(integer)))); break; } + //FAWE start case POLYHEDRAL: newSelector = new PolyhedralRegionSelector(world); actor.print(Caption.of("fawe.selection.sel.convex.polyhedral")); @@ -640,6 +663,7 @@ public class SelectionCommands { actor.print(Caption.of("fawe.selection.sel.fuzzy")); actor.print(Caption.of("fawe.selection.sel.list")); break; + //FAWE end case LIST: default: CommandListBox box = new CommandListBox("Selection modes", null, null); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index 782ceac3c..fa14f4372 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.brush.InspectBrush; +import com.fastasyncworldedit.core.command.tool.brush.InspectBrush; import com.google.common.collect.Collections2; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -143,8 +143,10 @@ public class ToolCommands { static void setToolNone(Player player, LocalSession session, boolean isBrush) throws InvalidToolBindException { + //FAWE start isBrush = session.getTool(player) instanceof BrushTool; session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null); + //FAWE end player.print(Caption.of(isBrush ? "worldedit.brush.none.equip" : "worldedit.tool.none.equip")); } @@ -183,7 +185,9 @@ public class ToolCommands { ) @CommandPermissions("worldedit.setwand") public void selwand(Player player, LocalSession session) throws WorldEditException { + //FAWE start - instance-inized setTool(player, session, SelectionWand.INSTANCE, "worldedit.tool.selwand.equip"); + //FAWE end } @Command( @@ -193,7 +197,9 @@ public class ToolCommands { ) @CommandPermissions("worldedit.setwand") public void navwand(Player player, LocalSession session) throws WorldEditException { + //FAWE start - instance-inized setTool(player, session, NavigationWand.INSTANCE, "worldedit.tool.navwand.equip"); + //FAWE end } @Command( @@ -206,6 +212,7 @@ public class ToolCommands { setTool(player, session, new QueryTool(), "worldedit.tool.info.equip"); } + //FAWE start @Command( name = "inspect", aliases = { "/inspect" }, @@ -215,6 +222,7 @@ public class ToolCommands { public void inspectBrush(Player player, LocalSession session) throws WorldEditException { setTool(player, session, new InspectBrush(), "worldedit.tool.info.equip"); } + //FAWE end @Command( name = "tree", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index 73ee19c07..14826e9cd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -20,9 +20,9 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.brush.BrushSettings; -import com.fastasyncworldedit.core.object.brush.TargetMode; -import com.fastasyncworldedit.core.object.brush.scroll.Scroll; +import com.fastasyncworldedit.core.command.tool.brush.BrushSettings; +import com.fastasyncworldedit.core.command.tool.TargetMode; +import com.fastasyncworldedit.core.command.tool.scroll.Scroll; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.StringMan; import com.google.common.collect.Iterables; @@ -61,6 +61,7 @@ public class ToolUtilCommands { this.we = we; } + //FAWE start - destination mask > mask @Command( name = "mask", aliases = "/mask", @@ -90,6 +91,7 @@ public class ToolUtilCommands { player.print(Caption.of("worldedit.tool.mask.set")); } } + //FAWE end @Command( name = "material", @@ -100,6 +102,7 @@ public class ToolUtilCommands { public void material(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to use") Pattern pattern, + //FAWE start - add offhand @Switch(name = 'h', desc = "Whether the offhand should be considered or not") boolean offHand, Arguments arguments) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); @@ -116,6 +119,7 @@ public class ToolUtilCommands { settings.addSetting(BrushSettings.SettingType.FILL, lastArg); tool.update(); } + //FAWE end player.print(Caption.of("worldedit.tool.material.set")); } @@ -128,7 +132,7 @@ public class ToolUtilCommands { public void range(Player player, LocalSession session, @Arg(desc = "The range of the brush") int range) throws WorldEditException { - session.getBrushTool(player, false).setRange(range); + session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); player.print(Caption.of("worldedit.tool.range.set")); } @@ -186,6 +190,7 @@ public class ToolUtilCommands { } } + //FAWE start @Command( name = "primary", aliases = { "/primary" }, @@ -358,4 +363,5 @@ public class ToolUtilCommands { // tool.update(); // player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.transform")); // } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index fe96fda10..beb60eeaf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -22,8 +22,8 @@ package com.sk89q.worldedit.command; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.DelegateConsumer; -import com.fastasyncworldedit.core.object.function.QuadFunction; +import com.fastasyncworldedit.core.util.task.DelegateConsumer; +import com.fastasyncworldedit.core.function.QuadFunction; import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.image.ImageUtil; @@ -204,13 +204,17 @@ public class UtilityCommands { public int fill(Actor actor, LocalSession session, EditSession editSession, @Arg(desc = "The blocks to fill with") Pattern pattern, + //FAWE start - we take an expression over a double @Arg(desc = "The radius to fill in") Expression radiusExp, + //FAWE end @Arg(desc = "The depth to fill", def = "1") int depth, @Arg(desc = "The direction to move", def = "down") @Direction BlockVector3 direction) throws WorldEditException, EvaluationException { + //FAWE start double radius = radiusExp.evaluate(); + //FAWE end radius = Math.max(1, radius); we.checkMaxRadius(radius); depth = Math.max(1, depth); @@ -222,22 +226,6 @@ public class UtilityCommands { } /* - @Command( - name = "/fillr", - desc = "Fill a hole recursively" - name = "patterns", - desc = "View help about patterns", - descFooter = "Patterns determine what blocks are placed\n" + - " - Use [brackets] for arguments\n" + - " - Use , to OR multiple\n" + - "e.g., #surfacespread[10][#existing],andesite\n" + - "More Info: https://git.io/vSPmA" - ) - @CommandQueued(false) - @CommandPermissions("worldedit.patterns") - public void patterns(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException { - displayModifierHelp(player, DefaultPatternParser.class, args); - } @Command( name = "masks", @@ -303,11 +291,15 @@ public class UtilityCommands { public int fillr(Actor actor, LocalSession session, EditSession editSession, @Arg(desc = "The blocks to fill with") Pattern pattern, + //FAWE start - we take an expression over a double @Arg(desc = "The radius to fill in") Expression radiusExp, + //FAWE end @Arg(desc = "The depth to fill", def = "") Integer depth) throws WorldEditException { + //FAWE start double radius = radiusExp.evaluate(); + //FAWE end radius = Math.max(1, radius); we.checkMaxRadius(radius); depth = depth == null ? Integer.MAX_VALUE : Math.max(1, depth); @@ -326,12 +318,16 @@ public class UtilityCommands { @CommandPermissions("worldedit.drain") @Logging(PLACEMENT) public int drain(Actor actor, LocalSession session, EditSession editSession, + //FAWE start - we take an expression over a double @Arg(desc = "The radius to drain") Expression radiusExp, + //FAWE end @Switch(name = 'w', desc = "Also un-waterlog blocks") boolean waterlogged, + //FAWE start @Switch(name = 'p', desc = "Also remove water plants") boolean plants) throws WorldEditException { + //FAWE end double radius = radiusExp.evaluate(); radius = Math.max(0, radius); we.checkMaxRadius(radius); @@ -637,8 +633,10 @@ public class UtilityCommands { flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands"); flags.or(CreatureButcher.Flags.WATER, killWater, "worldedit.butcher.water"); + //FAWE start - run this sync int finalRadius = radius; int killed = TaskManager.IMP.sync(() -> killMatchingEntities(finalRadius, actor, flags::createFunction)); + //FAWE end actor.print(Caption.of( "worldedit.butcher.killed", @@ -666,7 +664,9 @@ public class UtilityCommands { return 0; } + //FAWE start - run this sync int removed = TaskManager.IMP.sync(() -> killMatchingEntities(radius, actor, remover::createFunction)); + //FAWE end actor.print(Caption.of("worldedit.remove.removed", TextComponent.of(removed))); return removed; } @@ -694,7 +694,7 @@ public class UtilityCommands { } session.remember(editSession); - editSession.flushSession(); + editSession.close(); return killed; } @@ -749,6 +749,7 @@ public class UtilityCommands { } + //FAWE start @Command( name = "/confirm", desc = "Confirm a command" @@ -1064,5 +1065,6 @@ public class UtilityCommands { name.append(relative.getPath()); return name.toString(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 7e615ba2c..f7f6c4dda 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -77,6 +77,7 @@ public class WorldEditCommands { ) @CommandPermissions(queued = false) public void version(Actor actor) { + //FAWE start - get own version format FaweVersion fVer = Fawe.get().getVersion(); String fVerStr = fVer == null ? "unknown" : "-" + fVer.build; actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault")); @@ -95,6 +96,7 @@ public class WorldEditCommands { } actor.printInfo(TextComponent.of("Wiki: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/wiki")); + //FAWE end PlatformManager pm = we.getPlatformManager(); @@ -130,10 +132,13 @@ public class WorldEditCommands { public void reload(Actor actor) { we.getPlatformManager().queryCapability(Capability.CONFIGURATION).reload(); we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration())); + //FAWE start Fawe.get().setupConfigs(); + //FAWE end actor.print(Caption.of("worldedit.reload.config")); } + //FAWE start @Command( name = "debugpaste", desc = "Writes a report of latest.log, config.yml, config-legacy.yml, strings.json to https://athion.net/ISPaster/paste" @@ -171,6 +176,7 @@ public class WorldEditCommands { } } } + //FAWE end @Command( name = "cui", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java index 4ecbe2879..f817db266 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/AbstractDirectionConverter.java @@ -28,7 +28,6 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.MultiDirection; -import com.sk89q.worldedit.internal.annotation.OptionalArg; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import org.enginehub.piston.CommandManager; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java index 712080460..96bf20b68 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/EnumConverter.java @@ -19,10 +19,11 @@ package com.sk89q.worldedit.command.argument; -import com.fastasyncworldedit.core.object.brush.scroll.Scroll; +import com.fastasyncworldedit.core.command.tool.scroll.Scroll; import com.google.common.collect.ImmutableSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.command.util.HookMode; +import com.sk89q.worldedit.extent.TracingExtent; import com.sk89q.worldedit.util.SideEffect; import com.sk89q.worldedit.util.TreeGenerator; import org.enginehub.piston.CommandManager; @@ -58,6 +59,8 @@ public final class EnumConverter { basic(HookMode.class)); commandManager.registerConverter(Key.of(Scroll.Action.class), basic(Scroll.Action.class)); + commandManager.registerConverter(Key.of(TracingExtent.Action.class), + basic(TracingExtent.Action.class)); } private static > ArgumentConverter basic(Class enumClass) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java index baeee8df9..ee2fe801d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/FactoryConverter.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.command.argument; -import com.fastasyncworldedit.core.object.extent.SupplyingExtent; +import com.fastasyncworldedit.core.extent.SupplyingExtent; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/LocationConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/LocationConverter.java index 5cf84a152..c1580f6a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/LocationConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/LocationConverter.java @@ -1,22 +1,3 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - package com.sk89q.worldedit.command.argument; import com.sk89q.worldedit.math.BlockVector3; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SelectorChoice.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SelectorChoice.java index bb292de7a..2b1dfec72 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SelectorChoice.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/SelectorChoice.java @@ -30,7 +30,9 @@ public enum SelectorChoice { HULL, POLYHEDRON, LIST, + //FAWE start FUZZY, MAGIC, POLYHEDRAL + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/WorldConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/WorldConverter.java index d9243cba4..9fb9d586d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/WorldConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/WorldConverter.java @@ -42,7 +42,9 @@ public class WorldConverter implements ArgumentConverter { commandManager.registerConverter(Key.of(World.class), WORLD_CONVERTER); } + //FAWE start - Accessed by LocationConverter public static final WorldConverter WORLD_CONVERTER = new WorldConverter(); + //FAWE end private final TextComponent choices; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/package-info.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/package-info.java index 423e6d21e..270468aa1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/package-info.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/package-info.java @@ -17,5 +17,11 @@ * along with this program. If not, see . */ +/** + * The following classes are FAWE additions: + * + * @see com.sk89q.worldedit.command.argument.ExpressionConverter + * @see com.sk89q.worldedit.command.argument.LocationConverter + */ @org.enginehub.piston.util.NonnullByDefault package com.sk89q.worldedit.command.argument; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/package-info.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/package-info.java new file mode 100644 index 000000000..61d4ea41d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/package-info.java @@ -0,0 +1,6 @@ +/** + * The following classes are FAWE additions: + * + * @see com.sk89q.worldedit.command.HistorySubCommands + */ +package com.sk89q.worldedit.command; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java index 572e2d6b6..3aa99e678 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java @@ -36,7 +36,7 @@ import com.sk89q.worldedit.world.block.BlockTypes; */ public class AreaPickaxe implements BlockTool { - private int range; + private final int range; public AreaPickaxe(int range) { this.range = range; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java index dc8df8f89..7c74b0749 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java @@ -30,9 +30,12 @@ import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BaseBlock; +import javax.annotation.Nullable; + /** * A mode that replaces one block. */ @@ -50,11 +53,12 @@ public class BlockReplacer implements DoubleActionBlockTool { } @Override - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { BlockBag bag = session.getBlockBag(player); - try (EditSession editSession = session.createEditSession(player, "BlockReplacer")) { + try (EditSession editSession = session.createEditSession(player)) { try { + editSession.disableBuffering(); BlockVector3 position = clicked.toVector().toBlockPoint(); editSession.setBlock(position, pattern); } catch (MaxChangedBlocksException ignored) { @@ -72,7 +76,7 @@ public class BlockReplacer implements DoubleActionBlockTool { @Override - public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { BaseBlock targetBlock = player.getWorld().getFullBlock(clicked.toVector().toBlockPoint()); if (targetBlock != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index ac66d0ed0..272a0aed8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -20,15 +20,15 @@ package com.sk89q.worldedit.command.tool; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.brush.BrushSettings; -import com.fastasyncworldedit.core.object.brush.MovableTool; -import com.fastasyncworldedit.core.object.brush.ResettableTool; -import com.fastasyncworldedit.core.object.brush.TargetMode; -import com.fastasyncworldedit.core.object.brush.scroll.Scroll; -import com.fastasyncworldedit.core.object.brush.scroll.ScrollTool; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; -import com.fastasyncworldedit.core.object.mask.MaskedTargetBlock; -import com.fastasyncworldedit.core.object.pattern.PatternTraverser; +import com.fastasyncworldedit.core.command.tool.brush.BrushSettings; +import com.fastasyncworldedit.core.command.tool.MovableTool; +import com.fastasyncworldedit.core.command.tool.ResettableTool; +import com.fastasyncworldedit.core.command.tool.TargetMode; +import com.fastasyncworldedit.core.command.tool.scroll.Scroll; +import com.fastasyncworldedit.core.command.tool.scroll.ScrollTool; +import com.fastasyncworldedit.core.extent.ResettableExtent; +import com.fastasyncworldedit.core.function.mask.MaskedTargetBlock; +import com.fastasyncworldedit.core.function.pattern.PatternTraverser; import com.fastasyncworldedit.core.util.BrushCache; import com.fastasyncworldedit.core.util.MaskTraverser; import com.fastasyncworldedit.core.util.StringMan; @@ -65,23 +65,25 @@ import static com.google.common.base.Preconditions.checkNotNull; * Builds a shape at the place being looked at. */ public class BrushTool - implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable { + //FAWE start - All implements but TraceTool + implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable, TraceTool { // TODO: // Serialize methods // serialize BrushSettings (primary and secondary only if different) // set transient values e.g., context - public enum BrushAction { + enum BrushAction { PRIMARY, SECONDARY } - + //FAWE end protected static int MAX_RANGE = 500; - protected static int DEFAULT_RANGE = 240; // 500 is laggy as the default protected int range = -1; - private TargetMode targetMode = TargetMode.TARGET_BLOCK_RANGE; private Mask traceMask = null; + //FAWE start + protected static int DEFAULT_RANGE = 240; // 500 is laggy as the default + private TargetMode targetMode = TargetMode.TARGET_BLOCK_RANGE; private int targetOffset; private transient BrushSettings primary = new BrushSettings(); @@ -89,6 +91,7 @@ public class BrushTool private transient BrushSettings context = primary; private transient BaseItem holder; + //FAWE end /** * Construct the tool. @@ -100,6 +103,7 @@ public class BrushTool getContext().addPermission(permission); } + //FAWE start public BrushTool() { } @@ -192,15 +196,6 @@ public class BrushTool update(); } - /** - * Get the filter. - * - * @return the filter - */ - public Mask getMask() { - return getContext().getMask(); - } - /** * Get the filter. * @@ -229,6 +224,16 @@ public class BrushTool this.getContext().setMask(filter); update(); } + //FAWE end + + /** + * Get the filter. + * + * @return the filter + */ + public Mask getMask() { + return getContext().getMask(); + } /** * Get the mask used for identifying where to stop traces. @@ -250,6 +255,7 @@ public class BrushTool update(); } + //FAWE start /** * Set the block filter used for identifying blocks to replace. * @@ -259,6 +265,7 @@ public class BrushTool this.getContext().setSourceMask(filter); update(); } + //FAWE end /** * Set the brush. @@ -267,11 +274,13 @@ public class BrushTool * @param permission the permission */ public void setBrush(Brush brush, String permission) { + //FAWE start - We use our own logic BrushSettings current = getContext(); current.clearPerms(); current.setBrush(brush); current.addPermission(permission); update(); + //FAWE end } /** @@ -350,9 +359,12 @@ public class BrushTool @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { + //FAWE start - Use logic previously declared as FAWE-like return act(BrushAction.PRIMARY, player, session); + //FAWE end } + //FAWE start public BlockVector3 getPosition(EditSession editSession, Player player) { Location loc = player.getLocation(); switch (targetMode) { @@ -524,4 +536,5 @@ public class BrushTool public boolean move(Player player) { return false; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java index e9190d51f..35a35b698 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.command.tool; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -120,8 +120,10 @@ public class FloatingTreeRemover implements BlockTool { * @return a set containing all blocks in the tree/shroom or null if this is not a floating tree/shroom. */ private Set bfs(World world, BlockVector3 origin) { + //FAWE start - Use a LBVS over a HashMap & LinkedList final LocalBlockVectorSet visited = new LocalBlockVectorSet(); final LocalBlockVectorSet queue = new LocalBlockVectorSet(); + //FAWE end queue.add(origin); visited.add(origin); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java index 8697e28f8..c39a2aa9f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java @@ -77,11 +77,13 @@ public class FloodFillTool implements BlockTool { try (EditSession editSession = session.createEditSession(player, "FloodFillTool")) { try { + //FAWE start - Respect masks Mask mask = initialType.toMask(editSession); BlockReplace function = new BlockReplace(editSession, pattern); RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range); visitor.visit(origin); Operations.completeLegacy(visitor); + //FAWE end } catch (MaxChangedBlocksException e) { player.print(Caption.of("worldedit.tool.max-block-changes")); } finally { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java index f3396026b..a11e5c840 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/InvalidToolBindException.java @@ -21,11 +21,18 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.util.formatting.text.Component; public class InvalidToolBindException extends WorldEditException { - private ItemType item; + private final ItemType item; + public InvalidToolBindException(ItemType item, Component msg) { + super(msg); + this.item = item; + } + + @Deprecated public InvalidToolBindException(ItemType item, String msg) { super(msg); this.item = item; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/NavigationWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/NavigationWand.java index f95e31f6c..1dce4bb87 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/NavigationWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/NavigationWand.java @@ -27,12 +27,17 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.util.Location; +//FAWE start - enum-ized public enum NavigationWand implements DoubleActionTraceTool { INSTANCE; +//FAWE end + + private static final String PRIMARY_PERMISSION = "worldedit.navigation.thru.tool"; + private static final String SECONDARY_PERMISSION = "worldedit.navigation.jumpto.tool"; @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) { - if (!player.hasPermission("worldedit.navigation.jumpto.tool")) { + if (!player.hasPermission(SECONDARY_PERMISSION)) { return false; } final int maxDist = config.navigationWandMaxDistance; @@ -50,7 +55,7 @@ public enum NavigationWand implements DoubleActionTraceTool { @Override public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) { - if (!player.hasPermission("worldedit.navigation.thru.tool")) { + if (!player.hasPermission(PRIMARY_PERMISSION)) { return false; } final int maxDist = config.navigationWandMaxDistance; @@ -66,6 +71,6 @@ public enum NavigationWand implements DoubleActionTraceTool { @Override public boolean canUse(Actor actor) { - return actor.hasPermission("worldedit.navigation.jumpto.tool"); // check should be here + return actor.hasPermission(PRIMARY_PERMISSION) || actor.hasPermission(SECONDARY_PERMISSION); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index 5e5f1ffe9..2e857e481 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.command.tool; -import com.fastasyncworldedit.core.object.mask.IdMask; +import com.fastasyncworldedit.core.function.mask.IdMask; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -75,6 +75,7 @@ public class RecursivePickaxe implements BlockTool { try (EditSession editSession = session.createEditSession(player, "RecursivePickaxe")) { editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); + //FAWE start final int radius = (int) range; final BlockReplace replace = new BlockReplace(editSession, (BlockTypes.AIR.getDefaultState())); editSession.setMask(null); @@ -83,6 +84,7 @@ public class RecursivePickaxe implements BlockTool { //visitor.visit(pos); //Operations.completeBlindly(visitor); recurse(server, editSession, world, pos, origin, radius, initialType, visitor.getVisited()); + //FAWE end editSession.flushQueue(); session.remember(editSession); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java index 309507940..0e4af72bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java @@ -29,36 +29,46 @@ import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.RegionSelector; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import org.apache.logging.log4j.Logger; +import javax.annotation.Nullable; + +//FAWE start - enum-ized public enum SelectionWand implements DoubleActionBlockTool { INSTANCE; +//FAWE end private static final Logger LOGGER = LogManagerCompat.getLogger(); @Override - public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { RegionSelector selector = session.getRegionSelector(player.getWorld()); BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); + if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { + //FAWE start if (Settings.IMP.EXPERIMENTAL.OTHER) { LOGGER.info("actSecondary Hit and about to explain with explainPrimarySelection"); } + //FAWE end selector.explainPrimarySelection(player, session, blockPoint); } return true; } @Override - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { RegionSelector selector = session.getRegionSelector(player.getWorld()); BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { + //FAWE start if (Settings.IMP.EXPERIMENTAL.OTHER) { LOGGER.info("actPrimary Hit and about to explain with explainSecondarySelection"); } + //FAWE end selector.explainSecondarySelection(player, session, blockPoint); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java index c96fbff2c..0f77e54f0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java @@ -28,11 +28,14 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import javax.annotation.Nullable; + /** * A super pickaxe mode that removes one block. */ @@ -44,7 +47,7 @@ public class SinglePickaxe implements BlockTool { } @Override - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { World world = (World) clicked.getExtent(); BlockVector3 blockPoint = clicked.toBlockPoint(); final BlockType blockType = world.getBlock(blockPoint).getBlockType(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 62f907511..3d1da4d04 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -28,15 +28,18 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TreeGenerator; +import javax.annotation.Nullable; + /** * Plants a tree. */ public class TreePlanter implements BlockTool { - private TreeGenerator.TreeType treeType; + private final TreeGenerator.TreeType treeType; public TreePlanter(TreeGenerator.TreeType treeType) { this.treeType = treeType; @@ -48,7 +51,7 @@ public class TreePlanter implements BlockTool { } @Override - public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { + public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked, @Nullable Direction face) { try (EditSession editSession = session.createEditSession(player)) { try { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java index 8599355cf..32b2b9f9f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java @@ -33,7 +33,7 @@ import java.util.List; public class ButcherBrush implements Brush { - private CreatureButcher flags; + private final CreatureButcher flags; public ButcherBrush(CreatureButcher flags) { this.flags = flags; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java index 59919a1c5..9217066f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.world.block.BlockTypes; public class CylinderBrush implements Brush { - private int height; + private final int height; public CylinderBrush(int height) { this.height = height; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index ff5f04a76..e85ce80a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -36,6 +36,7 @@ public class GravityBrush implements Brush { @Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { + //FAWE start - Ours operates differently to upstream, but does the same double endY = position.getY() + size; double startPerformY = Math.max(0, position.getY() - size); double startCheckY = fullHeight ? 0 : startPerformY; @@ -54,5 +55,6 @@ public class GravityBrush implements Brush { } } } + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 162d1a587..c39050166 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.world.block.BlockTypes; public class HollowCylinderBrush implements Brush { - private int height; + private final int height; public HollowCylinderBrush(int height) { this.height = height; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java index 13a1ff6f1..e92b9290e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java @@ -37,7 +37,7 @@ import javax.annotation.Nullable; public class SmoothBrush implements Brush { private final Mask mask; - private int iterations; + private final int iterations; public SmoothBrush(int iterations) { this(iterations, null); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java index 3eeb11786..7360028b6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/AsyncCommandBuilder.java @@ -36,10 +36,10 @@ import com.sk89q.worldedit.util.task.Supervisor; import org.apache.logging.log4j.Logger; import org.enginehub.piston.exception.CommandException; import org.enginehub.piston.exception.CommandExecutionException; -import org.jetbrains.annotations.Nullable; import java.util.concurrent.Callable; import java.util.function.Consumer; +import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -57,6 +57,8 @@ public final class AsyncCommandBuilder { private String description; @Nullable private Component delayMessage; + @Nullable + private Component workingMessage; @Nullable private Component successMessage; @@ -90,11 +92,22 @@ public final class AsyncCommandBuilder { return sendMessageAfterDelay(TextComponent.of(checkNotNull(message))); } + @Deprecated public AsyncCommandBuilder sendMessageAfterDelay(Component message) { + return setDelayMessage(message); + } + + public AsyncCommandBuilder setDelayMessage(Component message) { this.delayMessage = checkNotNull(message); return this; } + public AsyncCommandBuilder setWorkingMessage(Component message) { + checkNotNull(this.delayMessage, "Must have a delay message if using a working message"); + this.workingMessage = checkNotNull(message); + return this; + } + public AsyncCommandBuilder onSuccess(@Nullable Component message, @Nullable Consumer consumer) { checkArgument(message != null || consumer != null, "Can't have null message AND consumer"); this.successMessage = message; @@ -145,7 +158,7 @@ public final class AsyncCommandBuilder { if (successMessage != null) { sender.print(successMessage); } - } catch (Exception orig) { + } catch (Throwable orig) { Component failure = failureMessage != null ? failureMessage : TextComponent.of("An error occurred"); try { if (exceptionConverter != null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java index 851e337fd..f444e7709 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/EntityRemover.java @@ -146,7 +146,9 @@ public class EntityRemover { EntityProperties registryType = entity.getFacet(EntityProperties.class); if (registryType != null) { if (type.matches(registryType)) { + //FAWE start - Calling this async violates thread safety TaskManager.IMP.sync(entity::remove); + //FAWE end return true; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java index fbcce486c..2d283a4db 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/FutureProgressListener.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; +import javax.annotation.Nullable; import java.util.Timer; import static com.google.common.base.Preconditions.checkNotNull; @@ -32,7 +33,8 @@ import static com.google.common.base.Preconditions.checkNotNull; public class FutureProgressListener implements Runnable { private static final Timer timer = new Timer(); - private static final int MESSAGE_DELAY = 1000; + private static final int MESSAGE_DELAY = 1000; // 1 second + private static final int MESSAGE_PERIOD = 10000; // 10 seconds private final MessageTimerTask task; @@ -42,11 +44,15 @@ public class FutureProgressListener implements Runnable { } public FutureProgressListener(Actor sender, Component message) { + this(sender, message, null); + } + + public FutureProgressListener(Actor sender, Component message, @Nullable Component workingMessage) { checkNotNull(sender); checkNotNull(message); - task = new MessageTimerTask(sender, message); - timer.schedule(task, MESSAGE_DELAY); + task = new MessageTimerTask(sender, message, workingMessage); + timer.scheduleAtFixedRate(task, MESSAGE_DELAY, MESSAGE_PERIOD); } @Override @@ -56,11 +62,15 @@ public class FutureProgressListener implements Runnable { @Deprecated public static void addProgressListener(ListenableFuture future, Actor sender, String message) { - future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor()); + addProgressListener(future, sender, TextComponent.of(message)); } public static void addProgressListener(ListenableFuture future, Actor sender, Component message) { future.addListener(new FutureProgressListener(sender, message), MoreExecutors.directExecutor()); } + public static void addProgressListener(ListenableFuture future, Actor sender, Component message, Component workingMessage) { + future.addListener(new FutureProgressListener(sender, message, workingMessage), MoreExecutors.directExecutor()); + } + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java index 460c759b8..ca1c3548b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/MessageTimerTask.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; +import javax.annotation.Nullable; import java.util.TimerTask; import static com.google.common.base.Preconditions.checkNotNull; @@ -31,23 +32,35 @@ public class MessageTimerTask extends TimerTask { private final Actor sender; private final Component message; + @Nullable + private final Component workingMessage; + + private boolean hasRunBefore = false; @Deprecated MessageTimerTask(Actor sender, String message) { - this(sender, TextComponent.of(message)); + this(sender, TextComponent.of(message), null); } - MessageTimerTask(Actor sender, Component message) { + MessageTimerTask(Actor sender, Component message, @Nullable Component workingMessage) { checkNotNull(sender); checkNotNull(message); this.sender = sender; this.message = message; + this.workingMessage = workingMessage; } @Override public void run() { - sender.printDebug(message); + if (!hasRunBefore) { + sender.printDebug(message); + hasRunBefore = true; + } else if (workingMessage != null) { + sender.printDebug(workingMessage); + } else { + cancel(); + } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java index e18324ea7..00e9071b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PermissionCondition.java @@ -31,7 +31,9 @@ public class PermissionCondition implements Command.Condition { private static final Key ACTOR_KEY = Key.of(Actor.class); private final Set permissions; + //FAWE start private final boolean queued; + //FAWE end public PermissionCondition(Set permissions) { this(permissions, true); @@ -54,7 +56,9 @@ public class PermissionCondition implements Command.Condition { .orElse(false); } + //FAWE start public boolean isQueued() { return queued; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/SuggestionHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/SuggestionHelper.java index 8ecafa602..576204743 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/SuggestionHelper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/SuggestionHelper.java @@ -179,6 +179,7 @@ public final class SuggestionHelper { return registry.keySet().stream().filter(search); } + //FAWE start /** * Returns a stream of suggestions for positive doubles. * @@ -231,4 +232,5 @@ public final class SuggestionHelper { } return true; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java index 52951cdaa..9f89216de 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/WorldEditAsyncCommandBuilder.java @@ -42,7 +42,7 @@ public final class WorldEditAsyncCommandBuilder { public static void createAndSendMessage(Actor actor, Callable task, @Nullable Component desc) { final AsyncCommandBuilder builder = AsyncCommandBuilder.wrap(task, actor); if (desc != null) { - builder.sendMessageAfterDelay(desc); + builder.setDelayMessage(desc); } builder .onSuccess((String) null, actor::printInfo) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/AllowedRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/AllowedRegion.java similarity index 90% rename from worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/AllowedRegion.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/AllowedRegion.java index 8fd544b2d..e71ddab91 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/AllowedRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/AllowedRegion.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.internal.annotation; +package com.sk89q.worldedit.command.util.annotation; import com.fastasyncworldedit.core.regions.FaweMaskManager; import org.enginehub.piston.inject.InjectAnnotation; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java similarity index 61% rename from worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java index e5dbe3fbd..b29b3c87b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/ConfirmHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java @@ -1,23 +1,4 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.internal.command; +package com.sk89q.worldedit.command.util.annotation; import com.fastasyncworldedit.core.configuration.Settings; import com.sk89q.worldedit.command.util.annotation.Confirm; diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Link.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Link.java similarity index 79% rename from worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Link.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Link.java index 297af2be1..9ad8f67ef 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Link.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Link.java @@ -1,4 +1,4 @@ -package com.sk89q.minecraft.util.commands; +package com.sk89q.worldedit.command.util.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/PatternList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/PatternList.java new file mode 100644 index 000000000..549cc5822 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/PatternList.java @@ -0,0 +1,17 @@ +package com.sk89q.worldedit.command.util.annotation; + +import org.enginehub.piston.inject.InjectAnnotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotates a {@code List} parameter to inject a list of BlockStates. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +@InjectAnnotation +public @interface PatternList { +} diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Step.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Step.java similarity index 80% rename from worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Step.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Step.java index 9a5243a1f..d4e83a9f1 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/Step.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Step.java @@ -1,4 +1,4 @@ -package com.sk89q.minecraft.util.commands; +package com.sk89q.worldedit.command.util.annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Time.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Time.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Time.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Time.java index cfcc43139..67b31bc43 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Time.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/Time.java @@ -1,4 +1,4 @@ -package com.sk89q.worldedit.internal.annotation; +package com.sk89q.worldedit.command.util.annotation; import org.enginehub.piston.inject.InjectAnnotation; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/package-info.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/package-info.java new file mode 100644 index 000000000..4052a3c03 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/package-info.java @@ -0,0 +1,12 @@ +/** + * The following classes are FAWE additions: + * + * @see com.sk89q.worldedit.command.util.annotation.AllowedRegion + * @see com.sk89q.worldedit.command.util.annotation.Confirm + * @see com.sk89q.worldedit.command.util.annotation.ConfirmHandler + * @see com.sk89q.worldedit.command.util.annotation.Link + * @see com.sk89q.worldedit.command.util.annotation.PatternList + * @see com.sk89q.worldedit.command.util.annotation.Step + * @see com.sk89q.worldedit.command.util.annotation.Time + */ +package com.sk89q.worldedit.command.util.annotation; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java index 3a829adc3..b01c732ad 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java @@ -47,7 +47,9 @@ public class BaseEntity implements NbtValued { private final EntityType type; @Nullable + //FAWE start - use LZ over CompoundTag private LazyReference nbtData; + //FAWE end /** * Create a new base entity. @@ -93,12 +95,6 @@ public class BaseEntity implements NbtValued { setNbtReference(other.getNbtReference()); } - @Nullable - @Override - public LazyReference getNbtReference() { - return nbtData; - } - @Override public void setNbtReference(@Nullable LazyReference nbtData) { this.nbtData = nbtData; @@ -113,11 +109,16 @@ public class BaseEntity implements NbtValued { return this.type; } - // FAWE start + //FAWE start public BaseEntity(CompoundTag tag) { this(EntityTypes.parse(tag.getString("Id")), tag); } - // FAWE end + @Nullable + @Override + public LazyReference getNbtReference() { + return nbtData; + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java index 1aea441d0..2becf045f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Entity.java @@ -48,10 +48,12 @@ public interface Entity extends Faceted, Locatable { @Nullable BaseEntity getState(); + //FAWE start default EntityType getType() { BaseEntity state = getState(); return state != null ? state.getType() : null; } + //FAWE end /** * Remove this entity from it container. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 32bb2dc3a..16dd39273 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.entity; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.clipboard.DiskOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.worldedit.EmptyClipboardException; @@ -348,6 +348,7 @@ public interface Player extends Entity, Actor { */ > void sendFakeBlock(BlockVector3 pos, @Nullable B block); + //FAWE start public Region[] getCurrentRegions(); Region[] getCurrentRegions(FaweMaskManager.MaskType type); @@ -429,4 +430,5 @@ public interface Player extends Entity, Actor { print(Caption.of("fawe.error.stacktrace")); } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java index 6e7ab1fa6..641f7772f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/Event.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEdit; * An abstract base class for all WorldEdit events. */ public abstract class Event { + //FAWE start /** * Returns true if this event was called and not cancelled. @@ -37,4 +38,5 @@ public abstract class Event { } return true; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java index de0db9c29..0c6abbf73 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java @@ -24,12 +24,16 @@ import com.sk89q.worldedit.event.Cancellable; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extent.TracingExtent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.EditSession.Stage; @@ -67,7 +71,11 @@ public class EditSessionEvent extends Event implements Cancellable { private final int maxBlocks; private final Stage stage; private Extent extent; + private final List tracingExtents = new ArrayList<>(); + private boolean tracing; + //FAWE start private boolean cancelled; + //FAWE end /** * Create a new event. @@ -139,17 +147,31 @@ public class EditSessionEvent extends Event implements Cancellable { */ public void setExtent(Extent extent) { checkNotNull(extent); + if (tracing && extent != this.extent) { + TracingExtent tracingExtent = new TracingExtent(extent); + extent = tracingExtent; + tracingExtents.add(tracingExtent); + } this.extent = extent; } - @Override - public boolean isCancelled() { - return cancelled; + /** + * Set tracing enabled, with the current extent as the "base". + * + * Internal use only. + * @param tracing if tracing is enabled + */ + public void setTracing(boolean tracing) { + this.tracing = tracing; } - @Override - public void setCancelled(boolean cancelled) { - this.cancelled = cancelled; + /** + * Get the current list of tracing extents. + * + * Internal use only. + */ + public List getTracingExtents() { + return tracingExtents; } /** @@ -162,4 +184,16 @@ public class EditSessionEvent extends Event implements Cancellable { return new EditSessionEvent(world, actor, maxBlocks, stage); } + //FAWE start + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + //FAWE end + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java index b239ad93f..e2146d4cf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/event/platform/CommandEvent.java @@ -65,9 +65,11 @@ public class CommandEvent extends AbstractCancellable { return arguments; } + //FAWE start @Override public boolean call() { PlatformCommandManager.getInstance().handleCommandOnCurrentThread(this); return true; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index 3de32944e..6322ce199 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -58,8 +58,10 @@ public class BlockFactory extends AbstractFactory { */ public Set parseFromListInput(String input, ParserContext context) throws InputParseException { Set blocks = new HashSet<>(); + //FAWE start // String[] splits = input.split(","); for (String token : StringUtil.split(input, ',', '[', ']')) { + //FAWE end blocks.add(parseFromInput(token, context)); } return blocks; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java index 12b8bd1de..0a47ff31d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java @@ -21,33 +21,33 @@ package com.sk89q.worldedit.extension.factory; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.factory.parser.mask.AdjacentMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.AdjacentMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.AngleMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.AngleMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BiomeMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlockCategoryMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.ExtremaMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.FalseMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.ExtremaMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.FalseMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.LiquidMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.LiquidMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.ROCAngleMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.ROCAngleMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.RichOffsetMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.SimplexMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.RichOffsetMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.SimplexMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.SurfaceMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.TrueMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.WallMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.XAxisMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.YAxisMaskParser; -import com.sk89q.worldedit.extension.factory.parser.mask.ZAxisMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.SurfaceMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.TrueMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.WallMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.XAxisMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.YAxisMaskParser; +import com.fastasyncworldedit.core.extension.factory.parser.mask.ZAxisMaskParser; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; @@ -91,6 +91,7 @@ public final class MaskFactory extends AbstractFactory { register(new BlockCategoryMaskParser(worldEdit)); register(new BiomeMaskParser(worldEdit)); + //FAWE start // Mask Parsers from FAWE register(new AdjacentMaskParser(worldEdit)); register(new AngleMaskParser(worldEdit)); @@ -107,6 +108,7 @@ public final class MaskFactory extends AbstractFactory { register(new XAxisMaskParser(worldEdit)); register(new YAxisMaskParser(worldEdit)); register(new ZAxisMaskParser(worldEdit)); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index 3a392b8d8..30c24f921 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -20,21 +20,21 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.factory.parser.pattern.BiomePatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.BiomePatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.BlockCategoryPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.BufferedPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.BufferedPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.ClipboardPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.ExistingPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.Linear2DPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.Linear3DPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.PerlinPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.ExistingPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.Linear2DPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.Linear3DPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.PerlinPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomStatePatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.RidgedMultiFractalPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.SimplexPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.RidgedMultiFractalPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.SimplexPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.SingleBlockPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.TypeOrStateApplyingPatternParser; -import com.sk89q.worldedit.extension.factory.parser.pattern.VoronoiPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.VoronoiPatternParser; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.registry.AbstractFactory; @@ -64,7 +64,7 @@ public final class PatternFactory extends AbstractFactory { register(new RandomStatePatternParser(worldEdit)); register(new BlockCategoryPatternParser(worldEdit)); - // FAWE + //FAWE start register(new SimplexPatternParser(worldEdit)); register(new VoronoiPatternParser(worldEdit)); register(new PerlinPatternParser(worldEdit)); @@ -74,6 +74,7 @@ public final class PatternFactory extends AbstractFactory { register(new Linear3DPatternParser(worldEdit)); register(new BufferedPatternParser(worldEdit)); register(new ExistingPatternParser(worldEdit)); + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index 12a633ccc..0734af6fb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -43,7 +43,7 @@ import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.inventory.BlockBag; -import com.sk89q.worldedit.extent.inventory.SlottableBlockBag; +import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag; import com.sk89q.worldedit.internal.registry.InputParser; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; @@ -57,7 +57,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.FuzzyBlockState; -import com.sk89q.worldedit.world.block.BlanketBaseBlock; +import com.fastasyncworldedit.core.world.block.BlanketBaseBlock; import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.entity.EntityTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; @@ -118,7 +118,7 @@ public class DefaultBlockParser extends InputParser { } } - private static String[] EMPTY_STRING_ARRAY = {}; + private static final String[] EMPTY_STRING_ARRAY = {}; /** * Backwards compatibility for wool colours in block syntax. @@ -253,9 +253,11 @@ public class DefaultBlockParser extends InputParser { } private BaseBlock parseLogic(String input, ParserContext context) throws InputParseException { + //FAWE start String[] blockAndExtraData = input.trim().split("\\|", 2); blockAndExtraData[0] = woolMapper(blockAndExtraData[0]); Map, Object> blockStates = new HashMap<>(); + //FAWE end BlockState state = null; @@ -270,6 +272,7 @@ public class DefaultBlockParser extends InputParser { } else if (MathMan.isInteger(split[0])) { int id = Integer.parseInt(split[0]); int data = Integer.parseInt(split[1]); + //FAWE start if (data < 0 || data >= 16) { throw new InputParseException(Caption.of("fawe.error.parser.invalid-data", TextComponent.of(data))); } @@ -289,6 +292,7 @@ public class DefaultBlockParser extends InputParser { } CompoundTag nbt = null; + //FAWE end if (state == null) { String typeString; String stateString = null; @@ -319,13 +323,17 @@ public class DefaultBlockParser extends InputParser { if ("hand".equalsIgnoreCase(typeString)) { // Get the block type from the item in the user's hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.MAIN_HAND); + //FAWE start state = blockInHand.toBlockState(); nbt = blockInHand.getNbtData(); + //FAWE end } else if ("offhand".equalsIgnoreCase(typeString)) { // Get the block type from the item in the user's off hand. final BaseBlock blockInHand = getBlockInHand(context.requireActor(), HandSide.OFF_HAND); + //FAWE start state = blockInHand.toBlockState(); nbt = blockInHand.getNbtData(); + //FAWE end } else if (typeString.matches("pos[0-9]+")) { int index = Integer.parseInt(typeString.replaceAll("[a-z]+", "")); // Get the block type from the "primary position" @@ -337,6 +345,7 @@ public class DefaultBlockParser extends InputParser { throw new InputParseException(Caption.of("worldedit.error.incomplete-region")); } state = world.getBlock(primaryPosition); + //FAWE start } else if (typeString.matches("slot[0-9]+")) { int slot = Integer.parseInt(typeString.substring(4)) - 1; Actor actor = context.requireActor(); @@ -369,6 +378,7 @@ public class DefaultBlockParser extends InputParser { if (nbt == null) { nbt = state.getNbtData(); } + //FAWE end blockStates.putAll(parseProperties(state.getBlockType(), stateProperties, context)); if (context.isPreferringWildcard()) { @@ -394,7 +404,7 @@ public class DefaultBlockParser extends InputParser { } // this should be impossible but IntelliJ isn't that smart if (state == null) { - throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input))); + throw new NoMatchException(Caption.of("worldedit.error.unknown-block", TextComponent.of(input))); } if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) { @@ -413,7 +423,7 @@ public class DefaultBlockParser extends InputParser { Actor actor = context.requireActor(); if (actor != null && !actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().disallowedBlocks.contains(blockType.getId())) { - throw new DisallowedUsageException(Caption.of("fawe.error.block.not.allowed", TextComponent.of(input))); + throw new DisallowedUsageException(Caption.of("worldedit.error.disallowed-block", TextComponent.of(input))); } } @@ -462,11 +472,12 @@ public class DefaultBlockParser extends InputParser { } } + //FAWE Start private T validate(ParserContext context, T holder) { if (context.isRestricted()) { Actor actor = context.requireActor(); if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().checkDisallowedBlocks(holder)) { - throw new DisallowedUsageException(Caption.of("fawe.error.block.not.allowed", TextComponent.of(String.valueOf(holder)))); + throw new DisallowedUsageException(Caption.of("worldedit.error.disallowed-block", TextComponent.of(String.valueOf(holder)))); } CompoundTag nbt = holder.getNbtData(); if (nbt != null) { @@ -477,4 +488,5 @@ public class DefaultBlockParser extends InputParser { } return holder; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java index d1be80300..72cd69067 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java @@ -101,16 +101,21 @@ public class DefaultItemParser extends InputParser { if ("hand".equalsIgnoreCase(typeString)) { BaseItemStack heldItem = getItemInHand(context.requireActor(), HandSide.MAIN_HAND); + //FAWE start itemType = heldItem.getType(); itemNbtData = heldItem.getNbt(); + //FAWE end } else if ("offhand".equalsIgnoreCase(typeString)) { BaseItemStack heldItem = getItemInHand(context.requireActor(), HandSide.OFF_HAND); + //FAWE start itemType = heldItem.getType(); itemNbtData = heldItem.getNbt(); + //FAWE end } else { itemType = ItemTypes.get(typeString.toLowerCase(Locale.ROOT)); } + //FAWE start if (itemType == null) { throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-item", TextComponent.of(input))); } @@ -139,6 +144,7 @@ public class DefaultItemParser extends InputParser { return item; } + //FAWE end private BaseItemStack getItemInHand(Actor actor, HandSide handSide) throws InputParseException { if (actor instanceof Player) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java index 4597e2372..08f6ffc26 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlockStateMaskParser.java @@ -58,7 +58,7 @@ public class BlockStateMaskParser extends InputParser { Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states), strict); } catch (Exception e) { - throw new InputParseException(Caption.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e)))); + throw new InputParseException(Caption.of("worldedit.error.parser.bad-state-format", TextComponent.of(String.valueOf(e)))); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/XAxisMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/XAxisMaskParser.java deleted file mode 100644 index 8432a3fe3..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/XAxisMaskParser.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extension.factory.parser.mask; - -import com.fastasyncworldedit.core.object.mask.XAxisMask; -import com.google.common.collect.ImmutableList; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.internal.registry.SimpleInputParser; - -import java.util.List; - -public class XAxisMaskParser extends SimpleInputParser { - - private final List aliases = ImmutableList.of("#xaxis"); - - public XAxisMaskParser(WorldEdit worldEdit) { - super(worldEdit); - } - - @Override - public List getMatchedAliases() { - return aliases; - } - - @Override - public Mask parseFromSimpleInput(String input, ParserContext context) { - return new XAxisMask(context.getExtent()); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java deleted file mode 100644 index 7dd27ffdf..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/YAxisMaskParser.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extension.factory.parser.mask; - -import com.fastasyncworldedit.core.object.mask.YAxisMask; -import com.google.common.collect.ImmutableList; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.internal.registry.SimpleInputParser; - -import java.util.List; - -public class YAxisMaskParser extends SimpleInputParser { - - private final List aliases = ImmutableList.of("#yaxis"); - - public YAxisMaskParser(WorldEdit worldEdit) { - super(worldEdit); - } - - @Override - public List getMatchedAliases() { - return aliases; - } - - @Override - public Mask parseFromSimpleInput(String input, ParserContext context) { - return new YAxisMask(context.getExtent()); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java deleted file mode 100644 index 2bbef3ea6..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/ZAxisMaskParser.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.extension.factory.parser.mask; - -import com.fastasyncworldedit.core.object.mask.ZAxisMask; -import com.google.common.collect.ImmutableList; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.internal.registry.SimpleInputParser; - -import java.util.List; - -public class ZAxisMaskParser extends SimpleInputParser { - - private final List aliases = ImmutableList.of("#zaxis"); - - public ZAxisMaskParser(WorldEdit worldEdit) { - super(worldEdit); - } - - @Override - public List getMatchedAliases() { - return aliases; - } - - @Override - public Mask parseFromSimpleInput(String input, ParserContext context) { - return new ZAxisMask(); - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java index 5d9a5b241..7c47ba188 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/BlockCategoryPatternParser.java @@ -60,13 +60,13 @@ public class BlockCategoryPatternParser extends InputParser { BlockCategory category = BlockCategory.REGISTRY.get(tag); if (category == null) { - throw new InputParseException(Caption.of("fawe.error.unknown-block-tag", TextComponent.of(tag))); + throw new InputParseException(Caption.of("worldedit.error.unknown-tag", TextComponent.of(tag))); } RandomPattern randomPattern = new RandomPattern(); Set blocks = category.getAll(); if (blocks.isEmpty()) { - throw new InputParseException(Caption.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId()))); + throw new InputParseException(Caption.of("worldedit.error.empty-tag", TextComponent.of(category.getId()))); } if (anyState) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java index 6d9db2fa4..1e928a4db 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/ClipboardPatternParser.java @@ -99,10 +99,10 @@ public class ClipboardPatternParser extends InputParser { Clipboard clipboard = holder.getClipboard(); return new ClipboardPattern(clipboard, offset); } catch (EmptyClipboardException e) { - throw new InputParseException(Caption.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard"))); + throw new InputParseException(Caption.of("worldedit.error.empty-clipboard")); } } else { - throw new InputParseException(Caption.of("fawe.error.no-session")); + throw new InputParseException(Caption.of("worldedit.error.missing-session")); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java index b9f73aee2..4bbb20354 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/input/ParserContext.java @@ -48,7 +48,9 @@ public class ParserContext { private boolean restricted = true; private boolean tryLegacy = true; private boolean preferringWildcard; + //Fawe start private InjectedValueAccess injected; + //FAWE end /** * Create a new instance. @@ -260,6 +262,7 @@ public class ParserContext { return tryLegacy; } + //FAWE start public void setInjected(InjectedValueAccess injected) { this.injected = injected; } @@ -267,4 +270,5 @@ public class ParserContext { public InjectedValueAccess getInjected() { return injected; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java index 345d3a61e..0daf50a76 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.extension.platform; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.task.AsyncNotifyQueue; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.internal.cui.CUIEvent; @@ -57,6 +57,7 @@ public abstract class AbstractNonPlayerActor implements Actor { public void dispatchCUIEvent(CUIEvent event) { } + //FAWE start private final ConcurrentHashMap meta = new ConcurrentHashMap<>(); @Override @@ -112,4 +113,5 @@ public abstract class AbstractNonPlayerActor implements Actor { } return true; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 751af2270..d58e878df 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.extension.platform; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.task.AsyncNotifyQueue; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.WEManager; @@ -34,7 +34,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; import com.sk89q.worldedit.regions.CylinderRegion; @@ -56,13 +56,11 @@ import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypeUtil; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; -import com.sk89q.worldedit.world.registry.BlockMaterial; import java.io.File; import java.util.Map; @@ -76,6 +74,7 @@ import javax.annotation.Nullable; * players that make use of WorldEdit. */ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { + //FAWE start private final Map meta; // Queue for async tasks @@ -104,6 +103,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { public AbstractPlayerActor() { this(new ConcurrentHashMap<>()); } + //FAWE end @Override public final Extent getExtent() { @@ -254,57 +254,21 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean ascendLevel() { + final World world = getWorld(); final Location pos = getBlockLocation(); final int x = pos.getBlockX(); - int y = Math.max(0, pos.getBlockY()); + int y = Math.max(world.getMinY(), pos.getBlockY() + 1); final int z = pos.getBlockZ(); - final Extent world = pos.getExtent(); + int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight; + int maxY = Math.min(world.getMaxY(), yPlusSearchHeight) + 2; - int maxY = world.getMaxY(); - if (y >= maxY) { - return false; - } - - BlockMaterial initialMaterial = world.getBlock(BlockVector3.at(x, y, z)).getMaterial(); - - boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube(); - - double height = 1.85; - double freeStart = -1; - - for (int level = y + 1; level <= maxY + 2; level++) { - BlockState state; - if (level >= maxY) { - state = BlockTypes.VOID_AIR.getDefaultState(); - } else { - state = world.getBlock(BlockVector3.at(x, level, z)); + while (y <= maxY) { + if (isLocationGoodForStanding(BlockVector3.at(x, y, z)) + && trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) { + return true; } - BlockType type = state.getBlockType(); - BlockMaterial material = type.getMaterial(); - if (!material.isFullCube() || !material.isMovementBlocker()) { - if (!lastState) { - lastState = BlockTypeUtil.centralBottomLimit(state) != 1; - continue; - } - if (freeStart == -1) { - freeStart = level + BlockTypeUtil.centralTopLimit(state); - } else { - double bottomLimit = BlockTypeUtil.centralBottomLimit(state); - double space = level + bottomLimit - freeStart; - if (space >= height) { - trySetPosition(Vector3.at(x + 0.5, freeStart, z + 0.5)); - return true; - } - // Not enough room, reset the free position - if (bottomLimit != 1) { - freeStart = -1; - } - } - } else { - freeStart = -1; - lastState = true; - } + ++y; } return false; @@ -312,57 +276,21 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean descendLevel() { + final World world = getWorld(); final Location pos = getBlockLocation(); final int x = pos.getBlockX(); - int y = Math.max(0, pos.getBlockY() - 1); + int y = Math.max(world.getMinY(), pos.getBlockY() - 1); final int z = pos.getBlockZ(); - final Extent world = pos.getExtent(); + int yLessSearchHeight = y - WorldEdit.getInstance().getConfiguration().defaultVerticalHeight; + int minY = Math.min(world.getMinY() + 1, yLessSearchHeight); - BlockMaterial initialMaterial = world.getBlock(BlockVector3.at(x, y, z)).getMaterial(); - - boolean lastState = initialMaterial.isMovementBlocker() && initialMaterial.isFullCube(); - - int maxY = world.getMaxY(); - if (y <= 2) { - return false; - } - - double freeEnd = -1; - double height = 1.85; - for (int level = y + 1; level > 0; level--) { - BlockState state; - if (level >= maxY) { - state = BlockTypes.VOID_AIR.getDefaultState(); - } else { - state = world.getBlock(BlockVector3.at(x, level, z)); + while (y >= minY) { + if (isLocationGoodForStanding(BlockVector3.at(x, y, z)) + && trySetPosition(Vector3.at(x + 0.5, y, z + 0.5))) { + return true; } - BlockType type = state.getBlockType(); - BlockMaterial material = type.getMaterial(); - if (!material.isFullCube() || !material.isMovementBlocker()) { - if (!lastState) { - lastState = BlockTypeUtil.centralTopLimit(state) != 0; - continue; - } - if (freeEnd == -1) { - freeEnd = level + BlockTypeUtil.centralBottomLimit(state); - } else { - double topLimit = BlockTypeUtil.centralTopLimit(state); - double freeStart = level + topLimit; - double space = freeEnd - freeStart; - if (space >= height) { - trySetPosition(Vector3.at(x + 0.5, freeStart, z + 0.5)); - return true; - } - // Not enough room, reset the free position - if (topLimit != 0) { - freeEnd = -1; - } - } - } else { - lastState = true; - freeEnd = -1; - } + --y; } return false; @@ -375,19 +303,22 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public boolean ascendToCeiling(int clearance, boolean alwaysGlass) { + World world = getWorld(); Location pos = getBlockLocation(); int x = pos.getBlockX(); - int initialY = Math.max(0, pos.getBlockY()); - int y = Math.max(0, pos.getBlockY() + 2); + int initialY = Math.max(world.getMinY(), pos.getBlockY()); + int y = Math.max(world.getMinY(), pos.getBlockY() + 2); int z = pos.getBlockZ(); - Extent world = getLocation().getExtent(); // No free space above if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isAir()) { return false; } - while (y <= world.getMaximumPoint().getY()) { + int yPlusSearchHeight = y + WorldEdit.getInstance().getConfiguration().defaultVerticalHeight; + int maxY = Math.min(world.getMaxY(), yPlusSearchHeight); + + while (y <= maxY) { // Found a ceiling! if (world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { int platformY = Math.max(initialY, y - 3 - clearance); @@ -416,8 +347,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { final World world = getWorld(); final Location pos = getBlockLocation(); final int x = pos.getBlockX(); - final int initialY = Math.max(0, pos.getBlockY()); - int y = Math.max(0, pos.getBlockY() + 1); + final int initialY = Math.max(world.getMinY(), pos.getBlockY()); + int y = Math.max(world.getMinY(), pos.getBlockY() + 1); final int z = pos.getBlockZ(); final int maxY = Math.min(world.getMaxY() + 1, initialY + distance); @@ -521,6 +452,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { return getCardinalDirection(0); } + //FAWE start /** * Get the player's current allowed WorldEdit regions. * @@ -566,6 +498,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { getSession().setRegionSelector(getWorld(), selector); } + //FAWE end @Override public Direction getCardinalDirection(int yawOffset) { @@ -591,7 +524,9 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { if (typeId.hasBlockType()) { return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { + //FAWE start return BlockTypes.AIR.getDefaultState().toBaseBlock(); // FAWE returns air here + //FAWE end } } @@ -676,6 +611,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { return null; } + //FAWE start /** * Run a task either async, or on the current thread. * @@ -706,6 +642,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { } return true; } + //FAWE end @Override public boolean canDestroyBedrock() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java index 7eb80baaf..86376adee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Actor.java @@ -24,7 +24,7 @@ import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.object.FaweLimit; import com.fastasyncworldedit.core.util.task.InterruptableCondition; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.entity.MapMetadatable; +import com.fastasyncworldedit.core.entity.MapMetadatable; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionOwner; @@ -166,6 +166,20 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab */ void dispatchCUIEvent(CUIEvent event); + /** + * Get the locale of this actor. + * + * @return The locale + */ + Locale getLocale(); + + /** + * Sends any relevant notices to the user when they first use WorldEdit in a session. + */ + default void sendAnnouncements() { + } + + //FAWE start boolean runAction(Runnable ifFree, boolean checkFree, boolean async); /** @@ -242,17 +256,5 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab } return cancelled; } - - /** - * Get the locale of this actor. - * - * @return The locale - */ - Locale getLocale(); - - /** - * Sends any relevant notices to the user when they first use WorldEdit in a session. - */ - default void sendAnnouncements() { - } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Annotations.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Annotations.java index 0a5b74d9e..0f1cae782 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Annotations.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Annotations.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.extension.platform; import com.google.auto.value.AutoAnnotation; -import com.sk89q.worldedit.internal.annotation.PatternList; +import com.sk89q.worldedit.command.util.annotation.PatternList; import com.sk89q.worldedit.internal.annotation.Radii; /** @@ -33,10 +33,12 @@ class Annotations { return new AutoAnnotation_Annotations_radii(value); } + //FAWE start @AutoAnnotation static PatternList patternList() { return new AutoAnnotation_Annotations_patternList(); } + //FAWE end private Annotations() { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java index f74018324..02bcdeb38 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Capability.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.extension.platform; -import com.sk89q.worldedit.WorldEdit; - /** * A collection of capabilities that a {@link Platform} may support. */ @@ -45,7 +43,9 @@ public enum Capability { /** * The capability of providing configuration. */ + //FAWE start CONFIGURATION, + //FAWE end /** * The capability of handling user commands entered in chat or console. @@ -62,6 +62,7 @@ public enum Capability { } }, + //FAWE start /** * The capability of a platform to assess whether a given * {@link Actor} has sufficient authorization to perform a task. @@ -94,6 +95,7 @@ public enum Capability { } */ }; + //FAWE end /** * Initialize platform-wide state. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java index 69fcd0095..1f51dfb57 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.extension.platform; -import com.fastasyncworldedit.core.beta.implementation.lighting.Relighter; -import com.fastasyncworldedit.core.beta.implementation.lighting.RelighterFactory; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; @@ -196,18 +196,6 @@ public interface Platform extends Keyed { */ String getPlatformVersion(); - /** - * {@inheritDoc} - * @return an id - * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility} - * for details - */ - @NonAbstractForCompatibility(delegateName = "getPlatformName", delegateParams = {}) - @Override - default String getId() { - return "legacy:" + getPlatformName().toLowerCase(Locale.ROOT).replaceAll("[^a-z_.-]", "_"); - } - /** * Get a map of advertised capabilities of this platform, where each key * in the given map is a supported capability and the respective value @@ -224,6 +212,19 @@ public interface Platform extends Keyed { */ Set getSupportedSideEffects(); + //FAWE start + /** + * {@inheritDoc} + * @return an id + * @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility} + * for details + */ + @NonAbstractForCompatibility(delegateName = "getPlatformName", delegateParams = {}) + @Override + default String getId() { + return "legacy:" + getPlatformName().toLowerCase(Locale.ROOT).replaceAll("[^a-z_.-]", "_"); + } + /** * Get the {@link RelighterFactory} that can be used to obtain * {@link Relighter}s. @@ -232,4 +233,5 @@ public interface Platform extends Keyed { */ @NotNull RelighterFactory getRelighterFactory(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java index 82f7b0e85..6f6363ce7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java @@ -22,8 +22,8 @@ package com.sk89q.worldedit.extension.platform; import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.task.ThrowableSupplier; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.util.task.ThrowableSupplier; import com.fastasyncworldedit.core.util.StringMan; import com.fastasyncworldedit.core.util.TaskManager; import com.google.common.collect.ImmutableList; @@ -105,17 +105,17 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.Event; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; -import com.sk89q.worldedit.extension.platform.binding.Bindings; -import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings; -import com.sk89q.worldedit.extension.platform.binding.PrimitiveBindings; -import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; +import com.fastasyncworldedit.core.extension.platform.binding.Bindings; +import com.fastasyncworldedit.core.extension.platform.binding.ConsumeBindings; +import com.fastasyncworldedit.core.extension.platform.binding.PrimitiveBindings; +import com.fastasyncworldedit.core.extension.platform.binding.ProvideBindings; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.command.CommandArgParser; import com.sk89q.worldedit.internal.command.CommandLoggingHandler; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; -import com.sk89q.worldedit.internal.command.ConfirmHandler; -import com.sk89q.worldedit.internal.command.MethodInjector; +import com.sk89q.worldedit.command.util.annotation.ConfirmHandler; +import com.fastasyncworldedit.core.internal.command.MethodInjector; import com.sk89q.worldedit.internal.command.exception.ExceptionConverter; import com.sk89q.worldedit.internal.command.exception.WorldEditExceptionConverter; import com.sk89q.worldedit.internal.util.LogManagerCompat; @@ -193,7 +193,9 @@ public final class PlatformCommandManager { private final WorldEditExceptionConverter exceptionConverter; public final CommandRegistrationHandler registration; + //FAWE start private static PlatformCommandManager INSTANCE; + //FAWE end /** * Create a new instance. @@ -203,7 +205,9 @@ public final class PlatformCommandManager { public PlatformCommandManager(final WorldEdit worldEdit, PlatformManager platformManager) { checkNotNull(worldEdit); checkNotNull(platformManager); + //FAWE start INSTANCE = this; + //FAWE end this.worldEdit = worldEdit; this.platformManager = platformManager; @@ -261,6 +265,7 @@ public final class PlatformCommandManager { SideEffectConverter.register(commandManager); HeightConverter.register(commandManager); OffsetConverter.register(worldEdit, commandManager); + //FAWE start commandManager.registerConverter(Key.of(com.sk89q.worldedit.function.pattern.Pattern.class, Annotations.patternList()), CommaSeparatedValuesConverter.wrap(commandManager.getConverter(Key.of( com.sk89q.worldedit.function.pattern.Pattern.class)).get())); @@ -268,11 +273,14 @@ public final class PlatformCommandManager { registerBindings(new ConsumeBindings(worldEdit, this)); registerBindings(new PrimitiveBindings(worldEdit)); registerBindings(new ProvideBindings(worldEdit)); + //FAWE end } + //FAWE start private void registerBindings(Bindings bindings) { bindings.register(globalInjectedValues, commandManager); } + //FAWE end private void registerAlwaysInjectedValues() { globalInjectedValues.injectValue(Key.of(Region.class, Selection.class), @@ -289,6 +297,7 @@ public final class PlatformCommandManager { } }); }); + //FAWE start /* globalInjectedValues.injectValue(Key.of(EditSession.class), context -> { @@ -307,6 +316,7 @@ public final class PlatformCommandManager { // globalInjectedValues.injectValue(Key.of(CFICommands.CFISettings.class), // context -> context.injectedValue(Key.of(Actor.class)) // .orElseThrow(() -> new IllegalStateException("No CFI Settings")).getMeta("CFISettings")); + //FAWE end globalInjectedValues.injectValue(Key.of(World.class), context -> { LocalSession localSession = context.injectedValue(Key.of(LocalSession.class)) @@ -327,7 +337,9 @@ public final class PlatformCommandManager { } }); }); + //FAWE start globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of); + //FAWE end } /** @@ -376,13 +388,14 @@ public final class PlatformCommandManager { CommandManager manager = commandManagerService.newCommandManager(); - handlerInstance.accept((handler, instance) -> { - this.registration.register( - manager, - handler, - instance - ); - }); + //FAWE start + handlerInstance.accept((handler, instance) -> + this.registration.register( + manager, + handler, + instance + )); + //FAWE end additionalConfig.accept(manager); final List subCommands = manager.getAllCommands().collect(Collectors.toList()); @@ -397,6 +410,7 @@ public final class PlatformCommandManager { } public void registerAllCommands() { + //FAWE start if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) { // TODO: Ping @MattBDev to reimplement (or remove) 2020-02-04 // registerSubCommands( @@ -420,6 +434,7 @@ public final class PlatformCommandManager { // TransformCommandsRegistration.builder(), // new TransformCommands() // ); + //FAWE end registerSubCommands( "schematic", ImmutableList.of("schem", "/schematic", "/schem"), @@ -443,6 +458,7 @@ public final class PlatformCommandManager { ); registerSubCommands( "brush", + //FAWE start - register tools as brushes (?) Lists.newArrayList("br", "/brush", "/br", "/tool", "tool"), "Brushing commands", c -> { @@ -450,6 +466,7 @@ public final class PlatformCommandManager { c.accept(ToolCommandsRegistration.builder(), new ToolCommands(worldEdit)); c.accept(ToolUtilCommandsRegistration.builder(), new ToolUtilCommands(worldEdit)); }, + //FAWE end manager -> { PaintBrushCommands.register(commandManagerService, manager, registration); ApplyBrushCommands.register(commandManagerService, manager, registration); @@ -457,28 +474,13 @@ public final class PlatformCommandManager { ); registerSubCommands( "worldedit", + //FAWE start - register fawe ImmutableList.of("we", "fawe", "fastasyncworldedit"), + //FAWE end "WorldEdit commands", WorldEditCommandsRegistration.builder(), new WorldEditCommands(worldEdit) ); - /* - TODO: Ping @MattBDev to reimplement 2020-02-04 - registerSubCommands( - "cfi", - ImmutableList.of("/cfi"), - "CFI commands", - CFICommandsRegistration.builder(), - new CFICommands(worldEdit) - ); - registerSubCommands( - "/anvil", - ImmutableList.of(), - "Manipulate billions of blocks", - AnvilCommandsRegistration.builder(), - new AnvilCommands(worldEdit) - ); - */ this.registration.register( commandManager, BiomeCommandsRegistration.builder(), @@ -505,6 +507,7 @@ public final class PlatformCommandManager { GenerationCommandsRegistration.builder(), new GenerationCommands(worldEdit) ); + //FAWE start HistoryCommands history = new HistoryCommands(worldEdit); this.registration.register( commandManager, @@ -518,6 +521,7 @@ public final class PlatformCommandManager { HistorySubCommandsRegistration.builder(), new HistorySubCommands(history) ); + //FAWE end this.registration.register( commandManager, NavigationCommandsRegistration.builder(), @@ -583,7 +587,7 @@ public final class PlatformCommandManager { dynamicHandler.setHandler(null); COMMAND_LOG.setLevel(Level.OFF); } else { - File file = new File(config.getWorkingDirectory(), path); + File file = new File(config.getWorkingDirectoryPath().toFile(), path); COMMAND_LOG.setLevel(Level.ALL); LOGGER.info("Logging WorldEdit commands to " + file.getAbsolutePath()); @@ -608,6 +612,7 @@ public final class PlatformCommandManager { return CommandArgParser.forArgString(input).parseArgs(); } + //FAWE start public int parseCommand(String args, Actor actor) { InjectedValueAccess context; if (actor == null) { @@ -643,6 +648,7 @@ public final class PlatformCommandManager { @Subscribe public void handleCommand(CommandEvent event) { Request.reset(); + Actor actor = event.getActor(); String args = event.getArguments(); TaskManager.IMP.taskNow(() -> { @@ -802,8 +808,11 @@ public final class PlatformCommandManager { PrintCommandHelp.help(arguments, 0, false, getCommandManager(), actor, "//help"); } + //FAWE end + //FAWE start - Event & suggestions private MemoizingValueAccess initializeInjectedValues(Arguments arguments, Actor actor, Event event, boolean isSuggestions) { + //FAWE end InjectedValueStore store = MapBackedValueStore.create(); store.injectValue(Key.of(Actor.class), ValueProvider.constant(actor)); if (actor instanceof Player) { @@ -838,14 +847,18 @@ public final class PlatformCommandManager { public void handleCommandSuggestion(CommandSuggestionEvent event) { try { String rawArgs = event.getArguments(); + //FAWE start // Increase the resulting positions by 1 if we remove a leading `/` final int posOffset = rawArgs.startsWith("/") ? 1 : 0; String arguments = rawArgs.startsWith("/") ? rawArgs.substring(1) : rawArgs; + //FAWE end List split = parseArgs(arguments).collect(Collectors.toList()); List argStrings = split.stream() .map(Substring::getSubstring) .collect(Collectors.toList()); + //FAWE start - event & suggestion MemoizingValueAccess access = initializeInjectedValues(() -> arguments, event.getActor(), event, true); + //FAWE end ImmutableSet suggestions; try { suggestions = commandManager.getSuggestions(access, argStrings); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 72cddf9ae..967dc046d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -20,8 +20,8 @@ package com.sk89q.worldedit.extension.platform; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.pattern.PatternTraverser; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.function.pattern.PatternTraverser; import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper; import com.fastasyncworldedit.core.wrappers.WorldWrapper; import com.sk89q.worldedit.LocalConfiguration; @@ -43,7 +43,6 @@ import com.sk89q.worldedit.event.platform.PlatformUnreadyEvent; import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent; import com.sk89q.worldedit.event.platform.PlayerInputEvent; import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.SideEffect; @@ -174,10 +173,12 @@ public class PlatformManager { } else { if (preferences.isEmpty()) { // Not all platforms registered, this is being called too early! + //FAWE start - exchange WE -> FAWE throw new NoCapablePlatformException( "Not all platforms have been registered yet!" + " Please wait until FastAsyncWorldEdit is initialized." ); + //FAWE end } throw new NoCapablePlatformException("No platform was found supporting " + capability.name()); } @@ -288,9 +289,11 @@ public class PlatformManager { } } + //FAWE start private T proxyFawe(T player) { return (T) new LocationMaskedPlayerWrapper(player, player.getLocation(), true); } + //FAWE end /** * Get the command manager. @@ -378,17 +381,17 @@ public class PlatformManager { Request.request().setWorld(player.getWorld()); try { - Vector3 vector = location.toVector(); - if (event.getType() == Interaction.HIT) { // superpickaxe is special because its primary interaction is a left click, not a right click // in addition, it is implicitly bound to all pickaxe items, not just a single tool item if (session.hasSuperPickAxe() && player.isHoldingPickAxe()) { final BlockTool superPickaxe = session.getSuperPickaxe(); if (superPickaxe != null && superPickaxe.canUse(player)) { + //FAWE start - run async player.runAction(() -> reset(superPickaxe) .actPrimary(queryCapability(Capability.WORLD_EDITING), - getConfiguration(), player, session, location), false, true); + getConfiguration(), player, session, location, event.getFace()), false, true); + //FAWE end event.setCancelled(true); return; } @@ -396,24 +399,29 @@ public class PlatformManager { Tool tool = session.getTool(player); if (tool instanceof DoubleActionBlockTool && tool.canUse(player)) { + //FAWE start - run async player.runAction(() -> reset((DoubleActionBlockTool) tool) .actSecondary(queryCapability(Capability.WORLD_EDITING), - getConfiguration(), player, session, location), false, true); + getConfiguration(), player, session, location, event.getFace()), false, true); + //FAWE end event.setCancelled(true); } } else if (event.getType() == Interaction.OPEN) { + //FAWE start - get general tool over item in main hand & run async Tool tool = session.getTool(player); if (tool instanceof BlockTool && tool.canUse(player)) { if (player.checkAction()) { + // FAWE run async player.runAction(() -> { BlockTool blockTool = (BlockTool) tool; if (!(tool instanceof BrushTool)) { blockTool = reset(blockTool); } blockTool.actPrimary(queryCapability(Capability.WORLD_EDITING), - getConfiguration(), player, session, location); + getConfiguration(), player, session, location, event.getFace()); }, false, true); + //FAWE end event.setCancelled(true); } } @@ -425,6 +433,7 @@ public class PlatformManager { } } + //FAWE start public void handleThrowable(Throwable e, Actor actor) { FaweException faweException = FaweException.get(e); if (faweException != null) { @@ -435,6 +444,7 @@ public class PlatformManager { e.printStackTrace(); } } + //FAWE end @Subscribe public void handlePlayerInput(PlayerInputEvent event) { @@ -448,8 +458,10 @@ public class PlatformManager { case PRIMARY: { Tool tool = session.getTool(player); if (tool instanceof DoubleActionTraceTool && tool.canUse(player)) { + //FAWE start - run async player.runAsyncIfFree(() -> reset((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session)); + //FAWE end event.setCancelled(true); return; } @@ -460,9 +472,11 @@ public class PlatformManager { case SECONDARY: { Tool tool = session.getTool(player); if (tool instanceof TraceTool && tool.canUse(player)) { + //FAWE start - run async //todo this needs to be fixed so the event is canceled after actPrimary is used and returns true player.runAction(() -> reset((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session), false, true); + //FAWE end event.setCancelled(true); return; } @@ -470,6 +484,7 @@ public class PlatformManager { break; } } + //FAWE start - add own message } catch (Throwable e) { FaweException faweException = FaweException.get(e); if (faweException != null) { @@ -479,6 +494,7 @@ public class PlatformManager { player.print(Caption.of(e.getClass().getName() + ": " + e.getMessage())); e.printStackTrace(); } + //FAWE end } finally { Request.reset(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index 3a8732255..78191b332 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -49,7 +49,9 @@ public class PlayerProxy extends AbstractPlayerActor { private final Actor permActor; private final Actor cuiActor; private final World world; + //FAWE start private Vector3 offset = Vector3.ZERO; + //FAWE end public PlayerProxy(Player player) { this(player, player, player, player.getWorld()); @@ -67,27 +69,6 @@ public class PlayerProxy extends AbstractPlayerActor { this.world = world; } - public static Player unwrap(Player player) { - if (player instanceof PlayerProxy) { - return unwrap(((PlayerProxy) player).getBasePlayer()); - } - return player; - } - - public void setOffset(Vector3 position) { - this.offset = position; - } - - @Override - public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { - return basePlayer.getBlockInHand(handSide); - } - - @Override - public boolean runAction(Runnable ifFree, boolean checkFree, boolean async) { - return basePlayer.runAction(ifFree, checkFree, async); - } - @Override public UUID getUniqueId() { return basePlayer.getUniqueId(); @@ -225,15 +206,6 @@ public class PlayerProxy extends AbstractPlayerActor { basePlayer.sendFakeBlock(pos, block); } - @Override - public void sendTitle(Component title, Component sub) { - basePlayer.sendTitle(title, sub); - } - - public Player getBasePlayer() { - return basePlayer; - } - @Override public void floatAt(int x, int y, int z, boolean alwaysGlass) { basePlayer.floatAt(x, y, z, alwaysGlass); @@ -243,4 +215,36 @@ public class PlayerProxy extends AbstractPlayerActor { public Locale getLocale() { return basePlayer.getLocale(); } + + //FAWE start + public static Player unwrap(Player player) { + if (player instanceof PlayerProxy) { + return unwrap(((PlayerProxy) player).getBasePlayer()); + } + return player; + } + + public void setOffset(Vector3 position) { + this.offset = position; + } + + @Override + public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { + return basePlayer.getBlockInHand(handSide); + } + + @Override + public boolean runAction(Runnable ifFree, boolean checkFree, boolean async) { + return basePlayer.runAction(ifFree, checkFree, async); + } + + @Override + public void sendTitle(Component title, Component sub) { + basePlayer.sendTitle(title, sub); + } + + public Player getBasePlayer() { + return basePlayer; + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index f0efe75be..2c751fb86 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.extent; -import com.fastasyncworldedit.core.beta.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.HistoryExtent; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; -import com.fastasyncworldedit.core.object.exception.FaweException; +import com.fastasyncworldedit.core.extent.HistoryExtent; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; @@ -53,12 +53,15 @@ import static org.apache.logging.log4j.LogManager.getLogger; /** * A base class for {@link Extent}s that merely passes extents onto another. */ +//FAWE start - made none abstract public class AbstractDelegateExtent implements Extent { +//FAWE end private static final Logger LOGGER = LogManagerCompat.getLogger(); - //Not safe for public usage + //FAWE start - made public: Not safe for public usage public Extent extent; + //FAWE end /** * Create a new instance. @@ -81,7 +84,9 @@ public class AbstractDelegateExtent implements Extent { @Override public BlockState getBlock(BlockVector3 position) { + //FAWE start - return coordinates return extent.getBlock(position.getX(), position.getY(), position.getZ()); + //FAWE end } @Override @@ -91,107 +96,23 @@ public class AbstractDelegateExtent implements Extent { @Override public BaseBlock getFullBlock(BlockVector3 position) { + //FAWE start - return coordinates return extent.getFullBlock(position.getX(), position.getY(), position.getZ()); + //FAWE end } + //FAWE start /* Queue based methods TODO NOT IMPLEMENTED: IQueueExtent and such need to implement these - */ + */ + //FAWE end @Override public BaseBlock getFullBlock(int x, int y, int z) { + //FAWE start - return coordinates return extent.getFullBlock(x, y, z); - } - - @Override - public BiomeType getBiomeType(int x, int y, int z) { - return extent.getBiomeType(x, y, z); - } - - @Override - public BiomeType getBiome(BlockVector3 position) { - return extent.getBiome(position); - } - /* - History - */ - - @Override - public int getEmmittedLight(int x, int y, int z) { - return extent.getEmmittedLight(x, y, z); - } - - @Override - public int getSkyLight(int x, int y, int z) { - return extent.getSkyLight(x, y, z); - } - - @Override - public int getBrightness(int x, int y, int z) { - return extent.getBrightness(x, y, z); - } - - public void setChangeSet(AbstractChangeSet changeSet) { - if (extent instanceof HistoryExtent) { - HistoryExtent history = ((HistoryExtent) extent); - if (changeSet == null) { - new ExtentTraverser(this).setNext(history.getExtent()); - } else { - history.setChangeSet(changeSet); - } - } else if (extent instanceof AbstractDelegateExtent) { - ((AbstractDelegateExtent) extent).setChangeSet(changeSet); - } else if (changeSet != null) { - new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet)); - } - } - - @Override - public > boolean setBlock(BlockVector3 position, T block) - throws WorldEditException { - return extent.setBlock(position.getX(), position.getY(), position.getZ(), block); - } - - @Override - public > boolean setBlock(int x, @Range(from = 0, to = 255) int y, - int z, T block) throws WorldEditException { - return extent.setBlock(x, y, z, block); - } - - @Override - public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { - return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile)); - } - - @Override - public boolean fullySupports3DBiomes() { - return extent.fullySupports3DBiomes(); - } - - @Override - public boolean setBiome(int x, int y, int z, BiomeType biome) { - return extent.setBiome(x, y, z, biome); - } - - @Override - public boolean setBiome(BlockVector3 position, BiomeType biome) { - return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome); - } - - @Override - public void setBlockLight(int x, int y, int z, int value) { - extent.setSkyLight(x, y, z, value); - } - - @Override - public void setSkyLight(int x, int y, int z, int value) { - extent.setSkyLight(x, y, z, value); - } - - @Override - public String toString() { - return super.toString() + ":" + (extent == this ? "" : extent.toString()); + //FAWE end } @Override @@ -220,6 +141,28 @@ public class AbstractDelegateExtent implements Extent { return extent.createEntity(location, entity); } + @Override + @Nullable + public Operation commit() { + Operation ours = commitBefore(); + Operation other = null; + //FAWE start - implement extent + if (extent != this) { + other = extent.commit(); + } + //FAWE end + if (ours != null && other != null) { + return new OperationQueue(ours, other); + } else if (ours != null) { + return ours; + } else if (other != null) { + return other; + } else { + return null; + } + } + + //FAWE start @Override public void removeEntity(int x, int y, int z, UUID uuid) { extent.removeEntity(x, y, z, uuid); @@ -256,25 +199,6 @@ public class AbstractDelegateExtent implements Extent { } } - @Override - @Nullable - public Operation commit() { - Operation ours = commitBefore(); - Operation other = null; - if (extent != this) { - other = extent.commit(); - } - if (ours != null && other != null) { - return new OperationQueue(ours, other); - } else if (ours != null) { - return ours; - } else if (other != null) { - return other; - } else { - return null; - } - } - @Override public int getMaxY() { return extent.getMaxY(); @@ -343,4 +267,95 @@ public class AbstractDelegateExtent implements Extent { protected Operation commitBefore() { return null; } + + @Override + public BiomeType getBiomeType(int x, int y, int z) { + return extent.getBiomeType(x, y, z); + } + + @Override + public BiomeType getBiome(BlockVector3 position) { + return extent.getBiome(position); + } + /* + History + */ + + @Override + public int getEmittedLight(int x, int y, int z) { + return extent.getEmittedLight(x, y, z); + } + + @Override + public int getSkyLight(int x, int y, int z) { + return extent.getSkyLight(x, y, z); + } + + @Override + public int getBrightness(int x, int y, int z) { + return extent.getBrightness(x, y, z); + } + + public void setChangeSet(AbstractChangeSet changeSet) { + if (extent instanceof HistoryExtent) { + HistoryExtent history = ((HistoryExtent) extent); + if (changeSet == null) { + new ExtentTraverser(this).setNext(history.getExtent()); + } else { + history.setChangeSet(changeSet); + } + } else if (extent instanceof AbstractDelegateExtent) { + ((AbstractDelegateExtent) extent).setChangeSet(changeSet); + } else if (changeSet != null) { + new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet)); + } + } + + @Override + public > boolean setBlock(BlockVector3 position, T block) + throws WorldEditException { + return extent.setBlock(position.getX(), position.getY(), position.getZ(), block); + } + + @Override + public > boolean setBlock(int x, @Range(from = 0, to = 255) int y, + int z, T block) throws WorldEditException { + return extent.setBlock(x, y, z, block); + } + + @Override + public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { + return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile)); + } + + @Override + public boolean fullySupports3DBiomes() { + return extent.fullySupports3DBiomes(); + } + + @Override + public boolean setBiome(int x, int y, int z, BiomeType biome) { + return extent.setBiome(x, y, z, biome); + } + + @Override + public boolean setBiome(BlockVector3 position, BiomeType biome) { + return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome); + } + + @Override + public void setBlockLight(int x, int y, int z, int value) { + extent.setSkyLight(x, y, z, value); + } + + @Override + public void setSkyLight(int x, int y, int z, int value) { + extent.setSkyLight(x, y, z, value); + } + + @Override + public String toString() { + return super.toString() + ":" + (extent == this ? "" : extent.toString()); + } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java index a909c1ba8..638d1ec98 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java @@ -20,15 +20,15 @@ package com.sk89q.worldedit.extent; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ExtentFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.extent.filter.block.ExtentFilterBlock; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; -import com.fastasyncworldedit.core.object.clipboard.WorldCopyClipboard; -import com.fastasyncworldedit.core.object.exception.FaweException; -import com.fastasyncworldedit.core.object.extent.NullExtent; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.extent.clipboard.WorldCopyClipboard; +import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.extent.NullExtent; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; @@ -37,11 +37,11 @@ import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.RegionMaskingFilter; import com.sk89q.worldedit.function.block.BlockReplace; -import com.sk89q.worldedit.function.generator.CavesGen; -import com.sk89q.worldedit.function.generator.GenBase; -import com.sk89q.worldedit.function.generator.OreGen; -import com.sk89q.worldedit.function.generator.Resource; -import com.sk89q.worldedit.function.generator.SchemGen; +import com.fastasyncworldedit.core.function.generator.CavesGen; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.OreGen; +import com.fastasyncworldedit.core.function.generator.Resource; +import com.fastasyncworldedit.core.function.generator.SchemGen; import com.sk89q.worldedit.function.mask.BlockMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; @@ -53,11 +53,11 @@ import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.MathUtils; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.PropertyGroup; +import com.fastasyncworldedit.core.registry.state.PropertyGroup; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Location; @@ -147,6 +147,7 @@ public interface Extent extends InputExtent, OutputExtent { return null; } + //FAWE start /** * Create an entity at the given location. * @@ -741,4 +742,5 @@ public interface Extent extends InputExtent, OutputExtent { } return filter; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java index 868e4aefa..67d8c92b0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java @@ -19,13 +19,13 @@ package com.sk89q.worldedit.extent; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -53,6 +53,7 @@ public interface InputExtent { return getBlock(position.getX(), position.getY(), position.getZ()); } + //FAWE start default BlockState getBlock(int x, int y, int z) { return getBlock(MutableBlockVector3.get(x, y, z)); } @@ -70,6 +71,7 @@ public interface InputExtent { default BaseBlock getFullBlock(int x, int y, int z) { return getFullBlock(MutableBlockVector3.get(x, y, z)); } + //FAWE end /** * Get the biome at the given location. @@ -114,17 +116,18 @@ public interface InputExtent { return getBiome(position.toBlockVector2()); } + //FAWE start /** * Get the light level at the given location. * * @param position location * @return the light level at the location */ - default int getEmmittedLight(BlockVector3 position) { - return getEmmittedLight(position.getX(), position.getY(), position.getZ()); + default int getEmittedLight(BlockVector3 position) { + return getEmittedLight(position.getX(), position.getY(), position.getZ()); } - default int getEmmittedLight(int x, int y, int z) { + default int getEmittedLight(int x, int y, int z) { return 0; } @@ -161,4 +164,5 @@ public interface InputExtent { default int[] getHeightMap(HeightMapType type) { return new int[256]; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java index 5b7576c8c..bc7c1cdc3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java @@ -20,15 +20,15 @@ package com.sk89q.worldedit.extent; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.filter.block.CharFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.filter.block.CharFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.google.common.cache.LoadingCache; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.mask.Mask; @@ -47,7 +47,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public class MaskingExtent extends AbstractDelegateExtent implements IBatchProcessor, Filter { private Mask mask; + //FAWE start private final LoadingCache threadIdToFilter; + //FAWE end /** * Create a new instance. @@ -59,15 +61,19 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce super(extent); checkNotNull(mask); this.mask = mask; + //FAWE start this.threadIdToFilter = FaweCache.IMP.createCache(() -> new CharFilterBlock(getExtent())); + //FAWE end } + //FAWE start private MaskingExtent(Extent extent, Mask mask, LoadingCache threadIdToFilter) { super(extent); checkNotNull(mask); this.mask = mask; this.threadIdToFilter = threadIdToFilter; } + //FAWE end /** * Get the mask. @@ -88,6 +94,7 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce this.mask = mask; } + //FAWE start @Override public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { return this.mask.test(location) && super.setBlock(location, block); @@ -134,4 +141,5 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce public ProcessorScope getScope() { return ProcessorScope.REMOVING_BLOCKS; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index ecb946fee..0cbbba151 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -91,12 +91,6 @@ public class NullExtent implements Extent { return false; } - @Override - public > boolean setBlock(int x, int y, int z, T block) - throws WorldEditException { - return false; - } - @Override public boolean fullySupports3DBiomes() { return false; @@ -112,11 +106,19 @@ public class NullExtent implements Extent { return false; } + //FAWE start @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { return false; } + @Override + public > boolean setBlock(int x, int y, int z, T block) + throws WorldEditException { + return false; + } + //FAWE end + @Nullable @Override public Operation commit() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java index 45b1d0713..d7b3954e4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.extent; -import com.fastasyncworldedit.core.beta.implementation.lighting.HeightMapType; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.operation.Operation; @@ -27,7 +27,7 @@ import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; @@ -112,6 +112,7 @@ public interface OutputExtent { return setBiome(MutableBlockVector3.get(x, y, z), biome); } + //FAWE start /** * Set the biome. * @@ -159,6 +160,7 @@ public interface OutputExtent { default void setSkyLight(BlockVector3 position, int value) { setSkyLight(position.getX(), position.getY(), position.getZ(), value); } + //FAWE end default void setSkyLight(int x, int y, int z, int value) { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index f3b5e3850..9a515bb06 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -68,10 +68,12 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat this(delegate, Masks.alwaysTrue()); } + //FAWE start @Override public boolean isQueueEnabled() { return true; } + //FAWE end /** * Create a new extent buffer that will buffer changes that meet the criteria @@ -102,16 +104,19 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat max = max.getMaximum(location); } + //FAWE start if (mask.test(location)) { buffer.put(location, block.toBaseBlock()); return true; } else { return getExtent().setBlock(location, block); } + //FAWE end } @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { + //FAWE start // Update minimum if (min == null) { min = position; @@ -132,10 +137,12 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } else { return getExtent().setBiome(position, biome); } + //FAWE end } @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { + //FAWE start // Update minimum if (min == null) { min = BlockVector3.at(x, y, z); @@ -156,6 +163,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat } else { return getExtent().setBiome(x, y, z, biome); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index d87ea7c2a..7850a00be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -25,11 +25,11 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.visitor.Order; +import com.fastasyncworldedit.core.function.visitor.Order; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector2; -import com.sk89q.worldedit.math.OffsetBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector2; +import com.fastasyncworldedit.core.math.OffsetBlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; @@ -53,6 +53,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class BlockArrayClipboard implements Clipboard { + //FAWE start private final Region region; private final BlockVector3 origin; private final Clipboard parent; @@ -87,6 +88,7 @@ public class BlockArrayClipboard implements Clipboard { this.region = region.clone(); this.origin = region.getMinimumPoint(); } + //FAWE end @Override public Region getRegion() { @@ -139,14 +141,17 @@ public class BlockArrayClipboard implements Clipboard { @Override public > boolean setBlock(BlockVector3 position, B block) throws WorldEditException { if (region.contains(position)) { + //FAWE - get points final int x = position.getBlockX(); final int y = position.getBlockY(); final int z = position.getBlockZ(); return setBlock(x, y, z, block); + //FAWE end } return false; } + //FAWE start @Override public boolean setTile(int x, int y, int z, CompoundTag tag) { x -= origin.getX(); @@ -155,6 +160,7 @@ public class BlockArrayClipboard implements Clipboard { return getParent().setTile(x, y, z, tag); } + public boolean setTile(BlockVector3 position, CompoundTag tag) { return setTile(position.getX(), position.getY(), position.getZ(), tag); } @@ -293,6 +299,7 @@ public class BlockArrayClipboard implements Clipboard { OffsetBlockVector3 mutable = new OffsetBlockVector3(origin); return Iterators.transform(getParent().iterator(order), mutable::init); } + //FAWE end @Override public BlockVector3 getDimensions() { @@ -313,6 +320,7 @@ public class BlockArrayClipboard implements Clipboard { this.parent.close(); } + //FAWE start /** * Stores entity data. */ @@ -384,4 +392,5 @@ public class BlockArrayClipboard implements Clipboard { return result != null; } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java index 406b60de9..2270fd3f8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java @@ -19,12 +19,12 @@ package com.sk89q.worldedit.extent.clipboard; -import com.fastasyncworldedit.core.beta.Filter; +import com.fastasyncworldedit.core.queue.Filter; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.clipboard.CPUOptimizedClipboard; -import com.fastasyncworldedit.core.object.clipboard.DiskOptimizedClipboard; -import com.fastasyncworldedit.core.object.clipboard.MemoryOptimizedClipboard; -import com.fastasyncworldedit.core.object.clipboard.ReadOnlyClipboard; +import com.fastasyncworldedit.core.extent.clipboard.CPUOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.MemoryOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard; import com.fastasyncworldedit.core.util.EditSessionBuilder; import com.fastasyncworldedit.core.util.MaskTraverser; import com.sk89q.worldedit.EditSession; @@ -38,7 +38,7 @@ import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operations; -import com.sk89q.worldedit.function.visitor.Order; +import com.fastasyncworldedit.core.function.visitor.Order; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.Transform; @@ -66,6 +66,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public interface Clipboard extends Extent, Iterable, Closeable { + //FAWE start static Clipboard create(Region region) { checkNotNull(region); checkNotNull(region.getWorld(), @@ -84,6 +85,7 @@ public interface Clipboard extends Extent, Iterable, Closeable { return new MemoryOptimizedClipboard(region); } } + //FAWE end /** * Get the bounding region of this extent. @@ -127,6 +129,7 @@ public interface Clipboard extends Extent, Iterable, Closeable { return false; } + //FAWE start /** * Remove entity from clipboard. */ @@ -358,4 +361,5 @@ public interface Clipboard extends Extent, Iterable, Closeable { } } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java index c0c97a55c..3fe63f2c4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java @@ -19,16 +19,18 @@ package com.sk89q.worldedit.extent.clipboard.io; -import com.fastasyncworldedit.core.object.io.PGZIPOutputStream; -import com.fastasyncworldedit.core.object.io.ResettableFileInputStream; -import com.fastasyncworldedit.core.object.schematic.MinecraftStructure; -import com.fastasyncworldedit.core.object.schematic.PNGWriter; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReader; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicWriter; +import com.fastasyncworldedit.core.internal.io.ResettableFileInputStream; +import com.fastasyncworldedit.core.extent.clipboard.io.schematic.MinecraftStructure; +import com.fastasyncworldedit.core.extent.clipboard.io.schematic.PNGWriter; import com.google.common.collect.ImmutableSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.NamedTag; import com.sk89q.jnbt.Tag; +import org.anarres.parallelgzip.ParallelGZIPOutputStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -48,6 +50,7 @@ import java.util.zip.GZIPOutputStream; */ public enum BuiltInClipboardFormat implements ClipboardFormat { + //FAWE start - register fast clipboard io FAST("fast", "fawe") { @Override @@ -68,11 +71,11 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { OutputStream gzip; - if (outputStream instanceof PGZIPOutputStream || outputStream instanceof GZIPOutputStream) { + if (outputStream instanceof ParallelGZIPOutputStream || outputStream instanceof GZIPOutputStream) { gzip = outputStream; } else { outputStream = new BufferedOutputStream(outputStream); - gzip = new PGZIPOutputStream(outputStream); + gzip = new ParallelGZIPOutputStream(outputStream); } NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip)); return new FastSchematicWriter(nbtStream); @@ -85,6 +88,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { } }, + //FAWE end /** * The Schematic format used by MCEdit. @@ -104,7 +108,10 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { - throw new IOException("The formats `.schematic`, `.mcedit` and `.mce` are discontinued on versions newer than 1.12 and superseded by the sponge schematic implementation known for `.schem` files."); + //FAWE start - be a more helpful exception + throw new IOException("The formats `.schematic`, `.mcedit` and `.mce` are discontinued on versions newer than" + + "1.12 and superseded by the sponge schematic implementation known for `.schem` files."); + //FAWE end } @Override @@ -154,6 +161,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { } }, + //FAWE start - recover schematics with bad entity data & register other clipboard formats BROKENENTITY("brokenentity", "legacyentity", "le", "be", "brokenentities", "legacyentities") { @Override @@ -176,11 +184,11 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { OutputStream gzip; - if (outputStream instanceof PGZIPOutputStream || outputStream instanceof GZIPOutputStream) { + if (outputStream instanceof ParallelGZIPOutputStream || outputStream instanceof GZIPOutputStream) { gzip = outputStream; } else { outputStream = new BufferedOutputStream(outputStream); - gzip = new PGZIPOutputStream(outputStream); + gzip = new ParallelGZIPOutputStream(outputStream); } NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip)); FastSchematicWriter writer = new FastSchematicWriter(nbtStream); @@ -215,7 +223,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public ClipboardWriter getWriter(OutputStream outputStream) throws IOException { outputStream = new BufferedOutputStream(outputStream); - OutputStream gzip = new PGZIPOutputStream(outputStream); + OutputStream gzip = new ParallelGZIPOutputStream(outputStream); NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip)); return new MinecraftStructure(nbtStream); } @@ -252,6 +260,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { return "png"; } }; + //FAWE end private final ImmutableSet aliases; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java index 07292f388..55ba6499c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormat.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit.extent.clipboard.io; -import com.fastasyncworldedit.core.object.RunnableVal; -import com.fastasyncworldedit.core.object.clipboard.URIClipboardHolder; -import com.fastasyncworldedit.core.object.io.PGZIPOutputStream; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; import com.fastasyncworldedit.core.util.MainUtil; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import org.anarres.parallelgzip.ParallelGZIPOutputStream; import java.io.File; import java.io.FileInputStream; @@ -99,6 +99,7 @@ public interface ClipboardFormat { */ Set getFileExtensions(); + //FAWE start /** * Sets the actor's clipboard. * @param actor the actor @@ -131,9 +132,8 @@ public interface ClipboardFormat { return getReader(stream).read(); } - default URL upload(final Clipboard clipboard) { - return MainUtil.upload(null, null, getPrimaryFileExtension(), new RunnableVal() { + return MainUtil.upload(null, null, getPrimaryFileExtension(), new RunnableVal<>() { @Override public void run(OutputStream value) { write(value, clipboard); @@ -143,7 +143,7 @@ public interface ClipboardFormat { default void write(OutputStream value, Clipboard clipboard) { try { - try (PGZIPOutputStream gzip = new PGZIPOutputStream(value)) { + try (ParallelGZIPOutputStream gzip = new ParallelGZIPOutputStream(value)) { try (ClipboardWriter writer = getWriter(gzip)) { writer.write(clipboard); } @@ -152,4 +152,5 @@ public interface ClipboardFormat { throw new RuntimeException(e); } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java index 2bd5ee01b..f1312984e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardFormats.java @@ -21,10 +21,10 @@ package com.sk89q.worldedit.extent.clipboard.io; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.clipboard.LazyClipboardHolder; -import com.fastasyncworldedit.core.object.clipboard.MultiClipboardHolder; -import com.fastasyncworldedit.core.object.clipboard.URIClipboardHolder; -import com.fastasyncworldedit.core.object.io.FastByteArrayOutputStream; +import com.fastasyncworldedit.core.extent.clipboard.LazyClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; +import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; +import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.fastasyncworldedit.core.util.MainUtil; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -126,26 +126,6 @@ public class ClipboardFormats { return null; } - /** - * Detect the format using the given extension. - * - * @param extension the extension - * @return the format, otherwise null if one cannot be detected - */ - @Nullable - public static ClipboardFormat findByExtension(String extension) { - checkNotNull(extension); - - Collection> entries = getFileExtensionMap().entries(); - for (Map.Entry entry : entries) { - if (entry.getKey().equalsIgnoreCase(extension)) { - return entry.getValue(); - } - } - return null; - - } - /** * A mapping from extensions to formats. * @@ -170,6 +150,27 @@ public class ClipboardFormats { private ClipboardFormats() { } + //FAWE start + /** + * Detect the format using the given extension. + * + * @param extension the extension + * @return the format, otherwise null if one cannot be detected + */ + @Nullable + public static ClipboardFormat findByExtension(String extension) { + checkNotNull(extension); + + Collection> entries = getFileExtensionMap().entries(); + for (Map.Entry entry : entries) { + if (entry.getKey().equalsIgnoreCase(extension)) { + return entry.getValue(); + } + } + return null; + + } + public static MultiClipboardHolder loadAllFromInput(Actor player, String input, ClipboardFormat format, boolean message) throws IOException { checkNotNull(player); checkNotNull(input); @@ -325,4 +326,5 @@ public class ClipboardFormats { throw new RuntimeException(e); } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java index 09271b0c2..abc5095a8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardReader.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.extent.clipboard.io; -import com.fastasyncworldedit.core.object.clipboard.DiskOptimizedClipboard; +import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; @@ -43,7 +43,9 @@ public interface ClipboardReader extends Closeable { * @throws IOException thrown on I/O error */ default Clipboard read() throws IOException { + //FAWE start return read(UUID.randomUUID()); + //FAWe end } /** @@ -55,6 +57,7 @@ public interface ClipboardReader extends Closeable { return OptionalInt.empty(); } + //FAWE start default Clipboard read(UUID uuid) throws IOException { return read(uuid, DiskOptimizedClipboard::new); } @@ -62,4 +65,5 @@ public interface ClipboardReader extends Closeable { default Clipboard read(UUID uuid, Function createOutput) throws IOException { return read(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java index 030a22d2f..b7cf7a050 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/ClipboardWriter.java @@ -47,6 +47,7 @@ public interface ClipboardWriter extends Closeable { */ void write(Clipboard clipboard) throws IOException; + //FAWE start default Tag writeVector(Vector3 vector) { List list = new ArrayList<>(); list.add(new DoubleTag(vector.getX())); @@ -61,4 +62,5 @@ public interface ClipboardWriter extends Closeable { list.add(new FloatTag(location.getPitch())); return new ListTag(FloatTag.class, list); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index b52e483ce..4f536fc35 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -222,7 +222,9 @@ public class MCEditSchematicReader extends NBTSchematicReader { } if (fixer != null && t != null) { + //FAWE start t = (CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, t.asBinaryTag(), -1)); + //FAWE end } BlockVector3 vec = BlockVector3.at(x, y, z); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java index af2b85a2f..44a133cfd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/NBTSchematicReader.java @@ -26,7 +26,7 @@ import java.util.Map; import javax.annotation.Nullable; /** - * Base class for NBT schematic readers + * Base class for NBT schematic readers. */ public abstract class NBTSchematicReader implements ClipboardReader { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index 099efa100..6a8708404 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -125,7 +125,9 @@ public class SpongeSchematicReader extends NBTSchematicReader { BlockArrayClipboard clip = readVersion1(schematicTag); return readVersion2(clip, schematicTag); } - throw new IOException("This schematic version is not supported; Version: " + schematicVersion + ", DataVersion: " + dataVersion + ". It's very likely your schematic has an invalid file extension, if the schematic has been created on a version lower than 1.13.2, the extension MUST be `.schematic`, elsewise the schematic can't be read properly."); + throw new IOException("This schematic version is not supported; Version: " + schematicVersion + ", DataVersion: " + dataVersion + "." + + "It's very likely your schematic has an invalid file extension, if the schematic has been created on a version lower than" + + "1.13.2, the extension MUST be `.schematic`, elsewise the schematic can't be read properly."); } @Override @@ -248,7 +250,10 @@ public class SpongeSchematicReader extends NBTSchematicReader { values.remove("Id"); values.remove("Pos"); if (fixer != null) { - tileEntity = ((CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values).asBinaryTag(), dataVersion))).getValue(); + //FAWE start + tileEntity = ((CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, + new CompoundTag(values).asBinaryTag(), dataVersion))).getValue(); + //FAWE end } else { tileEntity = values; } @@ -386,7 +391,9 @@ public class SpongeSchematicReader extends NBTSchematicReader { entityTag = entityTag.createBuilder().putString("id", id).remove("Id").build(); if (fixer != null) { + //FAWE start entityTag = (CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.ENTITY, entityTag.asBinaryTag(), dataVersion)); + //FAWE end } EntityType entityType = EntityTypes.get(id); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index c56b50b9d..e6b9f1085 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -39,8 +39,10 @@ import javax.annotation.Nullable; */ public class BlockBagExtent extends AbstractDelegateExtent { + //FAWE start private final boolean mine; private int[] missingBlocks = new int[BlockTypes.size()]; + //FAWE end private BlockBag blockBag; /** @@ -49,6 +51,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { * @param extent the extent * @param blockBag the block bag */ + //FAWE start public BlockBagExtent(Extent extent, @Nullable BlockBag blockBag) { this(extent, blockBag, false); } @@ -58,6 +61,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { this.blockBag = blockBag; this.mine = mine; } + //FAWe end /** * Get the block bag. @@ -85,6 +89,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { * @return a map of missing blocks */ public Map popMissing() { + //FAWE start - Use an Array HashMap map = new HashMap<>(); for (int i = 0; i < missingBlocks.length; i++) { int count = missingBlocks[i]; @@ -94,6 +99,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { } Arrays.fill(missingBlocks, 0); return map; + //FAWE end } @Override @@ -111,10 +117,13 @@ public class BlockBagExtent extends AbstractDelegateExtent { } catch (UnplaceableBlockException e) { throw FaweCache.BLOCK_BAG; } catch (BlockBagException e) { + //FAWE start - listen for internal ids missingBlocks[block.getBlockType().getInternalId()]++; throw FaweCache.BLOCK_BAG; + //FAWE end } } + //FAWE start if (mine) { if (!existing.getBlockType().getMaterial().isAir()) { try { @@ -123,6 +132,7 @@ public class BlockBagExtent extends AbstractDelegateExtent { } } } + //FAWE end } return super.setBlock(x, y, z, block); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java index 5a1b8a33b..70c0c5f29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.world.block.BlockType; */ public class OutOfSpaceException extends BlockBagException { - private BlockType type; + private final BlockType type; /** * Construct the object. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 79dee1503..17c1b8dc6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -132,15 +132,19 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde BlockCategories.DOORS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); BlockCategories.BANNERS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); BlockCategories.SIGNS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL)); - priorityMap.put(BlockTypes.SIGN, PlacementPriority.FINAL); - priorityMap.put(BlockTypes.WALL_SIGN, PlacementPriority.FINAL); + @SuppressWarnings("deprecation") + BlockType sign = BlockTypes.SIGN; + priorityMap.put(sign, PlacementPriority.FINAL); + @SuppressWarnings("deprecation") + BlockType wallSign = BlockTypes.WALL_SIGN; + priorityMap.put(wallSign, PlacementPriority.FINAL); priorityMap.put(BlockTypes.CACTUS, PlacementPriority.FINAL); priorityMap.put(BlockTypes.SUGAR_CANE, PlacementPriority.FINAL); priorityMap.put(BlockTypes.PISTON_HEAD, PlacementPriority.FINAL); priorityMap.put(BlockTypes.MOVING_PISTON, PlacementPriority.FINAL); } - private Map> stages = new HashMap<>(); + private final Map> stages = new HashMap<>(); private boolean enabled; @@ -233,6 +237,8 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde case LAST: stages.get(PlacementPriority.CLEAR_LAST).put(location, replacement); break; + default: + break; } if (block.getBlockType().getMaterial().isAir()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java index 6b50876fc..2c5c24612 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.extent.transform; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.extent.ResettableExtent; +import com.fastasyncworldedit.core.extent.ResettableExtent; import com.google.common.collect.ImmutableMap; import com.sk89q.jnbt.ByteTag; import com.sk89q.jnbt.CompoundTag; @@ -36,8 +36,8 @@ import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.DirectionalProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; -import com.sk89q.worldedit.registry.state.PropertyKeySet; +import com.fastasyncworldedit.core.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKeySet; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -83,6 +83,7 @@ import static com.sk89q.worldedit.util.Direction.values; */ public class BlockTransformExtent extends ResettableExtent { + //FAWE start private static final Logger LOGGER = LogManagerCompat.getLogger(); private static final Set directional = PropertyKeySet.of( @@ -115,6 +116,7 @@ public class BlockTransformExtent extends ResettableExtent { public BlockTransformExtent(Extent parent) { this(parent, new AffineTransform()); } + //FAWE end /** * Create a new instance. @@ -125,11 +127,14 @@ public class BlockTransformExtent extends ResettableExtent { super(extent); checkNotNull(transform); this.transform = transform; + //FAWE start - cache this this.transformInverse = this.transform.inverse(); cache(); + //FAWE end } + //FAWE start private static long combine(Direction... directions) { long mask = 0; for (Direction dir : directions) { @@ -444,6 +449,7 @@ public class BlockTransformExtent extends ResettableExtent { } } } + //FAWE end /** * Get the transform. @@ -497,8 +503,10 @@ public class BlockTransformExtent extends ResettableExtent { public void setTransform(Transform affine) { this.transform = affine; + //FAWE start - cache this this.transformInverse = this.transform.inverse(); cache(); + //FAWE end } /** @@ -511,6 +519,7 @@ public class BlockTransformExtent extends ResettableExtent { * @return the same block */ public static > B transform(@NotNull B block, @NotNull Transform transform) { + //FAWE start - use own logic // performance critical BlockState state = block.toImmutableState(); @@ -520,8 +529,10 @@ public class BlockTransformExtent extends ResettableExtent { return (B) transformBaseBlockNBT(transformed, block.getNbtData(), transform); } return (B) (block instanceof BaseBlock ? transformed.toBaseBlock() : transformed); + //FAWE end } + //FAWE start - use own logic private BlockState transform(BlockState state, int[][] transformArray, Transform transform) { int typeId = state.getInternalBlockTypeId(); int[] arr = transformArray[typeId]; @@ -570,4 +581,5 @@ public class BlockTransformExtent extends ResettableExtent { private BlockState transformInverse(BlockState block) { return transform(block, BLOCK_TRANSFORM_INVERSE, transformInverse); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java index e50455ea7..74617a66c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java @@ -52,7 +52,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent { public > boolean setBlock(BlockVector3 location, B block) throws WorldEditException { final int y = location.getBlockY(); final BlockType type = block.getBlockType(); - if (y < 0 || y > world.getMaxY()) { + if (y < world.getMinY() || y > world.getMaxY()) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BiomeQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BiomeQuirkExtent.java index b18ab0bb5..1abdccfa7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BiomeQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BiomeQuirkExtent.java @@ -3,18 +3,18 @@ * Copyright (C) sk89q * Copyright (C) WorldEdit team and contributors * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or + * 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 Lesser General Public License - * for more details. + * 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 Lesser General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ package com.sk89q.worldedit.extent.world; @@ -45,6 +45,6 @@ public class BiomeQuirkExtent extends AbstractDelegateExtent { // Also place at Y = 0 for proper handling success = super.setBiome(position.withY(0), biome); } - return success || super.setBiome(position, biome); + return super.setBiome(position, biome) || success; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java index 8624f19af..d4a2e1b5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java @@ -33,7 +33,10 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Handles various quirks when setting blocks, such as ice turning * into water or containers dropping their contents. + * + * @deprecated Handled by the world entirely now */ +@Deprecated public class BlockQuirkExtent extends AbstractDelegateExtent { private final World world; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java index 83413bf40..78a29bc61 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java @@ -35,7 +35,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class ChunkLoadingExtent extends AbstractDelegateExtent { private final World world; - private boolean enabled; + private final boolean enabled; /** * Create a new instance. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index 21c287cd7..91ab5bee5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -96,7 +96,9 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { } else { // Can't be an inlined check due to inconsistent generic return type if (stripNbt) { + //FAWE start - Use CompoundBinaryTag return super.setBlock(location, block.toBaseBlock((CompoundBinaryTag) null)); + //FAWE end } else { return super.setBlock(location, block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java index 40a8796aa..1b6f69a6a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java @@ -33,7 +33,9 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class CombinedRegionFunction implements RegionFunction { + //FAWE start - don't use a List here private RegionFunction[] functions; + //FAWE end /** * Create a combined region function. @@ -60,6 +62,7 @@ public class CombinedRegionFunction implements RegionFunction { this.functions = function; } + //FAWE start public static CombinedRegionFunction combine(RegionFunction function, RegionFunction add) { CombinedRegionFunction combined; if (function instanceof CombinedRegionFunction) { @@ -73,6 +76,7 @@ public class CombinedRegionFunction implements RegionFunction { } return combined; } + //FAWE end /** * Add the given functions to the list of functions to call. @@ -81,9 +85,11 @@ public class CombinedRegionFunction implements RegionFunction { */ public void add(Collection functions) { checkNotNull(functions); + //FAWE start - use our logic ArrayList functionsList = new ArrayList<>(Arrays.asList(this.functions)); functionsList.addAll(functions); this.functions = functionsList.toArray(new RegionFunction[0]); + //FAWE end } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java index c1e2299d6..d98bf233b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class FlatRegionMaskingFilter implements FlatRegionFunction { private final FlatRegionFunction function; - private Mask2D mask; + private final Mask2D mask; /** * Create a new masking filter. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java index 18ee659a8..62833b96f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java @@ -19,15 +19,17 @@ package com.sk89q.worldedit.function; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.math.BlockVector3; /** * Performs a function on points in a region. */ +//FAWE start - extends Filter public interface RegionFunction extends Filter { +//FAWE end /** * Apply the function to the given position. @@ -39,8 +41,10 @@ public interface RegionFunction extends Filter { boolean apply(BlockVector3 position) throws WorldEditException; + //FAWE start @Override default void applyBlock(FilterBlock block) { apply(block); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java index 8246115f6..b4046ee9d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java @@ -34,8 +34,10 @@ import static com.google.common.base.Preconditions.checkNotNull; public class RegionMaskingFilter implements RegionFunction { private final RegionFunction function; - private final Extent extent; private final Mask mask; + //FAWE start + private final Extent extent; + //FAWE end /** * Create a new masking filter. @@ -43,11 +45,14 @@ public class RegionMaskingFilter implements RegionFunction { * @param mask the mask * @param function the function */ + //FAWE start - Extent public RegionMaskingFilter(Extent extent, Mask mask, RegionFunction function) { checkNotNull(function); checkNotNull(mask); + //FAWE start checkNotNull(extent); this.extent = extent; + //FAWE end this.mask = mask; this.function = function; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java index 9f474c934..fd080fd51 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java @@ -34,11 +34,11 @@ import java.util.Map; public class BlockDistributionCounter implements RegionFunction { - private Extent extent; - private boolean separateStates; + private final Extent extent; + private final boolean separateStates; - private List> distribution = new ArrayList<>(); - private Map> map = new HashMap<>(); + private final List> distribution = new ArrayList<>(); + private final Map> map = new HashMap<>(); public BlockDistributionCounter(Extent extent, boolean separateStates) { this.extent = extent; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java index a08d6fa2c..55432053e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java @@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class BlockReplace implements RegionFunction { private final Extent extent; - private Pattern pattern; + private final Pattern pattern; /** * Create a new instance. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java index cfa244544..1b3efa404 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java @@ -88,6 +88,7 @@ public class ExtentBlockCopy implements RegionFunction { * @return a new state or the existing one */ private BaseBlock transformNbtData(BaseBlock state) { + //FAWE start - Replace CompoundTag with CompoundBinaryTag CompoundBinaryTag tag = state.getNbt(); if (tag != null) { @@ -105,6 +106,7 @@ public class ExtentBlockCopy implements RegionFunction { if (newDirection != null) { return state.toBaseBlock( tag.putByte("Rot", (byte) MCDirections.toRotation(newDirection)) + //FAWE end ); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java index 1c2d73884..dbab12632 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java @@ -81,6 +81,7 @@ public class Naturalizer implements LayerFunction { private boolean naturalize(BlockVector3 position, int depth) throws WorldEditException { return editSession.setBlock(position, getTargetBlock(depth)); + //FAWE start /* BlockState block = editSession.getBlock(position); BlockState targetBlock = getTargetBlock(depth); @@ -91,6 +92,7 @@ public class Naturalizer implements LayerFunction { return editSession.setBlock(position, targetBlock); */ + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java index 5fa40ca69..37ac7d2d8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java @@ -34,11 +34,13 @@ import java.util.Map; public class SnowSimulator implements LayerFunction { + //FAWE start public static final BooleanProperty snowy = (BooleanProperty) (Property) BlockTypes.GRASS_BLOCK.getProperty("snowy"); private static final EnumProperty slab = (EnumProperty) (Property) BlockTypes.SANDSTONE_SLAB.getProperty("type"); private static final EnumProperty stair = (EnumProperty) (Property) BlockTypes.SANDSTONE_STAIRS.getProperty("half"); private static final EnumProperty trapdoor = (EnumProperty) (Property) BlockTypes.ACACIA_TRAPDOOR.getProperty("half"); private static final BooleanProperty trapdoorOpen = (BooleanProperty) (Property) BlockTypes.ACACIA_TRAPDOOR.getProperty("open"); + //FAWE end private final BlockState ice = BlockTypes.ICE.getDefaultState(); private final BlockState snow = BlockTypes.SNOW.getDefaultState(); @@ -112,7 +114,8 @@ public class SnowSimulator implements LayerFunction { // Can only replace air (or snow in stack mode) if (!above.getBlockType().getMaterial().isAir() && (!stack || above.getBlockType() != BlockTypes.SNOW)) { return false; - } else if (!block.getBlockType().getId().toLowerCase(Locale.ROOT).contains("ice") && this.extent.getEmmittedLight(abovePosition) > 10) { + //FAWE start + } else if (!block.getBlockType().getId().toLowerCase(Locale.ROOT).contains("ice") && this.extent.getEmittedLight(abovePosition) > 10) { return false; } else if (!block.getBlockType().getMaterial().isFullCube()) { Map, Object> states = block.getStates(); @@ -126,6 +129,7 @@ public class SnowSimulator implements LayerFunction { } else { return false; } + //FAWE end } else if (!block.getBlockType().getId().toLowerCase(Locale.ROOT).contains("ice") && block.getBlockType().getMaterial().isTranslucent()) { return false; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java index 544e87ac2..b9bdc9445 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java @@ -56,6 +56,7 @@ public class ExtentEntityCopy implements EntityFunction { private final Transform transform; private boolean removing; + //FAWE start /** * Create a new instance. * @@ -63,6 +64,7 @@ public class ExtentEntityCopy implements EntityFunction { * @param destination the destination {@code Extent} * @param to the destination position * @param transform the transformation to apply to both position and orientation + * @deprecated FAWE Deprecation - Use method with Extent */ @Deprecated public ExtentEntityCopy(Vector3 from, Extent destination, Vector3 to, Transform transform) { @@ -76,6 +78,7 @@ public class ExtentEntityCopy implements EntityFunction { this.to = to; this.transform = transform; } + //FAWE end /** * Create a new instance. @@ -120,7 +123,9 @@ public class ExtentEntityCopy implements EntityFunction { @Override public boolean apply(Entity entity) throws WorldEditException { BaseEntity state = entity.getState(); + //FAWE start - Don't copy players if (state != null && state.getType() != EntityTypes.PLAYER) { + //FAWE end Location newLocation; Location location = entity.getLocation(); // If the entity has stored the location in the NBT data, we use that location @@ -149,6 +154,7 @@ public class ExtentEntityCopy implements EntityFunction { // Remove if (isRemoving() && success) { + //FAWE start UUID uuid = null; if (tag.containsKey("UUID")) { int[] arr = tag.getIntArray("UUID"); @@ -162,6 +168,7 @@ public class ExtentEntityCopy implements EntityFunction { if (source != null) { source.removeEntity(entity.getLocation().getBlockX(), entity.getLocation().getBlockY(), entity.getLocation().getBlockZ(), uuid); } else { + //FAWE end entity.remove(); } } @@ -204,7 +211,9 @@ public class ExtentEntityCopy implements EntityFunction { // Handle hanging entities (paintings, item frames, etc.) boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasFacing = tag.containsKey("Facing"); + //FAWE Start boolean hasRotation = tag.containsKey("Rotation"); + //FAWE end if (hasTilePosition) { Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); @@ -229,6 +238,7 @@ public class ExtentEntityCopy implements EntityFunction { } } + //FAWE start if (hasRotation) { ListTag orgrot = state.getNbtData().getListTag("Rotation"); Vector3 orgDirection = new Location(source, 0, 0, 0, orgrot.getFloat(0), orgrot.getFloat(1)).getDirection(); @@ -246,6 +256,7 @@ public class ExtentEntityCopy implements EntityFunction { builder.put("Rotation", new ListTag(FloatTag.class, Arrays.asList(new FloatTag((float) newDirection.toYaw()), new FloatTag((float) newDirection.toPitch())))); return new BaseEntity(state.getType(), builder.build()); + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java index 2ac903741..baee7794a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Apply.java @@ -30,6 +30,13 @@ import com.sk89q.worldedit.regions.Region; import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull; +/** + * Creates an operation from a region context. + * + * @deprecated Use {@link ApplyRegion} or {@link ApplyLayer} + * depending on function type. + */ +@Deprecated public class Apply implements Contextual { private final Region region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java index f9d6181c8..95367bc26 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java @@ -45,7 +45,9 @@ public class Deform implements Contextual { private Extent destination; private Region region; + //FAWE Start - String private String expression; + //FAWE end private Mode mode; private Vector3 offset = Vector3.ZERO; @@ -119,7 +121,9 @@ public class Deform implements Contextual { @Override public String toString() { + //FAWE start - We string-ify elsewhere return "deformation of " + expression; + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 97e7ae5f8..d199fcb61 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -37,7 +37,7 @@ import com.sk89q.worldedit.world.block.BlockTypes; public class FloraGenerator implements RegionFunction { private final EditSession editSession; - private boolean biomeAware = false; + private final boolean biomeAware = false; private final Pattern desertPattern = getDesertPattern(); private final Pattern temperatePattern = getTemperatePattern(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 35de53d18..a9c07030f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -38,7 +38,7 @@ public class GardenPatchGenerator implements RegionFunction { private final Random random = new Random(); private final EditSession editSession; private Pattern plant = getPumpkinPattern(); - private Pattern leafPattern = BlockTypes.OAK_LEAVES.getDefaultState().with(BlockTypes.OAK_LEAVES.getProperty("persistent"), true); + private final Pattern leafPattern = BlockTypes.OAK_LEAVES.getDefaultState().with(BlockTypes.OAK_LEAVES.getProperty("persistent"), true); private int affected; /** @@ -157,6 +157,8 @@ public class GardenPatchGenerator implements RegionFunction { setBlockIfAir(editSession, p = pos.add(-1, 0, -1), plant.applyBlock(p)); affected++; break; + default: + break; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractMask.java index d22257c16..adb9f38bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/AbstractMask.java @@ -22,4 +22,5 @@ package com.sk89q.worldedit.function.mask; /** * A base class of {@link Mask} that all masks should inherit from. */ -public abstract class AbstractMask implements Mask {} +public abstract class AbstractMask implements Mask { +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask.java index 202efefec..762dd104d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask.java @@ -34,7 +34,9 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Tests true if the biome at applied points is the same as the one given. */ +//FAWE start - AbstractExtentMask public class BiomeMask extends AbstractExtentMask { +//FAWE end private final Set biomes = new HashSet<>(); @@ -45,7 +47,9 @@ public class BiomeMask extends AbstractExtentMask { * @param biomes a list of biomes to match */ public BiomeMask(Extent extent, Collection biomes) { + //FAWE start super(extent); + //FAWE end checkNotNull(biomes); this.biomes.addAll(biomes); } @@ -100,10 +104,12 @@ public class BiomeMask extends AbstractExtentMask { return null; } + //FAWE start @Override public Mask copy() { return new BiomeMask(getExtent(), new HashSet<>(biomes)); } + //FAWE end @Override public boolean test(Extent extent, BlockVector3 position) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java index a38a77e04..bad9781ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java @@ -39,7 +39,9 @@ public class BlockCategoryMask extends AbstractExtentMask { super(extent); checkNotNull(category); this.category = category; + //FAWE start this.category.getAll(); // load category so BlockCategory#contains actually works + //FAWE end } @Override @@ -47,10 +49,12 @@ public class BlockCategoryMask extends AbstractExtentMask { return category.contains(getExtent().getBlock(vector)); } + //FAWE start @Override public boolean test(Extent extent, BlockVector3 vector) { return category.contains(extent.getBlock(vector)); } + //FAWE end @Nullable @Override @@ -58,6 +62,7 @@ public class BlockCategoryMask extends AbstractExtentMask { return null; } + //FAWE start @Override public Mask copy() { return new BlockCategoryMask(getExtent(), category); @@ -67,4 +72,5 @@ public class BlockCategoryMask extends AbstractExtentMask { public boolean replacesAir() { return category.contains(BlockTypes.AIR); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index 26e6e8da0..2b54b7d85 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -19,6 +19,9 @@ package com.sk89q.worldedit.function.mask; +import com.fastasyncworldedit.core.function.mask.ABlockMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockStateMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.math.BlockVector3; @@ -27,7 +30,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypesCache; -import com.sk89q.worldedit.world.block.BlanketBaseBlock; +import com.fastasyncworldedit.core.world.block.BlanketBaseBlock; import javax.annotation.Nullable; import java.util.Arrays; @@ -45,8 +48,11 @@ import static com.google.common.base.Preconditions.checkNotNull; *

This mask checks for both an exact block type and state value match, * respecting fuzzy status of the BlockState.

*/ +//FAWE start - ABlockMask > AbstractExtentMask public class BlockMask extends ABlockMask { +//FAWE end + //FAWE start private final boolean[] ordinals; public BlockMask() { @@ -61,6 +67,7 @@ public class BlockMask extends ABlockMask { super(extent == null ? new NullExtent() : extent); this.ordinals = ordinals; } + //FAWE end /** * Create a new block mask. @@ -86,6 +93,7 @@ public class BlockMask extends ABlockMask { this(extent, Arrays.asList(checkNotNull(block))); } + //FAWE start public BlockMask add(Predicate predicate) { for (int i = 0; i < ordinals.length; i++) { if (!ordinals[i]) { @@ -144,6 +152,7 @@ public class BlockMask extends ABlockMask { } return this; } + //FAWE end /** * Add the given blocks to the list of criteria. @@ -154,6 +163,7 @@ public class BlockMask extends ABlockMask { @Deprecated public void add(Collection blocks) { checkNotNull(blocks); + //FAWE start - get ordinals for (BaseBlock block : blocks) { if (block instanceof BlanketBaseBlock) { for (BlockState state : block.getBlockType().getAllStates()) { @@ -163,6 +173,7 @@ public class BlockMask extends ABlockMask { add(block.toBlockState()); } } + //FAWE end } /** @@ -180,9 +191,12 @@ public class BlockMask extends ABlockMask { * @return a list of blocks */ public Collection getBlocks() { + //FAWE start return Collections.emptyList(); //TODO Not supported in FAWE yet + //FAWE end } + //FAWE start @Override public boolean test(BlockState state) { return ordinals[state.getOrdinal()] || replacesAir() && state.getOrdinal() == 0; @@ -332,4 +346,5 @@ public class BlockMask extends ABlockMask { public Mask copy() { return new BlockMask(getExtent(), ordinals.clone()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java index dd0b774fc..52950e022 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockStateMask.java @@ -53,6 +53,7 @@ public class BlockStateMask extends AbstractExtentMask { this.strict = strict; } + //FAWE start @Override public boolean test(BlockVector3 vector) { return test(getExtent().getBlock(vector)); @@ -90,4 +91,5 @@ public class BlockStateMask extends AbstractExtentMask { states.forEach(statesClone::put); return new BlockStateMask(getExtent(), statesClone, strict); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java index f11e54efa..17b6e29c6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java @@ -38,9 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull; * *

This mask checks for ONLY the block type. If state should also be checked, * use {@link BlockMask}.

- * @deprecated use BlockMaskBuilder */ -@Deprecated public class BlockTypeMask extends AbstractExtentMask { private final boolean[] types; @@ -70,11 +68,13 @@ public class BlockTypeMask extends AbstractExtentMask { } } + //FAWE start private BlockTypeMask(Extent extent, boolean[] types, boolean hasAir) { super(extent); this.types = types; this.hasAir = hasAir; } + //FAWE end /** * Add the given blocks to the list of criteria. @@ -83,9 +83,11 @@ public class BlockTypeMask extends AbstractExtentMask { */ public void add(@NotNull Collection blocks) { checkNotNull(blocks); + //FAWE start for (BlockType type : blocks) { add(type); } + //FAWE end } /** @@ -94,12 +96,14 @@ public class BlockTypeMask extends AbstractExtentMask { * @param block an array of blocks */ public void add(@NotNull BlockType... block) { + //FAWE start - get internal id for (BlockType type : block) { if (!hasAir && (type == BlockTypes.AIR || type == BlockTypes.CAVE_AIR || type == BlockTypes.VOID_AIR)) { hasAir = true; } this.types[type.getInternalId()] = true; } + //FAWE end } /** @@ -117,6 +121,7 @@ public class BlockTypeMask extends AbstractExtentMask { return blocks; } + //FAWE start @Override public boolean test(BlockVector3 vector) { return test(getExtent().getBlock(vector).getBlockType()); @@ -135,6 +140,7 @@ public class BlockTypeMask extends AbstractExtentMask { public boolean test(BlockType block) { return types[block.getInternalId()]; } + //FAWE end @Nullable @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java index ccbf44fc7..301f2104c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java @@ -57,10 +57,12 @@ public class BoundedHeightMask extends AbstractMask { return null; } + //FAWE start @Override public Mask copy() { // The mask is not mutable. There is no need to clone it. return this; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java index b37527e53..b75a4cd1e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java @@ -55,10 +55,12 @@ public class ExistingBlockMask extends AbstractExtentMask { return null; } + //FAWE start @Override public Mask copy() { // The mask is not mutable. There is no need to clone it. return this; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java index 0df7ca6c9..5f46676ee 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java @@ -89,9 +89,11 @@ public class ExpressionMask extends AbstractMask { return new ExpressionMask2D(expression, timeout); } + //FAWE start @Override public Mask copy() { return new ExpressionMask(expression.clone(), timeout); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java index 98a5aa2d3..bc31f84f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java @@ -72,9 +72,11 @@ public class ExpressionMask2D extends AbstractMask2D { } } + //FAWE start @Override public Mask2D copy2D() { return new ExpressionMask2D(expression.clone(), timeout); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockStateMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockStateMask.java index e94f1dd11..249d94d31 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockStateMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockStateMask.java @@ -1,5 +1,7 @@ package com.sk89q.worldedit.function.mask; +import com.fastasyncworldedit.core.function.mask.ABlockMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockStateMask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockTypeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockTypeMask.java index a8dcd3c18..9a3ab9a88 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockTypeMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/InverseSingleBlockTypeMask.java @@ -1,5 +1,7 @@ package com.sk89q.worldedit.function.mask; +import com.fastasyncworldedit.core.function.mask.ABlockMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java index ebbcefbca..42a2a8b75 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java @@ -19,9 +19,10 @@ package com.sk89q.worldedit.function.mask; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.MaskFilter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.MaskFilter; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; +import com.fastasyncworldedit.core.function.mask.InverseMask; import com.sk89q.worldedit.math.BlockVector3; import org.jetbrains.annotations.Nullable; @@ -40,10 +41,6 @@ public interface Mask { */ boolean test(BlockVector3 vector); - default MaskFilter toFilter(T filter) { - return new MaskFilter<>(filter, this); - } - /** * Get the 2D version of this mask if one exists. * @@ -54,6 +51,7 @@ public interface Mask { return null; } + //FAWE start /** * Returns null if no optimization took place * otherwise a new/same mask @@ -64,6 +62,10 @@ public interface Mask { return null; } + default MaskFilter toFilter(T filter) { + return new MaskFilter<>(filter, this); + } + default Mask tryCombine(Mask other) { return null; } @@ -106,4 +108,5 @@ public interface Mask { * @return a clone of the mask */ Mask copy(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java index 4a493557d..0915546c0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java @@ -34,6 +34,8 @@ public interface Mask2D { */ boolean test(BlockVector2 vector); + //FAWE start Mask2D copy2D(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java index 1c78d7e30..9c4a8625a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java @@ -50,8 +50,10 @@ public class MaskIntersection extends AbstractMask { private static final Logger LOGGER = LogManagerCompat.getLogger(); protected final Set masks; + //FAWE start protected Mask[] masksArray; protected boolean defaultReturn; + //FAWE end /** * Create a new intersection. @@ -61,9 +63,12 @@ public class MaskIntersection extends AbstractMask { public MaskIntersection(Collection masks) { checkNotNull(masks); this.masks = new LinkedHashSet<>(masks); + //FAWE start formArray(); + //FAWE end } + //FAWE start public static Mask of(Mask... masks) { Set set = new LinkedHashSet<>(); for (Mask mask : masks) { @@ -87,6 +92,7 @@ public class MaskIntersection extends AbstractMask { return new MaskIntersection(set).optimize(); } } + //FAWE end /** * Create a new intersection. @@ -97,6 +103,7 @@ public class MaskIntersection extends AbstractMask { this(Arrays.asList(checkNotNull(mask))); } + //FAWE start private void formArray() { if (masks.isEmpty()) { masksArray = new Mask[]{Masks.alwaysFalse()}; @@ -212,6 +219,7 @@ public class MaskIntersection extends AbstractMask { } return hasOptimized; } + //FAWE end /** * Add some masks to the list. @@ -221,7 +229,9 @@ public class MaskIntersection extends AbstractMask { public void add(Collection masks) { checkNotNull(masks); this.masks.addAll(masks); + //FAWE start formArray(); + //FAWE end } /** @@ -242,6 +252,7 @@ public class MaskIntersection extends AbstractMask { return masks; } + //FAWE start public final Mask[] getMasksArray() { return masksArray; } @@ -256,6 +267,7 @@ public class MaskIntersection extends AbstractMask { return defaultReturn; } + //FAWE end @Nullable @Override @@ -272,6 +284,7 @@ public class MaskIntersection extends AbstractMask { return new MaskIntersection2D(mask2dList); } + //FAWE start @Override public Mask copy(){ Set masks = this.masks.stream().map(Mask::copy).collect(Collectors.toSet()); @@ -287,5 +300,6 @@ public class MaskIntersection extends AbstractMask { } return false; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java index 64dc3e26f..46d7c6d06 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java @@ -98,10 +98,12 @@ public class MaskIntersection2D implements Mask2D { return true; } + //FAWE start @Override public Mask2D copy2D() { Set masksCopy = this.masks.stream().map(Mask2D::copy2D).collect(Collectors.toSet()); return new MaskIntersection2D(masksCopy); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index 9a0923983..7c135acdf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -37,10 +37,6 @@ public final class Masks { private Masks() { } - public static boolean isNull(Mask mask) { - return mask == null || mask == ALWAYS_TRUE; - } - /** * Return a 3D mask that always returns true. * @@ -50,9 +46,11 @@ public final class Masks { return ALWAYS_TRUE; } + //FAWE start public static Mask alwaysFalse() { return ALWAYS_FALSE; } + //FAWE end /** * Return a 2D mask that always returns true. @@ -126,7 +124,9 @@ public final class Masks { }; } + //FAWE start - protected > private protected static class AlwaysTrue implements Mask, Mask2D { + //FAWE end @Override public boolean test(BlockVector3 vector) { return true; @@ -143,6 +143,7 @@ public final class Masks { return this; } + //FAWE start @Override public Mask tryCombine(Mask other) { return other; @@ -164,10 +165,13 @@ public final class Masks { public Mask2D copy2D() { return new AlwaysTrue(); } + //FAWE end } + //FAWE start - protected > private protected static class AlwaysFalse implements Mask, Mask2D { + //FAWE end @Override public boolean test(BlockVector3 vector) { return false; @@ -184,6 +188,7 @@ public final class Masks { return this; } + //FAWE start @Override public Mask tryCombine(Mask other) { return this; @@ -205,6 +210,7 @@ public final class Masks { public Mask2D copy2D() { return new AlwaysFalse(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java index 39c29107d..88efb649a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.noise.NoiseGenerator; import javax.annotation.Nullable; @@ -96,9 +96,11 @@ public class NoiseFilter extends AbstractMask { return new NoiseFilter2D(getNoiseGenerator(), getDensity()); } + //FAWE start @Override public Mask copy() { return new NoiseFilter(noiseGenerator, density); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java index f192e1eb0..1d792e540 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java @@ -87,9 +87,11 @@ public class NoiseFilter2D extends AbstractMask2D { return noiseGenerator.noise(pos.toVector2()) <= density; } + //FAWE start @Override public Mask2D copy2D() { return new NoiseFilter2D(noiseGenerator, density); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java index 99865fc2f..2bc9b13a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java @@ -105,9 +105,11 @@ public class OffsetMask extends AbstractMask { } } + //FAWE start @Override public Mask copy() { return new OffsetMask(mask.copy(), offset.toImmutable()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java index e3d5786cd..afafc66c4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.function.mask; import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector2; +import com.fastasyncworldedit.core.math.MutableBlockVector2; import static com.google.common.base.Preconditions.checkNotNull; @@ -32,7 +32,7 @@ public class OffsetMask2D extends AbstractMask2D { private Mask2D mask; private BlockVector2 offset; - private MutableBlockVector2 mutable; + private final MutableBlockVector2 mutableBlockVector2; /** * Create a new instance. @@ -45,7 +45,7 @@ public class OffsetMask2D extends AbstractMask2D { checkNotNull(offset); this.mask = mask; this.offset = offset; - this.mutable = new MutableBlockVector2(); + this.mutableBlockVector2 = new MutableBlockVector2(); } /** @@ -86,15 +86,17 @@ public class OffsetMask2D extends AbstractMask2D { this.offset = offset; } + //FAWE start @Override public boolean test(BlockVector2 vector) { - mutable.setComponents(vector.getX() + offset.getX(), vector.getZ() + offset.getZ()); - return getMask().test(mutable); + mutableBlockVector2.setComponents(vector.getX() + offset.getX(), vector.getZ() + offset.getZ()); + return getMask().test(mutableBlockVector2); } @Override public Mask2D copy2D() { return new OffsetMask2D(mask.copy2D(), BlockVector2.at(offset.getX(), offset.getZ())); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java index ab7641a1d..05a6d1c59 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java @@ -72,6 +72,7 @@ public class RegionMask extends AbstractMask { return null; } + //FAWE start @Override public Mask copy() { return new RegionMask(region.clone()); @@ -84,5 +85,6 @@ public class RegionMask extends AbstractMask { } return this; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java index 441d95e18..d327ff97a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java @@ -35,9 +35,11 @@ public class SolidBlockMask extends BlockMask { return null; } + //FAWE start @Override public Mask copy() { return new SolidBlockMask(getExtent()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java index 7d6ba5697..ba3e7a809 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BackwardsExtentBlockCopy.java @@ -2,10 +2,12 @@ package com.sk89q.worldedit.function.operation; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; +import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.CuboidRegion; @@ -20,8 +22,8 @@ public class BackwardsExtentBlockCopy extends RegionVisitor implements Operation private final BlockVector3 origin; private int affected = 0; - private MutableBlockVector3 mutBV3 = new MutableBlockVector3(); - private MutableVector3 mutV3 = new MutableVector3(); + private final MutableBlockVector3 mutBV3 = new MutableBlockVector3(); + private final MutableVector3 mutV3 = new MutableVector3(); BackwardsExtentBlockCopy(Region region, BlockVector3 origin, Transform transform, RegionFunction function) { super(region, function); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java index 2436fcfbd..5011bf230 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ChangeSetExecutor.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.function.operation; -import com.fastasyncworldedit.core.object.changeset.AbstractChangeSet; +import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.history.UndoContext; @@ -35,6 +35,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class ChangeSetExecutor implements Operation { + //FAWE start - Override public enum Type { UNDO { @Override @@ -52,6 +53,7 @@ public class ChangeSetExecutor implements Operation { public void perform(Change change, UndoContext context) { } } + //FAWE end private final Iterator iterator; private final Type type; @@ -64,6 +66,7 @@ public class ChangeSetExecutor implements Operation { * @param type type of change * @param context the undo context */ + //FAWE start - BlockBag & inventory private ChangeSetExecutor(ChangeSet changeSet, Type type, UndoContext context, BlockBag blockBag, int inventory) { checkNotNull(changeSet); checkNotNull(type); @@ -79,12 +82,15 @@ public class ChangeSetExecutor implements Operation { iterator = changeSet.forwardIterator(); } } + //FAWE end @Override public Operation resume(RunContext run) throws WorldEditException { while (iterator.hasNext()) { Change change = iterator.next(); + //FAWE start - types > individual history step type.perform(change, context); + //FAWE end } return null; } @@ -93,9 +99,11 @@ public class ChangeSetExecutor implements Operation { public void cancel() { } + //FAWE start public static ChangeSetExecutor create(ChangeSet changeSet, UndoContext context, Type type, BlockBag blockBag, int inventory) { return new ChangeSetExecutor(changeSet, type, context, blockBag, inventory); } + //FAWE end /** * Create a new undo operation. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java index 160dcd60c..2446c9d6d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/DelegateOperation.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.util.formatting.text.Component; import static com.google.common.base.Preconditions.checkNotNull; /** - * Executes a delegete operation, but returns to another operation upon + * Executes a delegate operation, but returns to another operation upon * completing the delegate. */ public class DelegateOperation implements Operation { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 83b259e1c..1164a53ed 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -20,11 +20,11 @@ package com.sk89q.worldedit.function.operation; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.extent.BlockTranslateExtent; -import com.fastasyncworldedit.core.object.extent.PositionTransformExtent; -import com.fastasyncworldedit.core.object.function.block.BiomeCopy; -import com.fastasyncworldedit.core.object.function.block.CombinedBlockCopy; -import com.fastasyncworldedit.core.object.function.block.SimpleBlockCopy; +import com.fastasyncworldedit.core.extent.BlockTranslateExtent; +import com.fastasyncworldedit.core.extent.PositionTransformExtent; +import com.fastasyncworldedit.core.function.block.BiomeCopy; +import com.fastasyncworldedit.core.function.block.CombinedBlockCopy; +import com.fastasyncworldedit.core.function.block.SimpleBlockCopy; import com.fastasyncworldedit.core.util.MaskTraverser; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -34,13 +34,13 @@ import com.sk89q.worldedit.entity.metadata.EntityProperties; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.CombinedRegionFunction; import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.function.RegionMaskTestFunction; +import com.fastasyncworldedit.core.function.RegionMaskTestFunction; import com.sk89q.worldedit.function.RegionMaskingFilter; import com.sk89q.worldedit.function.entity.ExtentEntityCopy; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.visitor.EntityVisitor; -import com.sk89q.worldedit.function.visitor.IntersectRegionFunction; +import com.fastasyncworldedit.core.function.visitor.IntersectRegionFunction; import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.transform.AffineTransform; @@ -79,10 +79,12 @@ public class ForwardExtentCopy implements Operation { private RegionFunction sourceFunction = null; private Transform transform = new Identity(); private Transform currentTransform = null; - private int affectedBlocks; + private RegionFunction filterFunction; private RegionVisitor lastBiomeVisitor; private EntityVisitor lastEntityVisitor; + + private int affectedBlocks; private int affectedBiomeCols; private int affectedEntities; @@ -166,9 +168,11 @@ public class ForwardExtentCopy implements Operation { this.sourceMask = sourceMask; } + //FAWE start public void setFilterFunction(RegionFunction filterFunction) { this.filterFunction = filterFunction; } + //FAWE end /** * Get the function that gets applied to all source blocks after @@ -260,9 +264,11 @@ public class ForwardExtentCopy implements Operation { * @param copyingBiomes true if copying */ public void setCopyingBiomes(boolean copyingBiomes) { + //FAWE start - FlatRegion if (copyingBiomes && !(region instanceof FlatRegion)) { throw new UnsupportedOperationException("Can't copy biomes from region that doesn't implement FlatRegion"); } + //FAWE end this.copyingBiomes = copyingBiomes; } @@ -277,9 +283,11 @@ public class ForwardExtentCopy implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { + //FAWE start if (currentTransform == null) { currentTransform = transform; } + //FAWE end if (lastBiomeVisitor != null) { affectedBiomeCols += lastBiomeVisitor.getAffected(); lastBiomeVisitor = null; @@ -289,13 +297,16 @@ public class ForwardExtentCopy implements Operation { lastEntityVisitor = null; } + //FAWE start Extent finalDest = destination; BlockVector3 translation = to.subtract(from); if (!translation.equals(BlockVector3.ZERO)) { finalDest = new BlockTranslateExtent(finalDest, translation.getBlockX(), translation.getBlockY(), translation.getBlockZ()); } + //FAWE end + //FAWE start - RegionVisitor > ExtentBlockCopy RegionFunction copy; RegionVisitor blockCopy = null; PositionTransformExtent transExt = null; @@ -388,7 +399,6 @@ public class ForwardExtentCopy implements Operation { entities = Collections.emptyList(); } - for (int i = 0; i < repetitions; i++) { Operations.completeBlindly(blockCopy); @@ -412,6 +422,7 @@ public class ForwardExtentCopy implements Operation { } affectedBlocks += blockCopy.getAffected(); + //FAWE end return null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operations.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operations.java index 539f5da2d..550d77490 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operations.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/Operations.java @@ -27,8 +27,6 @@ import com.sk89q.worldedit.WorldEditException; */ public final class Operations { - private static final RunContext context = new RunContext(); - private Operations() { } @@ -40,7 +38,7 @@ public final class Operations { */ public static void complete(Operation op) throws WorldEditException { while (op != null) { - op = op.resume(context); + op = op.resume(new RunContext()); } } @@ -54,7 +52,7 @@ public final class Operations { public static void completeLegacy(Operation op) throws MaxChangedBlocksException { while (op != null) { try { - op = op.resume(context); + op = op.resume(new RunContext()); } catch (MaxChangedBlocksException e) { throw e; } catch (WorldEditException e) { @@ -73,7 +71,7 @@ public final class Operations { public static void completeBlindly(Operation op) { while (op != null) { try { - op = op.resume(context); + op = op.resume(new RunContext()); } catch (WorldEditException e) { throw new RuntimeException(e); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java index eb7699ed5..1175a430d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetBlockMap.java @@ -52,8 +52,10 @@ public class SetBlockMap implements Operation { public void cancel() { } + //FAWE start @Override public void addStatusMessages(List messages) { } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java~HEAD b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java~HEAD deleted file mode 100644 index 4f5e6fe07..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/SetLocatedBlocks.java~HEAD +++ /dev/null @@ -1,56 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.function.operation; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.util.LocatedBlock; - -import java.util.List; - -public class SetLocatedBlocks implements Operation { - - private final Extent extent; - private final Iterable blocks; - - public SetLocatedBlocks(Extent extent, Iterable blocks) { - this.extent = checkNotNull(extent); - this.blocks = checkNotNull(blocks); - } - - @Override - public Operation resume(RunContext run) throws WorldEditException { - for (LocatedBlock block : blocks) { - extent.setBlock(block.getLocation(), block.getBlock()); - } - return null; - } - - @Override - public void cancel() { - } - - @Override - public void addStatusMessages(List messages) { - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/package-info.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/package-info.java new file mode 100644 index 000000000..5b9eb7485 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/package-info.java @@ -0,0 +1,6 @@ +/** + * The following classes are FAWE additions: + * + * @see com.sk89q.worldedit.function.operation.BackwardsExtentBlockCopy + */ +package com.sk89q.worldedit.function.operation; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java index cdddc1ce1..e0e88bb07 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java @@ -19,11 +19,10 @@ package com.sk89q.worldedit.function.pattern; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.implementation.filter.block.FilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; @@ -31,7 +30,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; /** * Returns a {@link BaseBlock} for a given position. */ -// FAWE Start +//FAWE start - extends Filter public interface Pattern extends Filter { /** @@ -59,7 +58,7 @@ public interface Pattern extends Filter { apply(block, block, block); } - // FAWE End + //FAWE end /** * Return a {@link BaseBlock} for the given position. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java index e88f87174..e1049d304 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.function.pattern; -import com.fastasyncworldedit.core.object.collection.RandomCollection; -import com.fastasyncworldedit.core.object.random.SimpleRandom; -import com.fastasyncworldedit.core.object.random.TrueRandom; +import com.fastasyncworldedit.core.util.collection.RandomCollection; +import com.fastasyncworldedit.core.math.random.SimpleRandom; +import com.fastasyncworldedit.core.math.random.TrueRandom; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; @@ -39,11 +39,14 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class RandomPattern extends AbstractPattern { + //FAWE start - SimpleRandom > Random, LHS

> List private final SimpleRandom random; private Map weights = new HashMap<>(); private RandomCollection collection; private LinkedHashSet patterns = new LinkedHashSet<>(); + //FAWE end + //FAWE start public RandomPattern() { this(new TrueRandom()); } @@ -64,6 +67,7 @@ public class RandomPattern extends AbstractPattern { this.collection = RandomCollection.of(weights, random); this.patterns = parent.patterns; } + //FAWE end /** * Add a pattern to the weight list of patterns. @@ -76,6 +80,7 @@ public class RandomPattern extends AbstractPattern { */ public void add(Pattern pattern, double chance) { checkNotNull(pattern); + //FAWE start - Double, weights, patterns and collection Double existingWeight = weights.get(pattern); if (existingWeight != null) { chance += existingWeight; @@ -102,7 +107,6 @@ public class RandomPattern extends AbstractPattern { public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { return collection.next(get.getBlockX(), get.getBlockY(), get.getBlockZ()).apply(extent, get, set); } - - + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java index 6d6b94e66..490c47cf2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java @@ -87,9 +87,11 @@ public class RepeatingExtentPattern extends AbstractExtentPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { + //FAWE start - calculate offset int x = Math.floorMod(position.getBlockX() + offset.getBlockX(), size.getBlockX()) + origin.getBlockX(); int y = Math.floorMod(position.getBlockY() + offset.getBlockY(), size.getBlockY()) + origin.getBlockY(); int z = Math.floorMod(position.getBlockZ() + offset.getBlockZ(), size.getBlockZ()) + origin.getBlockZ(); + //FAWE end return getExtent().getFullBlock(x, y, z); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java index 0c0158b2f..39fc0cf77 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/StateApplyingPattern.java @@ -23,7 +23,6 @@ import com.google.common.collect.Maps; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; @@ -36,7 +35,7 @@ import static com.sk89q.worldedit.blocks.Blocks.resolveProperties; public class StateApplyingPattern extends AbstractExtentPattern { private final Map states; - private Map, Object>> cache = Maps.newHashMap(); + private final Map, Object>> cache = Maps.newHashMap(); public StateApplyingPattern(Extent extent, Map statesToSet) { super(extent); @@ -48,9 +47,11 @@ public class StateApplyingPattern extends AbstractExtentPattern { BlockState block = getExtent().getBlock(position); for (Entry, Object> entry : cache .computeIfAbsent(block.getBlockType(), (b -> resolveProperties(states, b))).entrySet()) { + //FAWE start if (block.getBlockType().hasProperty(entry.getKey().getKey())) { block = block.with(entry.getKey(), entry.getValue()); } + //FAWE end } return block.toBaseBlock(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java index 92b2a5994..64ad58e93 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/WaterloggedRemover.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.function.pattern; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; @@ -35,6 +35,7 @@ import java.lang.ref.SoftReference; */ public class WaterloggedRemover extends AbstractExtentPattern { + //FAWE start private static SoftReference cache = new SoftReference<>(null); private synchronized BlockState[] getRemap() { @@ -59,6 +60,7 @@ public class WaterloggedRemover extends AbstractExtentPattern { } private final BlockState[] remap; + //FAWE end public WaterloggedRemover(Extent extent) { super(extent); @@ -68,10 +70,12 @@ public class WaterloggedRemover extends AbstractExtentPattern { @Override public BaseBlock applyBlock(BlockVector3 position) { BaseBlock block = getExtent().getFullBlock(position); + //FAWE start - remap BlockState newState = remap[block.getOrdinal()]; if (newState != null) { return newState.toBaseBlock(block.getNbtData()); } + //FAWE end return BlockTypes.AIR.getDefaultState().toBaseBlock(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index 6484aa182..c670b20ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.function.visitor; import com.fastasyncworldedit.core.configuration.Caption; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; +import com.fastasyncworldedit.core.math.BlockVectorSet; import com.google.common.collect.ImmutableList; import com.google.common.collect.Sets; import com.sk89q.worldedit.WorldEditException; @@ -28,7 +28,7 @@ import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.RunContext; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; @@ -54,6 +54,7 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public abstract class BreadthFirstSearch implements Operation { + //FAWE start public static final BlockVector3[] DEFAULT_DIRECTIONS = new BlockVector3[6]; public static final BlockVector3[] DIAGONAL_DIRECTIONS; @@ -80,12 +81,16 @@ public abstract class BreadthFirstSearch implements Operation { list.sort((o1, o2) -> (int) Math.signum(o1.lengthSq() - o2.lengthSq())); DIAGONAL_DIRECTIONS = list.toArray(new BlockVector3[0]); } + //FAWE end private final RegionFunction function; + //FAWE Start - BVS > Queue, Set, List private BlockVectorSet queue = new BlockVectorSet(); private BlockVectorSet visited = new BlockVectorSet(); private BlockVector3[] directions; + //FAWE end private int affected = 0; + //FAWE start private int currentDepth = 0; private final int maxDepth; private int maxBranch = Integer.MAX_VALUE; @@ -96,10 +101,13 @@ public abstract class BreadthFirstSearch implements Operation { * @param function the function to apply to visited blocks */ public BreadthFirstSearch(RegionFunction function) { + //FAWE start this(function, Integer.MAX_VALUE); + //FAWE end checkNotNull(function); } + //FAWE start public BreadthFirstSearch(RegionFunction function, int maxDepth) { checkNotNull(function); this.function = function; @@ -114,6 +122,7 @@ public abstract class BreadthFirstSearch implements Operation { public void setDirections(Collection directions) { setDirections(directions.toArray(new BlockVector3[0])); } + //FAWE end /** * Get the list of directions will be visited. @@ -135,6 +144,7 @@ public abstract class BreadthFirstSearch implements Operation { * Add the directions along the axes as directions to visit. */ public void addAxes() { + //FAWE start - HS HashSet set = Sets.newHashSet(directions); set.add(BlockVector3.UNIT_MINUS_Y); set.add(BlockVector3.UNIT_Y); @@ -143,18 +153,21 @@ public abstract class BreadthFirstSearch implements Operation { set.add(BlockVector3.UNIT_MINUS_Z); set.add(BlockVector3.UNIT_Z); setDirections(set); + //FAWE end } /** * Add the diagonal directions as directions to visit. */ public void addDiagonal() { + //FAWE start - HS HashSet set = Sets.newHashSet(directions); set.add(Direction.NORTHEAST.toBlockVector()); set.add(Direction.SOUTHEAST.toBlockVector()); set.add(Direction.SOUTHWEST.toBlockVector()); set.add(Direction.NORTHWEST.toBlockVector()); setDirections(set); + //FAWE end } /** @@ -193,6 +206,7 @@ public abstract class BreadthFirstSearch implements Operation { } } + //FAWE start public void setVisited(BlockVectorSet set) { this.visited = set; } @@ -208,6 +222,7 @@ public abstract class BreadthFirstSearch implements Operation { public void setMaxBranch(int maxBranch) { this.maxBranch = maxBranch; } + //FAWE end /** * Return whether the given 'to' block should be visited, starting from the @@ -230,6 +245,7 @@ public abstract class BreadthFirstSearch implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { + //FAWE start - directions & visited MutableBlockVector3 mutable = new MutableBlockVector3(); BlockVector3[] dirs = directions; BlockVectorSet tempQueue = new BlockVectorSet(); @@ -263,19 +279,24 @@ public abstract class BreadthFirstSearch implements Operation { tmp.clear(); tempQueue = tmp; } + //FAWE end return null; } + //FAWE start public int getDepth() { return currentDepth; } + //FAWE end @Override public void cancel() { + //FAWE start queue.clear(); visited.clear(); affected = 0; + //FAWE emd } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java index 6bc7198d6..e7570e963 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java @@ -34,8 +34,9 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class DownwardVisitor extends RecursiveVisitor { - private int baseY; + private final int baseY; + //FAWE start /** * Create a new visitor. * @@ -46,6 +47,7 @@ public class DownwardVisitor extends RecursiveVisitor { public DownwardVisitor(Mask mask, RegionFunction function, int baseY) { this(mask, function, baseY, Integer.MAX_VALUE); } + //FAWE end public DownwardVisitor(Mask mask, RegionFunction function, int baseY, int depth) { super(mask, function, depth); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java index f9c0aacd7..c5acd33bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java @@ -45,8 +45,8 @@ public class LayerVisitor implements Operation { private final FlatRegion flatRegion; private final LayerFunction function; private Mask2D mask = Masks.alwaysTrue2D(); - private int minY; - private int maxY; + private final int minY; + private final int maxY; /** * Create a new visitor. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java index 80f76049f..828865ceb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.math.BlockVector3; */ public class NonRisingVisitor extends RecursiveVisitor { + //FAWE start - max int /** * Create a new recursive visitor. * @@ -37,7 +38,9 @@ public class NonRisingVisitor extends RecursiveVisitor { public NonRisingVisitor(Mask mask, RegionFunction function) { this(mask, function, Integer.MAX_VALUE); } + //FAWE end + //FAWE start - int depth public NonRisingVisitor(Mask mask, RegionFunction function, int depth) { super(mask, function, depth); setDirections( @@ -48,5 +51,6 @@ public class NonRisingVisitor extends RecursiveVisitor { BlockVector3.UNIT_MINUS_Y ); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java index e95440254..51cc3bc60 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java @@ -33,9 +33,11 @@ public class RecursiveVisitor extends BreadthFirstSearch { private final Mask mask; + //FAWE start public RecursiveVisitor(Mask mask, RegionFunction function) { this(mask, function, Integer.MAX_VALUE); } + //FAWE end /** * Create a new recursive visitor. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java index cabb517af..4b819b8bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java @@ -32,7 +32,7 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent; /** * Utility class to apply region functions to {@link com.sk89q.worldedit.regions.Region}. - * @deprecated Let the queue iterate, not the region function which lacks any kind of optimizations / parallelism + * @deprecated - FAWE deprecation: Let the queue iterate, not the region function which lacks any kind of optimizations / parallelism */ @Deprecated public class RegionVisitor implements Operation { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java deleted file mode 100644 index 2c73101fa..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/ScanChunk.java +++ /dev/null @@ -1,344 +0,0 @@ -package com.sk89q.worldedit.function.visitor; - -import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.math.BlockVector3; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.longs.LongArraySet; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; - -/** - * A chunk based search algorithm - */ -public class ScanChunk { - public static final BlockVector3[] DEFAULT_DIRECTIONS = new BlockVector3[6]; - public static final BlockVector3[] DIAGONAL_DIRECTIONS; - private static final int MAX_QUEUE = 34816; - - static { - DEFAULT_DIRECTIONS[0] = BlockVector3.at(0, -1, 0); - DEFAULT_DIRECTIONS[1] = BlockVector3.at(0, 1, 0); - DEFAULT_DIRECTIONS[2] = BlockVector3.at(-1, 0, 0); - DEFAULT_DIRECTIONS[3] = BlockVector3.at(1, 0, 0); - DEFAULT_DIRECTIONS[4] = BlockVector3.at(0, 0, -1); - DEFAULT_DIRECTIONS[5] = BlockVector3.at(0, 0, 1); - List list = new ArrayList<>(); - for (int x = -1; x <= 1; x++) { - for (int y = -1; y <= 1; y++) { - for (int z = -1; z <= 1; z++) { - if (x != 0 || y != 0 || z != 0) { - BlockVector3 pos = BlockVector3.at(x, y, z); - if (!list.contains(pos)) { - list.add(pos); - } - } - } - } - } - list.sort((o1, o2) -> (int) Math.signum(o1.lengthSq() - o2.lengthSq())); - DIAGONAL_DIRECTIONS = list.toArray(new BlockVector3[0]); - } - - private final RegionFunction function; - private final BlockVector3[] directions; - private final Long2ObjectOpenHashMap visits; - private final Long2ObjectOpenHashMap queues; - private ConcurrentLinkedQueue queuePool = new ConcurrentLinkedQueue<>(); - - public ScanChunk(RegionFunction function) { - this.function = function; - this.directions = DEFAULT_DIRECTIONS; - - this.queues = new Long2ObjectOpenHashMap<>(); - this.visits = new Long2ObjectOpenHashMap<>(); - } - - public static long pairInt(int x, int y) { - return (long) x << 32 | y & 0xffffffffL; - } - - public boolean isVisited(int x, int y, int z) { - int X = x >> 4; - int Z = z >> 4; - long pair = pairInt(X, Z); - long[][] chunk = visits.get(pair); - if (chunk == null) { - return false; - } - int layer = y >> 4; - long[] section = chunk[layer]; - if (section == null) { - return false; - } - return get(section, getLocalIndex(x & 15, y & 15, z & 15)); - } - - public void start(int x, int y, int z) { - if (!isVisited(x, y, z)) { - push(x, y, z); - visit(x, y, z); - } - } - - public void visit(int x, int y, int z) { - int X = x >> 4; - int Z = z >> 4; - long pair = pairInt(X, Z); - long[][] arrs = visits.get(pair); - if (arrs == null) { - visits.put(pair, arrs = new long[16][]); - } - int layer = y >> 4; - long[] section = arrs[layer]; - if (section == null) { - arrs[layer] = section = new long[64]; - } - set(section, getLocalIndex(x & 15, y & 15, z & 15)); - } - - private char[] getOrCreateQueue(long pair, int layer) { - char[][] arrs = queues.get(pair); - if (arrs == null) { - queues.put(pair, arrs = new char[16][]); - } - - char[] section = arrs[layer]; - if (section == null) { - arrs[layer] = section = newQueue(); - } - return section; - } - - private void push(int x, int y, int z) { - int X = x >> 4; - int Z = z >> 4; - long pair = pairInt(X, Z); - int layer = y >> 4; - char[] section = getOrCreateQueue(pair, layer); - push(section, x & 15, y & 15, z & 15); - } - - private void push(char[] queue, int x, int y, int z) { - char indexStart = queue[0]; - char indexEnd = queue[1]; - push(indexStart, indexEnd, queue, x, y, z); - } - - private void push(char indexStart, char indexEnd, char[] queue, int x, int y, int z) { - char index = getLocalIndex(x, y, z); - if (indexStart > 2) { - queue[0] = --indexStart; - queue[indexStart] = index; - } else { - queue[indexEnd] = index; - queue[0] = ++indexEnd; - } - } - - public void process() { - LongArraySet set = new LongArraySet(); - /* - while (!queues.isEmpty()) { - ObjectIterator> iter = queues.long2ObjectEntrySet().fastIterator(); - Long2ObjectMap.Entry entry = iter.next(); - long index = entry.getLongKey(); - int X = MathMan.unpairIntX(index); - int Z = MathMan.unpairIntY(index); - // check that adjacent chunks aren;t being processed - - char[] queue = entry.getValue(); - long[][] visit = visits.get(index); - if (visit == null) { - visits.put(index, visit = new long[16][]); - } - */ - } - - private char[] newQueue() { - char[] arr = queuePool.poll(); - if (arr != null) { - arr[0] = 2; - arr[1] = 2; - return arr; - } - return new char[4096]; - } - - public void process4(int xx, int yy, int zz, char[] queue, long[] visit) { - char index; - while ((index = queue[0]) != queue[1]) { - queue[0]++; - - char triple = queue[index]; - int x = index & 15; - int z = index >> 4 & 15; - int y = index >> 8; - - int absX = xx + x; - int absY = yy + y; - int absZ = zz + z; - - apply(xx + x, yy + y, zz + z); - - int x1 = x; - - // find start of scan-line - int i1 = index; - while (true) { - if (x1 < 0) { - // queue in west chunk - break; - } - if (get(visit, i1)) { - break; - } - // visit - set(visit, i1); - - i1--; - x1--; - } - i1++; - x1++; - - // find end of scan-line - int i2 = index; - int x2 = x; - while (true) { - if (x2 > 15) { - // queue in east chunk - break; - } - if (get(visit, i2)) { - break; - } - set(visit, i2); - i2++; - x2++; - } - i2--; - x2--; - - // find start - } - } - - public void apply(int x, int y, int z) { - - } - - public void process4(int chunkX, int chunkZ, char[][] queues, long[][] visit) { - int xx = chunkX << 4; - int zz = chunkZ << 4; - - // TODO fetch instead of create - final BlockVector3[] dirs = directions; - char[][] dirQueues = new char[directions.length][]; - while (true) { - boolean empty = true; - for (int layer = 0; layer < 16; layer++) { - char[] queue = queues[layer]; - if (queue == null) { - continue; - } - char index; - while ((index = queue[0]) != queue[1]) { - queue[0]++; - - char triple = queue[index]; - int x = index & 15; - int z = index >> 4 & 15; - int y = index >> 8; - } - queuePool.add(queue); - queues[layer] = null; - continue; - } - - if (empty) { - break; - } - } - // empty queues - - /* while (indexStart != indexEnd) { - char index = queue[indexStart++]; - byte dirs = 0xF; - int x = index & 15; - int z = (index >> 4) & 15; - int y = index >> 8; - - int layer = y >> 4; - long[] visitBits = visit[layer]; - - int x1 = x; - int x2 = x; - - // find start of scan-line - int i1 = index; - while (true) { - if (x1 < 0) { - // queue in adjacent chunk - break; - } - if (get(visitBits, i1--)) break; - x1--; - } - i1++; - x1++; - - // find end of scan-line - int i2 = index; - while (true) { - if (x2 > 15) { - // queue in adjacent chunk - break; - } - if (get(visitBits, i2++)) break; - x2++; - } - i2--; - x2--; - - boolean scanUp = false; - boolean scanDown = false; - boolean scanLeft = false; - boolean scanRight = false; - - for (int i = i1; i <= i2; i++) { - if (!scanDown && y > 0 && ) - } - - for (int i=x1; i<=x2; i++) { // find scan-lines above this one - if (!inScanLine && y>0 && ip.getPixel(i,y-1)==color) - {push(i, y-1); inScanLine = true;} - else if (inScanLine && y>0 && ip.getPixel(i,y-1)!=color) - inScanLine = false; - } - - inScanLine = false; - for (int i=x1; i<=x2; i++) { // find scan-lines below this one - if (!inScanLine && y> 6] |= 1L << (i & 0x3F); - } - - public boolean get(long[] bits, int i) { - return (bits[i >> 6] & 1L << (i & 0x3F)) != 0; - } - - public char getLocalIndex(int x, int y, int z) { - return (char) (x + (z << 4) + (y << 8)); - } - - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java index 1d682f3ce..8930f4c97 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityCreate.java @@ -33,7 +33,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public class EntityCreate implements Change { private final Location location; + //FAWE start - made public public final BaseEntity state; + //FAWE end private Entity entity; /** @@ -60,9 +62,11 @@ public class EntityCreate implements Change { } } + //FAWE start public Entity getEntity() { return entity; } + //FAWE end @Override public void redo(UndoContext context) throws WorldEditException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java index 82426225c..51b8757d5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/change/EntityRemove.java @@ -33,7 +33,9 @@ import static com.google.common.base.Preconditions.checkNotNull; public class EntityRemove implements Change { private final Location location; + //FAWE start - make public public final BaseEntity state; + //FAWE end private Entity entity; /** @@ -49,9 +51,11 @@ public class EntityRemove implements Change { this.state = state; } + //FAWE start public Entity getEntity() { return entity; } + //FAWE end @Override public void undo(UndoContext context) throws WorldEditException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java index f185c969a..ff624e81e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ArrayListHistory.java @@ -19,7 +19,8 @@ package com.sk89q.worldedit.history.changeset; -import com.fastasyncworldedit.core.object.changeset.SimpleChangeSetSummary; +import com.fastasyncworldedit.core.history.changeset.ChangeSetSummary; +import com.fastasyncworldedit.core.history.changeset.SimpleChangeSetSummary; import com.google.common.collect.Lists; import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.change.Change; @@ -74,6 +75,7 @@ public class ArrayListHistory implements ChangeSet { return changes.size(); } + //FAWE start @Override public ChangeSetSummary summarize(Region region, boolean shallow) { SimpleChangeSetSummary summary = new SimpleChangeSetSummary(); @@ -86,4 +88,5 @@ public class ArrayListHistory implements ChangeSet { } return summary; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java index b9177733d..3bbfea529 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.history.changeset; +import com.fastasyncworldedit.core.history.changeset.ChangeSetSummary; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.regions.Region; import org.jetbrains.annotations.Nullable; @@ -31,7 +32,9 @@ import java.util.Iterator; * Tracks a set of undoable operations and allows their undo and redo. The * entirety of a change set should be undone and redone at once. */ +//FAWE start - extends Closable public interface ChangeSet extends Closeable { +//FAWE end /** * Add the given change to the history. @@ -81,6 +84,7 @@ public interface ChangeSet extends Closeable { */ int size(); + //FAWE start /** * Close the changeset. */ @@ -109,4 +113,5 @@ public interface ChangeSet extends Closeable { default boolean isEmpty() { return size() == 0; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/PatternList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/PatternList.java deleted file mode 100644 index 30bef0e8c..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/PatternList.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.internal.annotation; - -import org.enginehub.piston.inject.InjectAnnotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotates a {@code List} parameter to inject a list of BlockStates. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PARAMETER) -@InjectAnnotation -public @interface PatternList { -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java index dbfdd8008..f009ff055 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/ChunkDeleter.java @@ -52,7 +52,7 @@ import java.util.stream.Stream; public final class ChunkDeleter { public static final String DELCHUNKS_FILE_NAME = "delete_chunks.json"; - private static final Logger LOGGER = LogManagerCompat.getLogger();; + private static final Logger LOGGER = LogManagerCompat.getLogger(); private static final Comparator chunkSorter = Comparator.comparing( pos -> (pos.getBlockX() & 31) + (pos.getBlockZ() & 31) * 32 @@ -64,7 +64,7 @@ public final class ChunkDeleter { .create(); public static ChunkDeletionInfo readInfo(Path chunkFile) throws IOException, JsonSyntaxException { - String json = new String(Files.readAllBytes(chunkFile), StandardCharsets.UTF_8); + String json = Files.readString(chunkFile); return chunkDeleterGson.fromJson(json, ChunkDeletionInfo.class); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java index 96ef62e81..4a7e7d944 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/anvil/RegionAccess.java @@ -30,7 +30,7 @@ import java.nio.file.Path; */ class RegionAccess implements AutoCloseable { - private RandomAccessFile raf; + private final RandomAccessFile raf; private int[] offsets; private int[] timestamps; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java index 69bdad383..0233529bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/block/BlockStateIdAccess.java @@ -25,6 +25,7 @@ import javax.annotation.Nullable; public final class BlockStateIdAccess { + //FAWE start - Register via ordinal ID private static final int INVALID_ID = -1; /** @@ -50,5 +51,6 @@ public final class BlockStateIdAccess { private BlockStateIdAccess() { } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java index dc91aa5e1..e36a7791d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/exception/WorldEditExceptionConverter.java @@ -97,6 +97,7 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper { throw newCommandException(Caption.of("worldedit.error.unknown-block", TextComponent.of(e.getID())), e); } + @Deprecated @ExceptionMatch public void convert(InvalidItemException e) throws CommandException { throw newCommandException(e.getMessage(), e); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java index d6943752c..a2bb4631c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java @@ -42,11 +42,11 @@ public class SelectionCylinderEvent implements CUIEvent { @Override public String[] getParameters() { return new String[] { - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()), - String.valueOf(radius.getX()), - String.valueOf(radius.getZ()) - }; + String.valueOf(pos.getBlockX()), + String.valueOf(pos.getBlockY()), + String.valueOf(pos.getBlockZ()), + String.valueOf(radius.getX()), + String.valueOf(radius.getZ()) + }; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java index 2c671f2f3..477c2f0f6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java @@ -39,11 +39,11 @@ public class SelectionEllipsoidPointEvent implements CUIEvent { @Override public String[] getParameters() { return new String[] { - String.valueOf(id), - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()) - }; + String.valueOf(id), + String.valueOf(pos.getBlockX()), + String.valueOf(pos.getBlockY()), + String.valueOf(pos.getBlockZ()) + }; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java index ceb9fa322..8077e1d4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java @@ -37,9 +37,9 @@ public class SelectionMinMaxEvent implements CUIEvent { @Override public String[] getParameters() { return new String[] { - String.valueOf(min), - String.valueOf(max), - }; + String.valueOf(min), + String.valueOf(max), + }; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java index 646eadb50..a0d0ce4a9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java @@ -67,11 +67,11 @@ public class SelectionPoint2DEvent implements CUIEvent { @Override public String[] getParameters() { return new String[] { - String.valueOf(id), - String.valueOf(blockX), - String.valueOf(blockZ), - String.valueOf(area) - }; + String.valueOf(id), + String.valueOf(blockX), + String.valueOf(blockZ), + String.valueOf(area) + }; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java index a140791bb..a2c5d19b2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java @@ -48,12 +48,12 @@ public class SelectionPointEvent implements CUIEvent { @Override public String[] getParameters() { return new String[] { - String.valueOf(id), - String.valueOf(pos.getBlockX()), - String.valueOf(pos.getBlockY()), - String.valueOf(pos.getBlockZ()), - String.valueOf(area) - }; + String.valueOf(id), + String.valueOf(pos.getBlockX()), + String.valueOf(pos.getBlockY()), + String.valueOf(pos.getBlockZ()), + String.valueOf(area) + }; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java index 85f869e2d..3051e8d7e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -40,9 +40,18 @@ import javax.annotation.Nullable; */ public class ServerCUIHandler { + private static final int MAX_DISTANCE = 32; + private ServerCUIHandler() { } + public static int getMaxServerCuiSize() { + int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getDataVersion(); + + // 1.16 increased maxSize to 48. + return dataVersion >= 2566 ? 48 : 32; + } + /** * Creates a structure block that shows the region. * @@ -58,8 +67,6 @@ public class ServerCUIHandler { LocalSession session = WorldEdit.getInstance().getSessionManager().get(player); RegionSelector regionSelector = session.getRegionSelector(player.getWorld()); - int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion(); - int posX; int posY; int posZ; @@ -109,16 +116,11 @@ public class ServerCUIHandler { return null; } - if (dataVersion >= 2526) { - if (width > 48 || length > 48 || height > 48) { - // 20w16a+ allows structure blocks up to 48 per axis - return null; - } else { - if (width > 32 || length > 32 || height > 32) { - // Structure blocks on versions <= 20w16a have a limit of 32x32x32 - return null; - } - } + int maxSize = getMaxServerCuiSize(); + + if (width > maxSize || length > maxSize || height > maxSize) { + // Structure blocks have a limit of maxSize^3 + return null; } // Borrowed this math from FAWE @@ -128,26 +130,24 @@ public class ServerCUIHandler { double xz = Math.cos(Math.toRadians(rotY)); int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12); - int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3)); + int y = Math.max( + player.getWorld().getMinY(), + Math.min(Math.min(player.getWorld().getMaxY(), posY + MAX_DISTANCE), posY + 3) + ); + //FAWE start - CBT > Map CompoundBinaryTag.Builder structureTag = CompoundBinaryTag.builder(); posX -= x; posY -= y; posZ -= z; - if (dataVersion >= 2526) { - if (Math.abs(posX) > 48 || Math.abs(posY) > 48 || Math.abs(posZ) > 48) { - // 20w16a+ allows structure blocks up to 48 per axis - return null; - } else { - if (Math.abs(posX) > 32 || Math.abs(posY) > 32 || Math.abs(posZ) > 32) { - // Structure blocks on versions <= 20w16a have a limit of 32x32x32 - return null; - } - } + if (Math.abs(posX) > MAX_DISTANCE || Math.abs(posY) > MAX_DISTANCE || Math.abs(posZ) > MAX_DISTANCE) { + // Structure blocks have a limit + return null; } + //FAWE start - see comment of CBT structureTag.putString("name", "worldedit:" + player.getName()); structureTag.putString("author", player.getName()); structureTag.putString("metadata", ""); @@ -168,5 +168,6 @@ public class ServerCUIHandler { structureTag.putString("id", BlockTypes.STRUCTURE_BLOCK.getId()); return BlockTypes.STRUCTURE_BLOCK.getDefaultState().toBaseBlock(structureTag.build()); + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index d1009dbbe..b8c765d4d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -62,21 +62,27 @@ import java.util.Set; * pass values for all slots specified while compiling. * To query slots after evaluation, you can use the {@linkplain #getSlots() slot table}. */ +//FAWE start - implements Cloneable public class Expression implements Cloneable { +//FAWE end private final SlotTable slots = new SlotTable(); private final List providedSlots; private final ExpressionParser.AllStatementsContext root; private final Functions functions = Functions.create(); private final CompiledExpression compiledExpression; + //FAWE start private final String initialExpression; + //FAWE end public static Expression compile(String expression, String... variableNames) throws ExpressionException { return new Expression(expression, variableNames); } private Expression(String expression, String... variableNames) throws ExpressionException { + //FAWE start this.initialExpression = expression; + //FAWE end slots.putSlot("e", new LocalSlot.Constant(Math.E)); slots.putSlot("pi", new LocalSlot.Constant(Math.PI)); @@ -185,8 +191,10 @@ public class Expression implements Cloneable { functions.setEnvironment(environment); } + //FAWE start public Expression clone() { return new Expression(initialExpression, new HashSet<>(providedSlots)); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java index d94312249..faf9b3452 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/SimpleInputParser.java @@ -39,7 +39,7 @@ public abstract class SimpleInputParser extends InputParser { } /** - * The strings this parser matches + * The strings this parser matches. * * @return the matching aliases */ @@ -57,7 +57,7 @@ public abstract class SimpleInputParser extends InputParser { public abstract E parseFromSimpleInput(String input, ParserContext context) throws InputParseException; /** - * Gets the primary name of this matcher + * Gets the primary name of this matcher. * * @return the primary match */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java index 6fac9b714..a95bbf1a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/BiomeMath.java @@ -33,7 +33,7 @@ public class BiomeMath { } /** - * Compute the index into the MC biome array. + * Compute the index into the MC biome array, for non-extended-height worlds. * * @param x the block x coordinate * @param y the block y coordinate @@ -45,7 +45,26 @@ public class BiomeMath { int m = MathHelper.clamp(y >> 2, 0, VERTICAL_BIT_MASK); int n = (z >> 2) & HORIZONTAL_BIT_MASK; return m << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT - | n << HORIZONTAL_SECTION_COUNT - | l; + | n << HORIZONTAL_SECTION_COUNT + | l; + } + + /** + * Compute the index into the MC biome array, for extended-height worlds. + * + * @param x the block x coordinate + * @param y the block y coordinate + * @param z the block z coordinate + * @param minY minimum y of the world + * @param maxY maximum y of the world + * @return the index into the standard MC biome array + */ + public static int computeBiomeIndex(int x, int y, int z, int minY, int maxY) { + int l = (x >> 2) & HORIZONTAL_BIT_MASK; + int m = MathHelper.clamp((y >> 2) - minY, 0, maxY); + int n = (z >> 2) & HORIZONTAL_BIT_MASK; + return m << HORIZONTAL_SECTION_COUNT + HORIZONTAL_SECTION_COUNT + | n << HORIZONTAL_SECTION_COUNT + | l; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java index 59461963f..1ef64be43 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/wna/WorldNativeAccess.java @@ -69,6 +69,7 @@ public interface WorldNativeAccess { if (successful || old == newState) { if (block instanceof BaseBlock) { BaseBlock baseBlock = (BaseBlock) block; + //FAWE start - use CompoundBinaryTag over CompoundTag CompoundBinaryTag tag = baseBlock.getNbt(); if (tag != null) { tag = tag.put(ImmutableMap.of( @@ -81,6 +82,7 @@ public interface WorldNativeAccess { // update if TE changed as well successful = updateTileEntity(pos, tag); } + //FAWE end } } @@ -190,6 +192,8 @@ public interface WorldNativeAccess { onBlockStateChange(pos, oldState, newState); } + //FAWE start void flush(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java index 48c579ac8..0d5ba2648 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.math; +import com.fastasyncworldedit.core.math.MutableBlockVector2; import com.sk89q.worldedit.math.transform.AffineTransform; import java.util.Comparator; @@ -26,7 +27,9 @@ import java.util.Comparator; /** * An immutable 2-dimensional vector. */ +//FAWE start - un-finalize public class BlockVector2 { +//FAWE end public static final BlockVector2 ZERO = new BlockVector2(0, 0); public static final BlockVector2 UNIT_X = new BlockVector2(1, 0); @@ -57,6 +60,7 @@ public class BlockVector2 { } public static BlockVector2 at(int x, int z) { + //FAWE start /* unnecessary switch (x) { case 0: @@ -112,6 +116,7 @@ public class BlockVector2 { public MutableBlockVector2 mutZ(int z) { return new MutableBlockVector2(x, z); } + //FAWE end /** * Get the X coordinate. @@ -169,6 +174,7 @@ public class BlockVector2 { return BlockVector2.at(x, z); } + //FAWE start public MutableBlockVector2 nextPosition() { int absX = Math.abs(x); int absY = Math.abs(z); @@ -197,6 +203,7 @@ public class BlockVector2 { return setComponents(x + 1, z); } } + //FAWE end /** * Add another vector to this vector and return the result as a new vector. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java index 801cdece1..8d75feccd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.math; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.transform.AffineTransform; @@ -52,7 +53,7 @@ public abstract class BlockVector3 { } public static BlockVector3 at(int x, int y, int z) { - /* unnecessary + /*FAWE start unnecessary // switch for efficiency on typical cases // in MC y is rarely 0/1 on selections switch (y) { @@ -70,11 +71,13 @@ public abstract class BlockVector3 { break; } */ + //FAWE end return new BlockVector3Imp(x, y, z); } private static final int WORLD_XZ_MINMAX = 30_000_000; - private static final int WORLD_Y_MAX = 4095; + private static final int WORLD_Y_MIN = -2048; + private static final int WORLD_Y_MAX = 2047; private static boolean isHorizontallyInBounds(int h) { return -WORLD_XZ_MINMAX <= h && h <= WORLD_XZ_MINMAX; @@ -83,7 +86,7 @@ public abstract class BlockVector3 { public static boolean isLongPackable(BlockVector3 location) { return isHorizontallyInBounds(location.getX()) && isHorizontallyInBounds(location.getZ()) - && 0 <= location.getY() && location.getY() <= WORLD_Y_MAX; + && WORLD_Y_MIN <= location.getY() && location.getY() <= WORLD_Y_MAX; } public static void checkLongPackable(BlockVector3 location) { @@ -117,6 +120,7 @@ public abstract class BlockVector3 { return YzxOrderComparator.YZX_ORDER; } + //FAWE start public MutableBlockVector3 setComponents(double x, double y, double z) { return new MutableBlockVector3((int) x, (int) y, (int) z); } @@ -157,22 +161,27 @@ public abstract class BlockVector3 { public BlockVector3 toImmutable() { return BlockVector3.at(getX(), getY(), getZ()); } + //FAWE end /** * Get the X coordinate. * * @return the x coordinate */ + //FAWE start - Made abstract public abstract int getX(); + //FAWE end /** * Get the X coordinate. * * @return the x coordinate */ + //FAWE start - getter public int getBlockX() { return getX(); } + //FAWE end /** * Set the X coordinate. @@ -180,25 +189,31 @@ public abstract class BlockVector3 { * @param x the new X * @return a new vector */ + //FAWE start - getter public BlockVector3 withX(int x) { return BlockVector3.at(x, getY(), getZ()); } + //FAWE end /** * Get the Y coordinate. * * @return the y coordinate */ + //FAWE start - Made abstract public abstract int getY(); + //FAWE end /** * Get the Y coordinate. * * @return the y coordinate */ + //FAWE start - getter public int getBlockY() { return getY(); } + //FAWE end /** * Set the Y coordinate. @@ -206,25 +221,31 @@ public abstract class BlockVector3 { * @param y the new Y * @return a new vector */ + //FAWE start - getter public BlockVector3 withY(int y) { return BlockVector3.at(getX(), y, getZ()); } + //FAWE end /** * Get the Z coordinate. * * @return the z coordinate */ + //FAWE start - Made abstract public abstract int getZ(); + //FAWE end /** * Get the Z coordinate. * * @return the z coordinate */ + //FAWE start - getter public int getBlockZ() { return getZ(); } + //FAWE end /** * Set the Z coordinate. @@ -232,9 +253,11 @@ public abstract class BlockVector3 { * @param z the new Z * @return a new vector */ + //FAWE start - getter public BlockVector3 withZ(int z) { return BlockVector3.at(getX(), getY(), z); } + //FAWE end /** * Add another vector to this vector and return the result as a new vector. @@ -242,9 +265,11 @@ public abstract class BlockVector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public BlockVector3 add(BlockVector3 other) { return add(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Add another vector to this vector and return the result as a new vector. @@ -254,9 +279,11 @@ public abstract class BlockVector3 { * @param z the value to add * @return a new vector */ + //FAWE start - getter public BlockVector3 add(int x, int y, int z) { return BlockVector3.at(this.getX() + x, this.getY() + y, this.getZ() + z); } + //FAWE end /** * Add a list of vectors to this vector and return the @@ -265,6 +292,7 @@ public abstract class BlockVector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public BlockVector3 add(BlockVector3... others) { int newX = getX(); int newY = getY(); @@ -278,6 +306,7 @@ public abstract class BlockVector3 { return BlockVector3.at(newX, newY, newZ); } + //FAWE end /** * Subtract another vector from this vector and return the result @@ -286,9 +315,11 @@ public abstract class BlockVector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public BlockVector3 subtract(BlockVector3 other) { return subtract(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Subtract another vector from this vector and return the result @@ -299,9 +330,11 @@ public abstract class BlockVector3 { * @param z the value to subtract * @return a new vector */ + //FAWE start - getter public BlockVector3 subtract(int x, int y, int z) { return BlockVector3.at(this.getX() - x, this.getY() - y, this.getZ() - z); } + //FAWE end /** * Subtract a list of vectors from this vector and return the result @@ -310,6 +343,7 @@ public abstract class BlockVector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public BlockVector3 subtract(BlockVector3... others) { int newX = getX(); int newY = getY(); @@ -323,6 +357,7 @@ public abstract class BlockVector3 { return BlockVector3.at(newX, newY, newZ); } + //FAWE end /** * Multiply this vector by another vector on each component. @@ -330,9 +365,11 @@ public abstract class BlockVector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public BlockVector3 multiply(BlockVector3 other) { return multiply(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Multiply this vector by another vector on each component. @@ -342,9 +379,11 @@ public abstract class BlockVector3 { * @param z the value to multiply * @return a new vector */ + //FAWE start - getter public BlockVector3 multiply(int x, int y, int z) { return BlockVector3.at(this.getX() * x, this.getY() * y, this.getZ() * z); } + //FAWE end /** * Multiply this vector by zero or more vectors on each component. @@ -352,6 +391,7 @@ public abstract class BlockVector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public BlockVector3 multiply(BlockVector3... others) { int newX = getX(); int newY = getY(); @@ -365,6 +405,7 @@ public abstract class BlockVector3 { return BlockVector3.at(newX, newY, newZ); } + //FAWE end /** * Perform scalar multiplication and return a new vector. @@ -382,9 +423,11 @@ public abstract class BlockVector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public BlockVector3 divide(BlockVector3 other) { return divide(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Divide this vector by another vector on each component. @@ -394,9 +437,11 @@ public abstract class BlockVector3 { * @param z the value to divide by * @return a new vector */ + //FAWE start - getter public BlockVector3 divide(int x, int y, int z) { return BlockVector3.at(this.getX() / x, this.getY() / y, this.getZ() / z); } + //FAWE end /** * Perform scalar division and return a new vector. @@ -416,9 +461,11 @@ public abstract class BlockVector3 { * @param z the value to shift z by * @return a new vector */ + //FAWE start - getter public BlockVector3 shr(int x, int y, int z) { return at(this.getX() >> x, this.getY() >> y, this.getZ() >> z); } + //FAWE end /** * Shift all components right by {@code n}. @@ -438,9 +485,11 @@ public abstract class BlockVector3 { * @param z the value to shift z by * @return a new vector */ + //FAWE start - getter public BlockVector3 shl(int x, int y, int z) { return at(this.getX() << x, this.getY() << y, this.getZ() << z); } + //FAWE end /** * Shift all components left by {@code n}. @@ -466,9 +515,11 @@ public abstract class BlockVector3 { * * @return length, squared */ + //FAWE start - getter public int lengthSq() { return getX() * getX() + getY() * getY() + getZ() * getZ(); } + //FAWE end /** * Get the distance between this vector and another vector. @@ -486,12 +537,14 @@ public abstract class BlockVector3 { * @param other the other vector * @return distance */ + //FAWE start - getter public int distanceSq(BlockVector3 other) { int dx = other.getX() - getX(); int dy = other.getY() - getY(); int dz = other.getZ() - getZ(); return dx * dx + dy * dy + dz * dz; } + //FAWE end /** * Get the normalized vector, which is the vector divided by its @@ -499,6 +552,7 @@ public abstract class BlockVector3 { * * @return a new vector */ + //FAWE start - getter public BlockVector3 normalize() { double len = length(); double x = this.getX() / len; @@ -506,6 +560,7 @@ public abstract class BlockVector3 { double z = this.getZ() / len; return BlockVector3.at(x, y, z); } + //FAWE end /** * Gets the dot product of this and another vector. @@ -513,9 +568,11 @@ public abstract class BlockVector3 { * @param other the other vector * @return the dot product of this and the other vector */ + //FAWE start - getter public double dot(BlockVector3 other) { return getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); } + //FAWE end /** * Gets the cross product of this and another vector. @@ -523,6 +580,7 @@ public abstract class BlockVector3 { * @param other the other vector * @return the cross product of this and the other vector */ + //FAWE start - getter public BlockVector3 cross(BlockVector3 other) { return new BlockVector3Imp( getY() * other.getZ() - getZ() * other.getY(), @@ -530,6 +588,7 @@ public abstract class BlockVector3 { getX() * other.getY() - getY() * other.getX() ); } + //FAWE end /** * Checks to see if a vector is contained with another. @@ -538,10 +597,12 @@ public abstract class BlockVector3 { * @param max the maximum point (X, Y, and Z are the lowest) * @return true if the vector is contained */ + //FAWE start - getter public boolean containedWithin(BlockVector3 min, BlockVector3 max) { return getX() >= min.getX() && getX() <= max.getX() && getY() >= min.getY() && getY() <= max .getY() && getZ() >= min.getZ() && getZ() <= max.getZ(); } + //FAWE end /** * Clamp the Y component. @@ -550,6 +611,7 @@ public abstract class BlockVector3 { * @param max the maximum value * @return a new vector */ + //FAWE start - getter public BlockVector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); if (getY() < min) { @@ -560,6 +622,7 @@ public abstract class BlockVector3 { } return this; } + //FAWE end /** * Floors the values of all components. @@ -599,9 +662,11 @@ public abstract class BlockVector3 { * * @return a new vector */ + //FAWE start - getter public BlockVector3 abs() { return BlockVector3.at(Math.abs(getX()), Math.abs(getY()), Math.abs(getZ())); } + //FAWE end /** * Perform a 2D transformation on this vector and return a new one. @@ -614,6 +679,7 @@ public abstract class BlockVector3 { * @return a new vector * @see AffineTransform another method to transform vectors */ + //FAWE start - getter public BlockVector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { angle = Math.toRadians(angle); double x = this.getX() - aboutX; @@ -629,6 +695,7 @@ public abstract class BlockVector3 { z2 + aboutZ + translateZ ); } + //FAWE end /** * Get this vector's pitch as used within the game. @@ -670,6 +737,7 @@ public abstract class BlockVector3 { * @param v2 the second vector * @return minimum */ + //FAWE start - getter public BlockVector3 getMinimum(BlockVector3 v2) { return new BlockVector3Imp( Math.min(getX(), v2.getX()), @@ -677,6 +745,7 @@ public abstract class BlockVector3 { Math.min(getZ(), v2.getZ()) ); } + //FAWE end /** * Gets the maximum components of two vectors. @@ -684,6 +753,7 @@ public abstract class BlockVector3 { * @param v2 the second vector * @return maximum */ + //FAWE start - getter public BlockVector3 getMaximum(BlockVector3 v2) { return new BlockVector3Imp( Math.max(getX(), v2.getX()), @@ -691,7 +761,9 @@ public abstract class BlockVector3 { Math.max(getZ(), v2.getZ()) ); } + //FAWE end + //FAWE start /* Methods for getting/setting blocks @@ -799,5 +871,6 @@ public abstract class BlockVector3 { public BlockVector3 plus(BlockVector3 other) { return add(other); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java index f2e418b4d..fa2703a9e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2.java @@ -470,7 +470,9 @@ public final class Vector2 { @Override public int hashCode() { + //FAWE start - XOR over x z calc return (int) x << 16 ^ (int) z; + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java index c2d752e44..b6a7559a3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.math; +import com.fastasyncworldedit.core.math.MutableVector3; +import com.fastasyncworldedit.core.math.Vector3Impl; import com.fastasyncworldedit.core.util.MathMan; import com.google.common.collect.ComparisonChain; import com.sk89q.worldedit.math.transform.AffineTransform; @@ -39,7 +41,7 @@ public abstract class Vector3 { public static final Vector3 ONE = Vector3.at(1, 1, 1); public static Vector3 at(double x, double y, double z) { - /* Unnecessary + /*FAWE start - Unnecessary // switch for efficiency on typical cases // in MC y is rarely 0/1 on selections int yTrunc = (int) y; @@ -57,6 +59,7 @@ public abstract class Vector3 { default: break; } + Fawe end */ return new Vector3Impl(x, y, z); } @@ -83,6 +86,7 @@ public abstract class Vector3 { return YzxOrderComparator.YZX_ORDER; } + //FAWE start /** * Gets the x coordinate rounded, accounting for negative coordinates * @@ -145,13 +149,16 @@ public abstract class Vector3 { public MutableVector3 mutZ(double z) { return new MutableVector3(getX(), getY(), z); } + //FAWE end /** * Get the X coordinate. * * @return the x coordinate */ + //FAWE start - made abstract public abstract double getX(); + //FAWE end /** * Set the X coordinate. @@ -159,16 +166,20 @@ public abstract class Vector3 { * @param x the new X * @return a new vector */ + //FAWE start - getter public Vector3 withX(double x) { return Vector3.at(x, getY(), getZ()); } + //FAWE end /** * Get the Y coordinate. * * @return the y coordinate */ + //FAWE start - made abstract public abstract double getY(); + //FAWE end /** * Set the Y coordinate. @@ -176,16 +187,20 @@ public abstract class Vector3 { * @param y the new Y * @return a new vector */ + //FAWE start - getter public Vector3 withY(double y) { return Vector3.at(getX(), y, getZ()); } + //FAWE end /** * Get the Z coordinate. * * @return the z coordinate */ + //FAWE start - made abstract public abstract double getZ(); + //FAWE end /** * Set the Z coordinate. @@ -193,9 +208,11 @@ public abstract class Vector3 { * @param z the new Z * @return a new vector */ + //FAWE start - getter public Vector3 withZ(double z) { return Vector3.at(getX(), getY(), z); } + //FAWE end /** * Add another vector to this vector and return the result as a new vector. @@ -203,9 +220,11 @@ public abstract class Vector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public Vector3 add(Vector3 other) { return add(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Add another vector to this vector and return the result as a new vector. @@ -215,9 +234,11 @@ public abstract class Vector3 { * @param z the value to add * @return a new vector */ + //FAWE start - getter public Vector3 add(double x, double y, double z) { return Vector3.at(this.getX() + x, this.getY() + y, this.getZ() + z); } + //FAWE end /** * Add a list of vectors to this vector and return the @@ -226,6 +247,7 @@ public abstract class Vector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public Vector3 add(Vector3... others) { double newX = getX(); double newY = getY(); @@ -239,6 +261,7 @@ public abstract class Vector3 { return Vector3.at(newX, newY, newZ); } + //FAWE end /** * Subtract another vector from this vector and return the result @@ -247,9 +270,11 @@ public abstract class Vector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public Vector3 subtract(Vector3 other) { return subtract(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Subtract another vector from this vector and return the result @@ -260,9 +285,11 @@ public abstract class Vector3 { * @param z the value to subtract * @return a new vector */ + //FAWE start - getter public Vector3 subtract(double x, double y, double z) { return Vector3.at(this.getX() - x, this.getY() - y, this.getZ() - z); } + //FAWE end /** * Subtract a list of vectors from this vector and return the result @@ -271,6 +298,7 @@ public abstract class Vector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public Vector3 subtract(Vector3... others) { double newX = getX(); double newY = getY(); @@ -284,6 +312,7 @@ public abstract class Vector3 { return Vector3.at(newX, newY, newZ); } + //FAWE end /** * Multiply this vector by another vector on each component. @@ -291,9 +320,11 @@ public abstract class Vector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public Vector3 multiply(Vector3 other) { return multiply(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Multiply this vector by another vector on each component. @@ -303,9 +334,11 @@ public abstract class Vector3 { * @param z the value to multiply * @return a new vector */ + //FAWE start - getter public Vector3 multiply(double x, double y, double z) { return Vector3.at(this.getX() * x, this.getY() * y, this.getZ() * z); } + //FAWE end /** * Multiply this vector by zero or more vectors on each component. @@ -313,6 +346,7 @@ public abstract class Vector3 { * @param others an array of vectors * @return a new vector */ + //FAWE start - getter public Vector3 multiply(Vector3... others) { double newX = getX(); double newY = getY(); @@ -326,6 +360,7 @@ public abstract class Vector3 { return Vector3.at(newX, newY, newZ); } + //FAWE end /** * Perform scalar multiplication and return a new vector. @@ -343,9 +378,11 @@ public abstract class Vector3 { * @param other the other vector * @return a new vector */ + //FAWE start - getter public Vector3 divide(Vector3 other) { return divide(other.getX(), other.getY(), other.getZ()); } + //FAWE end /** * Divide this vector by another vector on each component. @@ -355,9 +392,11 @@ public abstract class Vector3 { * @param z the value to divide by * @return a new vector */ + //FAWE start - getter public Vector3 divide(double x, double y, double z) { return Vector3.at(this.getX() / x, this.getY() / y, this.getZ() / z); } + //FAWE end /** * Perform scalar division and return a new vector. @@ -383,9 +422,11 @@ public abstract class Vector3 { * * @return length, squared */ + //FAWE start - getter public double lengthSq() { return getX() * getX() + getY() * getY() + getZ() * getZ(); } + //FAWE end /** * Get the distance between this vector and another vector. @@ -403,12 +444,14 @@ public abstract class Vector3 { * @param other the other vector * @return distance */ + //FAWE start - getter public double distanceSq(Vector3 other) { double dx = other.getX() - getX(); double dy = other.getY() - getY(); double dz = other.getZ() - getZ(); return dx * dx + dy * dy + dz * dz; } + //FAWE end /** * Get the normalized vector, which is the vector divided by its @@ -426,9 +469,11 @@ public abstract class Vector3 { * @param other the other vector * @return the dot product of this and the other vector */ + //FAWE start - getter public double dot(Vector3 other) { return getX() * other.getX() + getY() * other.getY() + getZ() * other.getZ(); } + //FAWE end /** * Gets the cross product of this and another vector. @@ -436,6 +481,7 @@ public abstract class Vector3 { * @param other the other vector * @return the cross product of this and the other vector */ + //FAWE start - getter public Vector3 cross(Vector3 other) { return Vector3.at( getY() * other.getZ() - getZ() * other.getY(), @@ -443,6 +489,7 @@ public abstract class Vector3 { getX() * other.getY() - getY() * other.getX() ); } + //FAWE end /** * Checks to see if a vector is contained with another. @@ -451,9 +498,11 @@ public abstract class Vector3 { * @param max the maximum point (X, Y, and Z are the lowest) * @return true if the vector is contained */ + //FAWE start - getter public boolean containedWithin(Vector3 min, Vector3 max) { return getX() >= min.getX() && getX() <= max.getX() && getY() >= min.getY() && getY() <= max.getY() && getZ() >= min.getZ() && getZ() <= max.getZ(); } + //FAWE end /** * Clamp the Y component. @@ -462,6 +511,7 @@ public abstract class Vector3 { * @param max the maximum value * @return a new vector */ + //FAWE start - getter public Vector3 clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); if (getY() < min) { @@ -472,24 +522,29 @@ public abstract class Vector3 { } return this; } + //FAWE end /** * Floors the values of all components. * * @return a new vector */ + //FAWE start - getter public Vector3 floor() { return Vector3.at(Math.floor(getX()), Math.floor(getY()), Math.floor(getZ())); } + //FAWE end /** * Rounds all components up. * * @return a new vector */ + //FAWE start - getter public Vector3 ceil() { return Vector3.at(Math.ceil(getX()), Math.ceil(getY()), Math.ceil(getZ())); } + //FAWE end /** * Rounds all components to the closest integer. @@ -498,18 +553,22 @@ public abstract class Vector3 { * * @return a new vector */ + //FAWE start - getter public Vector3 round() { return Vector3.at(Math.floor(getX() + 0.5), Math.floor(getY() + 0.5), Math.floor(getZ() + 0.5)); } + //FAWE end /** * Rounds all components using {@link MathUtils#roundHalfUp(double)} * * @return a new vector */ + //FAWE start - getter public Vector3 roundHalfUp() { return Vector3.at(MathUtils.roundHalfUp(getX()), MathUtils.roundHalfUp(getY()), MathUtils.roundHalfUp(getZ())); } + //FAWE end /** * Returns a vector with the absolute values of the components of @@ -517,9 +576,11 @@ public abstract class Vector3 { * * @return a new vector */ + //FAWE start - getter public Vector3 abs() { return Vector3.at(Math.abs(getX()), Math.abs(getY()), Math.abs(getZ())); } + //FAWE end /** * Perform a 2D transformation on this vector and return a new one. @@ -532,6 +593,7 @@ public abstract class Vector3 { * @return a new vector * @see AffineTransform another method to transform vectors */ + //FAWE start - getter public Vector3 transform2D(double angle, double aboutX, double aboutZ, double translateX, double translateZ) { angle = Math.toRadians(angle); double x = this.getX() - aboutX; @@ -547,6 +609,7 @@ public abstract class Vector3 { z2 + aboutZ + translateZ ); } + //FAWE end /** * Get this vector's pitch as used within the game. @@ -588,6 +651,7 @@ public abstract class Vector3 { * @param v2 the second vector * @return minimum */ + //FAWE start - getter public Vector3 getMinimum(Vector3 v2) { return Vector3.at( Math.min(getX(), v2.getX()), @@ -595,6 +659,7 @@ public abstract class Vector3 { Math.min(getZ(), v2.getZ()) ); } + //FAWE end /** * Gets the maximum components of two vectors. @@ -602,6 +667,7 @@ public abstract class Vector3 { * @param v2 the second vector * @return maximum */ + //FAWE start - getter public Vector3 getMaximum(Vector3 v2) { return Vector3.at( Math.max(getX(), v2.getX()), @@ -609,6 +675,7 @@ public abstract class Vector3 { Math.max(getZ(), v2.getZ()) ); } + //FAWE end /** * Create a new {@code BlockVector} using the given components. @@ -627,18 +694,22 @@ public abstract class Vector3 { * * @return a new {@code BlockVector} */ + //FAWE start - getter public BlockVector3 toBlockPoint() { return toBlockPoint(getX(), getY(), getZ()); } + //FAWE end /** * Creates a 2D vector by dropping the Y component from this vector. * * @return a new {@link Vector2} */ + //FAWE start - getter public Vector2 toVector2() { return Vector2.at(getX(), getZ()); } + //FAWE end @Override public boolean equals(Object obj) { @@ -647,9 +718,12 @@ public abstract class Vector3 { } Vector3 other = (Vector3) obj; + //FAWE start - getter return other.getX() == this.getX() && other.getY() == this.getY() && other.getZ() == this.getZ(); + //FAWE end } + //FAWE start /** * Tests if vectors are equal, accounting for floating point errors * @@ -673,17 +747,21 @@ public abstract class Vector3 { } return true; } + //FAWE end @Override + //FAWE start - XOR over get calculating all values independently public int hashCode() { return (int) getX() ^ (int) getZ() << 12 ^ (int) getY() << 24; } @Override public String toString() { + //FAWE start - getter & ternary String x = (getX() == getBlockX() ? "" + getBlockX() : "" + getX()); String y = (getY() == getBlockY() ? "" + getBlockY() : "" + getY()); String z = (getZ() == getBlockZ() ? "" + getBlockZ() : "" + getZ()); + //FAWE end return "(" + x + ", " + y + ", " + z + ")"; } @@ -691,8 +769,10 @@ public abstract class Vector3 { * Returns a string representation that is supported by the parser. * @return string */ + //FAWE start - getter public String toParserString() { return getX() + "," + getY() + "," + getZ(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index f0b75a9d3..7a73b8e4b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Regions; -import com.sk89q.worldedit.registry.state.PropertyGroup; +import com.fastasyncworldedit.core.registry.state.PropertyGroup; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; @@ -43,9 +43,11 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class HeightMap { + //FAWE start private final boolean layers; - private int[] data; private boolean[] invalid; + //FAWE end + private final int[] data; private final int width; private final int height; @@ -58,6 +60,7 @@ public class HeightMap { * @param session an edit session * @param region the region */ + //FAWE start public HeightMap(EditSession session, Region region) { this(session, region, (Mask) null, false); } @@ -65,6 +68,7 @@ public class HeightMap { public HeightMap(EditSession session, Region region, @Nullable Mask mask) { this(session, region, mask, false); } + //FAWE end public HeightMap(EditSession session, Region region, @Nullable Mask mask, boolean layers) { checkNotNull(session); @@ -87,6 +91,7 @@ public class HeightMap { data = new int[width * height]; invalid = new boolean[data.length]; + //FAWE start if (layers) { BlockVector3 min = region.getMinimumPoint(); int bx = min.getBlockX(); @@ -141,6 +146,7 @@ public class HeightMap { this.layers = layers; } + //FAWE end /** * Apply the filter 'iterations' amount times. @@ -160,6 +166,7 @@ public class HeightMap { newData = filter.filter(newData, width, height); } + //FAWE start - check layers return layers ? applyLayers(newData) : apply(newData); } @@ -249,6 +256,7 @@ public class HeightMap { } return blocksChanged; } + //FAWE end /** * Apply a raw heightmap to the region. @@ -273,6 +281,7 @@ public class HeightMap { BlockState tmpBlock = BlockTypes.AIR.getDefaultState(); // Apply heightmap int index = 0; + //FAWE start for (int z = 0; z < height; ++z) { int zr = z + originZ; for (int x = 0; x < width; ++x, index++) { @@ -326,6 +335,7 @@ public class HeightMap { } } } + //FAWE end // Drop trees to the floor -- TODO diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java index b9182bfa9..b26c33647 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.math.interpolation; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; import java.util.Collections; @@ -161,12 +161,14 @@ public class KochanekBartelsInterpolation implements Interpolation { final Vector3 c = coeffC[index]; final Vector3 d = coeffD[index]; + //FAWE start double r2 = remainder * remainder; double r3 = r2 * remainder; mutable.mutX((a.getX() * r3 + b.getX() * r2 + c.getX() * remainder + d.getX())); mutable.mutY((a.getY() * r3 + b.getY() * r2 + c.getY() * remainder + d.getY())); mutable.mutZ((a.getZ() * r3 + b.getZ() * r2 + c.getZ() * remainder + d.getZ())); return Vector3.at(mutable.getX(), mutable.getY(), mutable.getZ()); + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java index 68c7344e2..4261bea20 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java @@ -32,7 +32,9 @@ import java.io.Serializable; * JavaGeom project, * which is licensed under LGPL v2.1.

*/ +//FAWE start - made Serializable public class AffineTransform implements Transform, Serializable { +//FAWE end /** * coefficients for x coordinate. @@ -139,6 +141,7 @@ public class AffineTransform implements Transform, Serializable { return new double[]{m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23}; } + //FAWE start public boolean isOffAxis() { double[] c = coefficients(); for (int i = 0; i < c.length; i++) { @@ -150,6 +153,7 @@ public class AffineTransform implements Transform, Serializable { } return false; } + //FAWE end /** * Computes the determinant of this transform. Can be zero. @@ -294,6 +298,7 @@ public class AffineTransform implements Transform, Serializable { return scale(vec.getX(), vec.getY(), vec.getZ()); } + //FAWE start public boolean isScaled(Vector3 vector) { boolean flip = vector.getX() != 0 && m00 < 0; if (vector.getY() != 0 && m11 < 0) { @@ -317,6 +322,7 @@ public class AffineTransform implements Transform, Serializable { } return flip; } + //FAWE end @Override public Vector3 apply(Vector3 vector) { @@ -335,9 +341,11 @@ public class AffineTransform implements Transform, Serializable { @Override public Transform combine(Transform other) { + //FAWE start - check other identity if (other instanceof Identity || other.isIdentity()) { return this; } else if (other instanceof AffineTransform) { + //FAWE end return concatenate((AffineTransform) other); } else { return new CombinedTransform(this, other); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java index f50c7c28e..c3af94635 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.regions; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; +import com.fastasyncworldedit.core.math.BlockVectorSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; @@ -35,7 +35,9 @@ import java.util.List; import java.util.Objects; import java.util.Set; +//FAWE start - extends AbstractSet public abstract class AbstractRegion extends AbstractSet implements Region { +//FAWE end protected World world; @@ -43,10 +45,12 @@ public abstract class AbstractRegion extends AbstractSet implement this.world = world; } + //FAWE start @Override public int size() { return com.google.common.primitives.Ints.saturatedCast(getVolume()); } + //FAWE end @Override public Vector3 getCenter() { @@ -168,8 +172,10 @@ public abstract class AbstractRegion extends AbstractSet implement final BlockVector3 minBlock = getMinimumPoint(); final BlockVector3 maxBlock = getMaximumPoint(); + //FAWE start final BlockVector2 min = BlockVector2.at(minBlock.getX() >> 4, minBlock.getZ() >> 4); final BlockVector2 max = BlockVector2.at(maxBlock.getX() >> 4, maxBlock.getZ() >> 4); + //FAWE end for (int X = min.getBlockX(); X <= max.getBlockX(); ++X) { for (int Z = min.getBlockZ(); Z <= max.getBlockZ(); ++Z) { @@ -218,6 +224,7 @@ public abstract class AbstractRegion extends AbstractSet implement return world == null ? Integer.MAX_VALUE : world.getMaxY(); } + //FAWE start @Override public int hashCode() { int worldHash = this.world == null ? 7 : this.world.hashCode(); @@ -246,5 +253,6 @@ public abstract class AbstractRegion extends AbstractSet implement } return false; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java index 0aaac9184..9979cdd74 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java @@ -329,8 +329,10 @@ public class ConvexPolyhedralRegion extends AbstractRegion { return new ConvexPolyhedralRegion(this); } + //FAWE start @Override public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) { return false; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 1c01f3825..ce3f16878 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -20,17 +20,17 @@ package com.sk89q.worldedit.regions; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.object.collection.BlockVectorSet; +import com.fastasyncworldedit.core.math.BlockVectorSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector2; -import com.sk89q.worldedit.math.MutableBlockVector3; +import com.fastasyncworldedit.core.math.MutableBlockVector2; +import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; import org.jetbrains.annotations.NotNull; @@ -48,13 +48,14 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class CuboidRegion extends AbstractRegion implements FlatRegion { - + //FAWE start private int minX; private int minY; private int minZ; private int maxX; private int maxY; private int maxZ; + //FAWE end private BlockVector3 pos1; private BlockVector3 pos2; @@ -100,7 +101,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { */ public void setPos1(BlockVector3 pos1) { this.pos1 = pos1; + //FAWE start recalculate(); + //FAWE end } /** @@ -119,7 +122,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { */ public void setPos2(BlockVector3 pos2) { this.pos2 = pos2; + //FAWE start recalculate(); + //FAWE end } /** @@ -129,8 +134,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { if (pos1 == null || pos2 == null) { return; } - pos1 = pos1.clampY(0, world == null ? 255 : world.getMaxY()); - pos2 = pos2.clampY(0, world == null ? 255 : world.getMaxY()); + pos1 = pos1.clampY(getWorldMinY(), getWorldMaxY()); + pos2 = pos2.clampY(getWorldMinY(), getWorldMaxY()); minX = Math.min(pos1.getX(), pos2.getX()); minY = Math.min(pos1.getY(), pos2.getY()); minZ = Math.min(pos1.getZ(), pos2.getZ()); @@ -322,6 +327,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { final int minZ = min.getBlockZ() >> ChunkStore.CHUNK_SHIFTS; final int size = (maxX - minX + 1) * (maxZ - minZ + 1); + //FAWE start return new AbstractSet() { @NotNull @Override @@ -408,10 +414,13 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } }; } + //FAWE end @Override public Set getChunkCubes() { + //FAWE start - BlockVectorSet instead of HashMap Set chunks = new BlockVectorSet(); + //FAWE end BlockVector3 min = getMinimumPoint(); BlockVector3 max = getMaximumPoint(); @@ -430,9 +439,12 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public boolean contains(BlockVector3 position) { + //FAWE start return contains(position.getX(), position.getY(), position.getZ()); + //FAWE end } + //FAWE start @Override public boolean contains(int x, int y, int z) { return x >= this.minX && x <= this.maxX && z >= this.minZ && z <= this.maxZ && y >= this.minY && y <= this.maxY; @@ -442,13 +454,17 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { public boolean contains(int x, int z) { return x >= this.minX && x <= this.maxX && z >= this.minZ && z <= this.maxZ; } + //FAWE end @Override public Iterator iterator() { + //FAWE start if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9) { return iterator_old(); } + //FAWE end return new Iterator() { + //FAWE start final MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0); private final BlockVector3 min = getMinimumPoint(); private final BlockVector3 max = getMaximumPoint(); @@ -566,6 +582,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } }; } + //FAWE end @Override public Iterable asFlatRegion() { @@ -621,11 +638,13 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new CuboidRegion(region.getMinimumPoint(), region.getMaximumPoint()); } + //FAWE start public static boolean contains(CuboidRegion region) { BlockVector3 min = region.getMinimumPoint(); BlockVector3 max = region.getMaximumPoint(); return region.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ()) && region.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ()); } + //FAWE end /** * Make a cuboid from the center. @@ -641,6 +660,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return new CuboidRegion(origin.subtract(size), origin.add(size)); } + //FAWE start public int getMinimumX() { return minX; } @@ -732,7 +752,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { char[] arr = set.load(layer); if (trimX || trimZ) { int indexY = 0; - for (int y = 0; y < 16; y++, indexY += 256) { + for (int y = world.getMinY(); y < 16; y++, indexY += world.getMaxY()) { int index; if (trimZ) { index = indexY; @@ -773,5 +793,6 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } return null; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java index cb3a4d818..d444d81f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java @@ -19,11 +19,11 @@ package com.sk89q.worldedit.regions; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector2; @@ -185,18 +185,11 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { @Override public int getMaximumY() { - int worldMax = world != null ? world.getMaxY() - 1 : 255; - if (maxY > worldMax) { - return maxY = worldMax; - } return maxY; } @Override public int getMinimumY() { - if (minY < 0) { - return minY = 0; - } return minY; } @@ -304,7 +297,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { /** * Checks to see if a point is inside this region. */ - /* Slow and unnecessary + /* FAWE start - Slow and unnecessary @Override public boolean contains(BlockVector3 position) { final int blockY = position.getBlockY(); @@ -339,6 +332,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { public boolean contains(BlockVector3 position) { return contains(position.getX(), position.getY(), position.getZ()); } + //FAWE end /** * Sets the height of the cylinder to fit the specified Y. @@ -413,6 +407,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { return new CylinderRegion(center, radiusVec, minY, maxY); } + //FAWE start @Override public void filter(final IChunk chunk, final Filter filter, final ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, boolean full) { @@ -426,4 +421,5 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { } super.filter(chunk, filter, block, get, set, full); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java index 448c1cf6d..72dd2ac7c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java @@ -20,11 +20,11 @@ package com.sk89q.worldedit.regions; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.math.BlockVector2; @@ -53,10 +53,12 @@ public class EllipsoidRegion extends AbstractRegion { */ private Vector3 radius; + //FAWE start private Vector3 radiusSqr; private Vector3 inverseRadius; private int radiusLengthSqr; private boolean sphere; + //FAWE end /** * Construct a new instance of this ellipsoid region. @@ -194,10 +196,12 @@ public class EllipsoidRegion extends AbstractRegion { */ public void setRadius(Vector3 radius) { this.radius = radius.add(0.5, 0.5, 0.5); + //FAWE start radiusSqr = radius.multiply(radius); radiusLengthSqr = (int) radiusSqr.getX(); this.sphere = radius.getY() == radius.getX() && radius.getX() == radius.getZ(); inverseRadius = Vector3.ONE.divide(radius); + //FAWE end } @Override @@ -224,6 +228,7 @@ public class EllipsoidRegion extends AbstractRegion { return chunks; } + //FAWE start @Override public boolean contains(int x, int y, int z) { int cx = x - center.getBlockX(); @@ -238,7 +243,7 @@ public class EllipsoidRegion extends AbstractRegion { } int cy = y - center.getBlockY(); int cy2 = cy * cy; - if (radiusSqr.getBlockY() < 255 && cy2 > radiusSqr.getBlockY()) { + if (radiusSqr.getBlockY() < world.getMaxY() && cy2 > radiusSqr.getBlockY()) { return false; } if (sphere) { @@ -250,13 +255,13 @@ public class EllipsoidRegion extends AbstractRegion { return cxd + cyd + czd <= 1; } - /* + /* FAWE start /* Slow and unnecessary @Override public boolean contains(BlockVector3 position) { return position.subtract(center).toVector3().divide(radius).lengthSq() <= 1; } - */ + */ @Override public boolean contains(BlockVector3 position) { @@ -279,6 +284,7 @@ public class EllipsoidRegion extends AbstractRegion { double czd = cz2 * inverseRadius.getZ(); return cxd + czd <= 1; } + //FAWE end /** * Returns string representation in the format @@ -300,6 +306,7 @@ public class EllipsoidRegion extends AbstractRegion { return (EllipsoidRegion) super.clone(); } + //FAWE start private void filterSpherePartial(int y1, int y2, int bx, int bz, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set) { int minSection = y1 >> 4; @@ -311,7 +318,7 @@ public class EllipsoidRegion extends AbstractRegion { filterSpherePartial(minSection, 0, 15, bx, bz, filter, block, get, set); } - if (yStart != 0) { + if (yStart != world.getMinY()) { filterSpherePartial(minSection, yStart, 15, bx, bz, filter, block, get, set); minSection++; } @@ -405,28 +412,28 @@ public class EllipsoidRegion extends AbstractRegion { int cy = center.getBlockY(); int diffYFull = MathMan.usqrt(diffY2); - int yBotFull = Math.max(0, cy - diffYFull); - int yTopFull = Math.min(255, cy + diffYFull); + int yBotFull = Math.max(world.getMinY(), cy - diffYFull); + int yTopFull = Math.min(world.getMaxY(), cy + diffYFull); if (yBotFull == yTopFull || yBotFull > yTopFull) { } // Set those layers filter(chunk, filter, block, get, set, yBotFull, yTopFull, full); - if (yBotFull == 0 && yTopFull == 255) { + if (yBotFull == world.getMinY() && yTopFull == world.getMaxY()) { return; } int diffYPartial = MathMan.usqrt(radiusLengthSqr - cxMin * cxMin - czMin * czMin); //Fill the remaining layers - if (yBotFull != 0) { - int yBotPartial = Math.max(0, cy - diffYPartial); + if (yBotFull != world.getMinY()) { + int yBotPartial = Math.max(world.getMinY(), cy - diffYPartial); filterSpherePartial(yBotPartial, yBotFull - 1, bx, bz, filter, block, get, set); } - if (yTopFull != 255) { - int yTopPartial = Math.min(255, cy + diffYPartial); + if (yTopFull != world.getMaxY()) { + int yTopPartial = Math.min(world.getMaxY(), cy + diffYPartial); filterSpherePartial(yTopFull + 1, yTopPartial, bx, bz, filter, block, get, set); } @@ -434,4 +441,5 @@ public class EllipsoidRegion extends AbstractRegion { super.filter(chunk, filter, block, get, set, full); } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index ca04fa030..9f08c0f39 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -291,6 +291,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { recalculate(); } + //FAWE start @Override public boolean contains(int targetX, int targetZ) { boolean inside = false; @@ -344,6 +345,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { return inside; } + //FAWE end @Override public boolean contains(BlockVector3 position) { @@ -501,6 +503,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { return points; } + //FAWE start @Override public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) { for (int x = bx; x <= tx; x++) { @@ -525,4 +528,5 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { } return true; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index efef13577..020f6e457 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -19,15 +19,15 @@ package com.sk89q.worldedit.regions; -import com.fastasyncworldedit.core.beta.Filter; -import com.fastasyncworldedit.core.beta.IBatchProcessor; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; -import com.fastasyncworldedit.core.beta.implementation.filter.block.ChunkFilterBlock; -import com.fastasyncworldedit.core.beta.implementation.processors.ProcessorScope; +import com.fastasyncworldedit.core.queue.Filter; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.fastasyncworldedit.core.object.FaweLimit; -import com.fastasyncworldedit.core.object.extent.SingleRegionExtent; +import com.fastasyncworldedit.core.extent.SingleRegionExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; @@ -45,7 +45,9 @@ import javax.annotation.Nullable; /** * Represents a physical shape. */ +//FAWE start - IBatchProcessor public interface Region extends Iterable, Cloneable, IBatchProcessor { +//FAWE end /** * Get the lower point of a region. @@ -61,9 +63,11 @@ public interface Region extends Iterable, Cloneable, IBatchProcess */ BlockVector3 getMaximumPoint(); + //FAWE start default BlockVector3 getDimensions() { return getMaximumPoint().subtract(getMinimumPoint()).add(1, 1, 1); } + //FAWE end /** * Get the center point of a region. @@ -157,20 +161,6 @@ public interface Region extends Iterable, Cloneable, IBatchProcess */ void shift(BlockVector3 change) throws RegionOperationException; - default boolean contains(int x, int y, int z) { - return contains(BlockVector3.at(x, y, z)); - } - - default boolean contains(int x, int z) { - return contains(BlockVector3.at(x, 0, z)); - } - - default boolean isGlobal() { - BlockVector3 pos1 = getMinimumPoint(); - BlockVector3 pos2 = getMaximumPoint(); - return pos1.getBlockX() == Integer.MIN_VALUE && pos1.getBlockZ() == Integer.MIN_VALUE && pos2.getBlockX() == Integer.MAX_VALUE && pos2.getBlockZ() == Integer.MAX_VALUE && pos1.getBlockY() <= 0 && pos2.getBlockY() >= 255; - } - /** * Returns true based on whether the region contains the point. * @@ -222,6 +212,21 @@ public interface Region extends Iterable, Cloneable, IBatchProcess */ List polygonize(int maxPoints); + //FAWE start + default boolean contains(int x, int y, int z) { + return contains(BlockVector3.at(x, y, z)); + } + + default boolean contains(int x, int z) { + return contains(BlockVector3.at(x, 0, z)); + } + + default boolean isGlobal() { + BlockVector3 pos1 = getMinimumPoint(); + BlockVector3 pos2 = getMaximumPoint(); + return pos1.getBlockX() == Integer.MIN_VALUE && pos1.getBlockZ() == Integer.MIN_VALUE && pos2.getBlockX() == Integer.MAX_VALUE && pos2.getBlockZ() == Integer.MAX_VALUE && pos1.getBlockY() <= 0 && pos2.getBlockY() >= 255; + } + default int getMinimumY() { return getMinimumPoint().getY(); } @@ -265,7 +270,6 @@ public interface Region extends Iterable, Cloneable, IBatchProcess for (int layer = minSection; layer <= maxSection; layer++) { filter(chunk, filter, block, get, set, layer, full); } - return; } default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, boolean full) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java index 1e666e9dd..dd4a37231 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.regions; -import com.fastasyncworldedit.core.beta.IChunk; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.IChunkSet; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.configuration.Caption; import com.google.common.collect.Iterators; import com.google.common.collect.Sets; @@ -146,6 +146,7 @@ public class RegionIntersection extends AbstractRegion { } + //FAWE start @Override public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) { for (Region region : regions) { @@ -237,4 +238,5 @@ public class RegionIntersection extends AbstractRegion { } return false; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java index 572abc6cf..1ae6815fc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java @@ -71,10 +71,12 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion region = new ConvexPolyhedralRegion(world); } + //FAWE start public ConvexPolyhedralRegionSelector(ConvexPolyhedralRegion region) { checkNotNull(region); this.region = region; } + //FAWE end /** * Create a new selector. @@ -277,8 +279,10 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion } } + //FAWE start @Override public List getVertices() { return new ArrayList<>(region.getVertices()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java index 14ec279e0..4d0fea61d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java @@ -316,8 +316,10 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion { return "cuboid"; } + //FAWE start @Override public List getVertices() { return Arrays.asList(position1, position2); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java index f728674d4..f6aa1b818 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java @@ -70,10 +70,12 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { this((World) null); } + //FAWE start public CylinderRegionSelector(CylinderRegion region) { checkNotNull(region); this.region = region; } + //FAWE end /** * Create a new region selector. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java index 4279f1516..2fb951786 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java @@ -69,9 +69,11 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { } + //FAWE start public Polygonal2DRegionSelector(Polygonal2DRegion region) { this.region = region; } + //FAWE end /** * Create a new selector from another one. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java index 56d5cb212..7e5457bef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java @@ -42,12 +42,14 @@ public abstract class ArbitraryBiomeShape { private final int cacheSizeY; private final int cacheSizeZ; + //FAWE start /** * Cache entries. * null = unknown * OUTSIDE = outside * else = inside */ + //FAWE end private final BiomeType[] cache; private final BitSet isCached; @@ -96,6 +98,7 @@ public abstract class ArbitraryBiomeShape { return cache[index]; } + //FAWE start private boolean isInsideCached(int x, int y, int z, BiomeType baseBiome) { final int index = (y - cacheOffsetY) + (z - cacheOffsetZ) * cacheSizeY + (x - cacheOffsetX) * cacheSizeY * cacheSizeZ; @@ -107,6 +110,7 @@ public abstract class ArbitraryBiomeShape { return cacheEntry != BiomeTypes.THE_VOID; } + //FAWE end private boolean isOutside(int x, int y, int z, BiomeType baseBiome) { return getBiomeCached(x, y, z, baseBiome) == null; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java index 1010aa356..40c397bc6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java @@ -23,14 +23,16 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.expression.ExpressionEnvironment; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableVector3; +import com.fastasyncworldedit.core.math.MutableVector3; import com.sk89q.worldedit.math.Vector3; public class WorldEditExpressionEnvironment implements ExpressionEnvironment { private final Vector3 unit; private final Vector3 zero2; + //FAWE start - MutableVector3 private Vector3 current = new MutableVector3(Vector3.ZERO); + //FAWE end private final Extent extent; public WorldEditExpressionEnvironment(EditSession editSession, Vector3 unit, Vector3 zero) { @@ -48,10 +50,6 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { return Vector3.at(x, y, z).multiply(unit).add(zero2).toBlockPoint(); } - public Vector3 toWorldRel(double x, double y, double z) { - return current.add(x, y, z); - } - @SuppressWarnings("deprecation") @Override public int getBlockType(double x, double y, double z) { @@ -88,10 +86,16 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment { return extent.getBlock(toWorld(x, y, z)).getBlockType().getLegacyCombinedId() & 0xF; } + //FAWE start public void setCurrentBlock(int x, int y, int z) { current.setComponents(x, y, z); } + public Vector3 toWorldRel(double x, double y, double z) { + return current.add(x, y, z); + } + //FAWe end + public void setCurrentBlock(Vector3 current) { this.current = current; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java index 800cb5ceb..ae41c2cba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Category.java @@ -19,10 +19,15 @@ package com.sk89q.worldedit.registry; +import com.fastasyncworldedit.core.registry.RegistryItem; + import java.util.HashSet; import java.util.Set; +//FAWE start - implements RegistryItem public abstract class Category implements RegistryItem { +//FAWE end + private final Set set = new HashSet<>(); protected final String id; private boolean empty = true; @@ -43,6 +48,7 @@ public abstract class Category implements RegistryItem { return this.set; } + //FAWE start private int internalId; @Override @@ -56,6 +62,7 @@ public abstract class Category implements RegistryItem { } protected abstract Set load(); + //FAWE end /** * Checks if this category contains {@code object}. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java index 3f8bca337..e915667f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.registry; +import com.fastasyncworldedit.core.registry.RegistryItem; import com.sk89q.worldedit.command.util.SuggestionHelper; import javax.annotation.Nullable; @@ -36,8 +37,10 @@ public final class NamespacedRegistry extends Registry { private static final String MINECRAFT_NAMESPACE = "minecraft"; private final Set knownNamespaces = new HashSet<>(); private final String defaultNamespace; + //FAWE start private final List values = new ArrayList<>(); private int lastInternalId = 0; + //FAWE end public NamespacedRegistry(final String name) { this(name, MINECRAFT_NAMESPACE); @@ -59,15 +62,18 @@ public final class NamespacedRegistry extends Registry { requireNonNull(key, "key"); final int i = key.indexOf(':'); checkState(i > 0, "key is not namespaced"); + //FAWE start if (value instanceof RegistryItem) { ((RegistryItem) value).setInternalId(lastInternalId++); } values.add(value); + //FAWE end final V registered = super.register(key, value); knownNamespaces.add(key.substring(0, i)); return registered; } + //FAWE start public V getByInternalId(int index) { try { return values.get(index); @@ -79,6 +85,7 @@ public final class NamespacedRegistry extends Registry { public int size() { return values.size(); } + //FAWE end /** * Get a set of the namespaces of all registered keys. @@ -105,7 +112,9 @@ public final class NamespacedRegistry extends Registry { return key; } + //FAWE start public Stream getSuggestions(String input) { return SuggestionHelper.getNamespacedRegistrySuggestions(this, input); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java index b4c4a800f..3b1d3aa0c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java @@ -43,9 +43,11 @@ public class Registry implements Iterable { return name; } + //FAWE start public Map getMap() { return map; } + //FAWE end @Nullable public V get(final String key) { @@ -62,9 +64,11 @@ public class Registry implements Iterable { return value; } + //FAWE start public void clear() { this.map.clear(); } + //FAWE end public Set keySet() { return Collections.unmodifiableSet(this.map.keySet()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java index fe782fff3..78f370516 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.registry.state; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.fastasyncworldedit.core.util.MathMan; import com.sk89q.worldedit.world.block.BlockTypesCache; import org.jetbrains.annotations.Nullable; @@ -29,10 +30,13 @@ import static com.google.common.base.Preconditions.checkState; public abstract class AbstractProperty implements Property { + //FAWE start private final PropertyKey key; + //FAWE end private String name; private final List values; + //FAWE start private final int bitMask; private final int bitMaskInverse; private final int bitOffset; @@ -45,6 +49,7 @@ public abstract class AbstractProperty implements Property { public AbstractProperty(final String name, final List values, int bitOffset) { this.name = name; this.values = values; + //FAWE end this.numBits = MathMan.log2nlz(values.size()); this.bitOffset = bitOffset + BlockTypesCache.BIT_OFFSET; this.bitMask = (((1 << numBits) - 1)) << this.bitOffset; @@ -52,6 +57,7 @@ public abstract class AbstractProperty implements Property { this.key = PropertyKey.getOrCreate(name); } + //FAWE start @Override public PropertyKey getKey() { return key; @@ -95,31 +101,13 @@ public abstract class AbstractProperty implements Property { public int getIndex(int state) { return (state & bitMask) >> bitOffset; } + //FAWE end @Override public List getValues() { return this.values; } - @Nullable - @Override - public T getValueFor(String string) throws IllegalArgumentException { - return (T) string; - } - - @Override - public String getName() { - return this.name; - } - - /** - * Internal method for name setting post-deserialise. Do not use. - */ - public void setName(final String name) { - checkState(this.name == null, "name already set"); - this.name = name; - } - @Override public String toString() { return getClass().getSimpleName() + "{name=" + name + "}"; @@ -130,6 +118,26 @@ public abstract class AbstractProperty implements Property { return name.hashCode(); } + @Override + public String getName() { + return this.name; + } + + //FAWE start + @Nullable + @Override + public T getValueFor(String string) throws IllegalArgumentException { + return (T) string; + } + + /** + * Internal method for name setting post-deserialise. Do not use. + */ + public void setName(final String name) { + checkState(this.name == null, "name already set"); + this.name = name; + } + @Override public boolean equals(Object obj) { if (!(obj instanceof Property)) { @@ -137,4 +145,5 @@ public abstract class AbstractProperty implements Property { } return getName().equals(((Property) obj).getName()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java index beb514f17..2a06a7390 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/BooleanProperty.java @@ -24,7 +24,8 @@ import javax.annotation.Nullable; public class BooleanProperty extends AbstractProperty { - private int defaultIndex; + //FAWE start + private final int defaultIndex; public BooleanProperty(final String name, final List values) { this(name, values, 0); @@ -56,6 +57,7 @@ public class BooleanProperty extends AbstractProperty { return -1; } } + //FAWE end @Nullable @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java index d265a4ed8..2a437144a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/DirectionalProperty.java @@ -28,12 +28,9 @@ import javax.annotation.Nullable; public class DirectionalProperty extends AbstractProperty { + //FAWE start private final int[] map; - public DirectionalProperty(final String name, final List values) { - this(name, values, 0); - } - private DirectionalProperty(final String name, final List values, int bitOffset) { super(name, values, bitOffset); this.map = new int[Direction.values().length]; @@ -61,6 +58,11 @@ public class DirectionalProperty extends AbstractProperty { } return getIndex(dir); } + //FAWE end + + public DirectionalProperty(final String name, final List values) { + this(name, values, 0); + } @Nullable @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java index 1041b8fc3..10d2763e7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/EnumProperty.java @@ -26,12 +26,15 @@ import javax.annotation.Nullable; public class EnumProperty extends AbstractProperty { - private Map offsets = new HashMap<>(); + //FAWE start + private final Map offsets = new HashMap<>(); + //FAWE end public EnumProperty(final String name, final List values) { this(name, values, 0); } + //FAWE start private EnumProperty(final String name, final List values, int bitOffset) { super(name, values, bitOffset); for (int i = 0; i < values.size(); i++) { @@ -51,6 +54,7 @@ public class EnumProperty extends AbstractProperty { Integer value = offsets.get(string); return value == null ? -1 : value; } + //FAWE end @Nullable @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java index 3177a577b..df8e2b8eb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/IntegerProperty.java @@ -27,12 +27,15 @@ import javax.annotation.Nullable; public class IntegerProperty extends AbstractProperty { + //FAWE start private final int[] map; + //FAWE end public IntegerProperty(final String name, final List values) { this(name, values, 0); } + //FAWE start private IntegerProperty(final String name, final List values, int bitOffset) { super(name, values, bitOffset); int max = Collections.max(values); @@ -73,6 +76,7 @@ public class IntegerProperty extends AbstractProperty { } */ // An exception will get thrown anyway if the property doesn't exist, so it's not really that important. Anyway, we can check the array instead of the string list + //FAWE end if (val > 0 && val >= map.length) { throw new IllegalArgumentException("Invalid int value: " + string + ". Must be in " + getValues().toString()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java index df69851b9..620b4ffd2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/Property.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.registry.state; +import com.fastasyncworldedit.core.registry.state.PropertyKey; + import java.util.List; import javax.annotation.Nullable; @@ -44,10 +46,6 @@ public interface Property { */ List getValues(); - default int getIndex(T value) { - return getValues().indexOf(value); - } - /** * Gets the value for the given string, or null. * @@ -58,6 +56,11 @@ public interface Property { @Nullable T getValueFor(String string) throws IllegalArgumentException; + //FAWE start + default int getIndex(T value) { + return getValues().indexOf(value); + } + default int getIndexFor(CharSequence string) throws IllegalArgumentException { return getIndex(getValueFor(string.toString())); } @@ -65,4 +68,5 @@ public interface Property { default PropertyKey getKey() { return PropertyKey.getOrCreate(getName()); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java index c74b594ef..ecfa5f220 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/ClipboardHolder.java @@ -63,6 +63,7 @@ public class ClipboardHolder { return clipboard; } + //FAWE start /** * Gets all currently held clipboards. * @return all clipboards being held. @@ -84,6 +85,7 @@ public class ClipboardHolder { public List getHolders() { return Collections.singletonList(this); } + //FAWE end /** * Set the transform. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java index 97ca107d3..5d6f5e6ec 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java @@ -83,7 +83,7 @@ public class PasteBuilder { * This provides a more flexible alternative to {@link #ignoreAirBlocks(boolean)}, for example * one might want to ignore structure void if copying a Minecraft Structure, etc. * - * @param sourceMask + * @param sourceMask the mask for the source * @return this builder instance */ public PasteBuilder maskSource(Mask sourceMask) { @@ -109,7 +109,7 @@ public class PasteBuilder { * Set whether the copy should include source entities. * Note that this is true by default for legacy reasons. * - * @param copyEntities + * @param copyEntities if entities should be copied * @return this builder instance */ public PasteBuilder copyEntities(boolean copyEntities) { @@ -120,17 +120,20 @@ public class PasteBuilder { /** * Set whether the copy should include source biomes (if available). * - * @param copyBiomes + * @param copyBiomes if biomes should be copied * @return this builder instance */ public PasteBuilder copyBiomes(boolean copyBiomes) { this.copyBiomes = copyBiomes; return this; } + + //FAWE start public PasteBuilder filter(RegionFunction function) { this.canApply = function; return this; } + //FAWE end /** * Build the operation. @@ -138,19 +141,24 @@ public class PasteBuilder { * @return the operation */ public Operation build() { + //FAWE start Extent extent = clipboard; if (!transform.isIdentity()) { extent = new BlockTransformExtent(extent, transform); } + //FAWE end ForwardExtentCopy copy = new ForwardExtentCopy(extent, clipboard.getRegion(), clipboard.getOrigin(), targetExtent, to); copy.setTransform(transform); + //FAWE start copy.setCopyingEntities(copyEntities); copy.setCopyingBiomes(copyBiomes && clipboard.hasBiomes()); if (this.canApply != null) { copy.setFilterFunction(this.canApply); } + //FAWE end if (ignoreAirBlocks) { + //FAWE start - respect clipboard sourceMask = MaskIntersection.of(sourceMask, new ExistingBlockMask(clipboard)); } if (targetExtent instanceof EditSession) { @@ -164,6 +172,7 @@ public class PasteBuilder { sourceMask = MaskIntersection.of(sourceMask, esSourceMask); } } + //FAWE end if (sourceMask != null && sourceMask != Masks.alwaysTrue()) { copy.setSourceMask(sourceMask); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 1e3841147..269c8911f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -71,7 +71,6 @@ public class SessionManager { private static final ListeningExecutorService executorService = MoreExecutors.listeningDecorator( EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 5, "WorldEdit Session Saver - %s")); private static final Logger LOGGER = LogManagerCompat.getLogger(); - private static boolean warnedInvalidTool; private final Timer timer = new Timer("WorldEdit Session Manager"); private final WorldEdit worldEdit; @@ -169,6 +168,7 @@ public class SessionManager { session.setConfiguration(config); session.setBlockChangeLimit(config.defaultChangeLimit); session.setTimeout(config.calculationTimeout); + //FAWE start /* try { if (owner.hasPermission("worldedit.selection.pos")) { @@ -184,6 +184,7 @@ public class SessionManager { } } */ + //FAWE end // Remember the session regardless of if it's currently active or not. // And have the SessionTracker FLUSH inactive sessions. @@ -328,8 +329,10 @@ public class SessionManager { stored.lastActive = now; if (stored.session.compareAndResetDirty()) { + //FAWE start // Don't save unless player disconnects // saveQueue.put(stored.key, stored.session); + //FAWE end } } else { if (now - stored.lastActive > EXPIRATION_GRACE) { @@ -350,7 +353,7 @@ public class SessionManager { @Subscribe public void onConfigurationLoad(ConfigurationLoadEvent event) { LocalConfiguration config = event.getConfiguration(); - File dir = new File(config.getWorkingDirectory(), "sessions"); + File dir = new File(config.getWorkingDirectoryPath().toFile(), "sessions"); store = new JsonFileSessionStore(dir); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java index 7dbc9b08b..25f8ae601 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/Request.java @@ -36,21 +36,26 @@ import java.util.concurrent.ConcurrentHashMap; public final class Request { private static final ThreadLocal threadLocal = ThreadLocal.withInitial(Request::new); + //FAWE start // TODO any better way to deal with this? private static final Map requests = new ConcurrentHashMap<>(); + //FAWE end @Nullable private World world; @Nullable - private Actor actor; - @Nullable private LocalSession session; @Nullable private EditSession editSession; + private boolean valid; + //FAWE start + @Nullable + private Actor actor; @Nullable private Extent extent; - private boolean valid; + //FAWE end + //FAWE start private Request() { requests.put(Thread.currentThread(), this); } @@ -58,6 +63,7 @@ public final class Request { public static Collection getAll() { return requests.values(); } + //FAWE end /** * Get the request world. @@ -78,6 +84,7 @@ public final class Request { this.world = world; } + //FAWE start public void setExtent(@Nullable Extent extent) { this.extent = extent; } @@ -104,6 +111,7 @@ public final class Request { public void setActor(@Nullable Actor actor) { this.actor = actor; } + //FAWE end /** * Get the request session. @@ -115,6 +123,7 @@ public final class Request { return session; } + //FAWE start /** * Get the request session. * @@ -123,6 +132,7 @@ public final class Request { public void setSession(@Nullable LocalSession session) { this.session = session; } + //FAWE end /** * Get the {@link EditSession}. @@ -158,7 +168,9 @@ public final class Request { public static void reset() { request().invalidate(); threadLocal.remove(); + //FAWE start requests.remove(Thread.currentThread()); + //FAWE end } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java index 685cec334..148936629 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestExtent.java @@ -90,10 +90,12 @@ public class RequestExtent implements Extent { return getExtent().getBiome(position); } + //FAWE start @Override public > boolean setBlock(BlockVector3 position, T block) throws WorldEditException { return getExtent().setBlock(position, block); } + //FAWE end @Override public > boolean setBlock(int x, int y, int z, T block) @@ -106,6 +108,7 @@ public class RequestExtent implements Extent { return getExtent().fullySupports3DBiomes(); } + //FAWE start @Override public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { return getExtent().setTile(x, y, z, tile); @@ -115,6 +118,7 @@ public class RequestExtent implements Extent { public boolean setBiome(BlockVector3 position, BiomeType biome) { return getExtent().setBiome(position, biome); } + //FAWE end @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java index 35c259f31..b9e4bb489 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java @@ -35,6 +35,7 @@ import javax.annotation.Nullable; */ public enum Direction { + //FAWE start - left, right NORTH(Vector3.at(0, 0, -1), Flag.CARDINAL, 3, 1), EAST(Vector3.at(1, 0, 0), Flag.CARDINAL, 0, 2), SOUTH(Vector3.at(0, 0, 1), Flag.CARDINAL, 1, 3), @@ -62,14 +63,18 @@ public enum Direction { ASCENDING_SOUTH(Vector3.at(0, 1, 1), Flag.ASCENDING_CARDINAL, 1 + 18, 3 + 18), ASCENDING_WEST(Vector3.at(-1, 1, 0), Flag.ASCENDING_CARDINAL, 2 + 18, 0 + 18), ; + //FAWE end private final Vector3 direction; private final int flags; + //FAWE start private final int left; private final int right; + //FAWE end private final BlockVector3 blockPoint; - private static HashMap map = new HashMap<>(); + //FAWE start + private static final HashMap map = new HashMap<>(); static { for (Direction dir : Direction.values()) { @@ -121,6 +126,7 @@ public enum Direction { public int getBlockZ() { return blockPoint.getZ(); } + //FAWE end /** * Return true if the direction is of a cardinal direction (north, west @@ -326,9 +332,13 @@ public enum Direction { public static int ORDINAL = 0x2; public static int SECONDARY_ORDINAL = 0x4; public static int UPRIGHT = 0x8; + //FAWE start public static int ASCENDING_CARDINAL = 0xF; + //FAWE end + //FAWE start - ASCENDING_CARDINAL public static int ALL = CARDINAL | ORDINAL | SECONDARY_ORDINAL | UPRIGHT | ASCENDING_CARDINAL; + //FAWE end private Flag() { } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Identifiable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Identifiable.java index 8866c2102..902854589 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Identifiable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Identifiable.java @@ -33,6 +33,8 @@ public interface Identifiable { */ UUID getUniqueId(); + //FAWE start UUID CONSOLE = UUID.fromString("a233eb4b-4cab-42cd-9fd9-7e7b9a3f74be"); UUID EVERYONE = UUID.fromString("1-1-3-3-7"); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java index 4dce38b99..0d44d1d70 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.util; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.math.Vector3Impl; +import com.fastasyncworldedit.core.math.Vector3Impl; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; @@ -36,7 +36,9 @@ import static com.google.common.base.Preconditions.checkNotNull; * {@link #equals(Object)} are subject to minor differences caused by * floating point errors.

*/ +//FAWE start - extends Vector3Impl public class Location extends Vector3Impl { +//FAWE end private final Extent extent; private final float pitch; @@ -127,7 +129,9 @@ public class Location extends Vector3Impl { * @param pitch the pitch, in degrees */ public Location(Extent extent, Vector3 position, float yaw, float pitch) { + //FAWE start super(position); + //FAWE end checkNotNull(extent); checkNotNull(position); this.extent = extent; @@ -293,6 +297,7 @@ public class Location extends Vector3Impl { return new Location(extent, position, yaw, pitch); } + //FAWE start @Override public Location clampY(int min, int max) { checkArgument(min <= max, "minimum cannot be greater than maximum"); if (getY() < min) { @@ -304,6 +309,7 @@ public class Location extends Vector3Impl { return this; } + //FAWE end @Override public boolean equals(Object o) { @@ -322,6 +328,7 @@ public class Location extends Vector3Impl { if (Double.doubleToLongBits(yaw) != Double.doubleToLongBits(location.yaw)) { return false; } + //FAWE start if (this.getX() != location.getX()) { return false; } @@ -334,6 +341,7 @@ public class Location extends Vector3Impl { if (!extent.equals(location.extent)) { return false; } + //FAWE end return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index d4c2f9f7d..218832d60 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -90,9 +90,6 @@ public class PropertiesConfiguration extends LocalConfiguration { profile = getBool("profile", profile); traceUnflushedSessions = getBool("trace-unflushed-sessions", traceUnflushedSessions); disallowedBlocks = getStringSet("disallowed-blocks", getDefaultDisallowedBlocks()); - disallowedBlocksMask = null; - allowedDataCycleBlocks = - new HashSet<>(getStringSet("limits.allowed-data-cycle-blocks", null)); defaultChangeLimit = getInt("default-max-changed-blocks", defaultChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); defaultVerticalHeight = getInt("default-vertical-height", defaultVerticalHeight); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/SideEffectSet.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/SideEffectSet.java index 6626bc2fd..c36f5740f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/SideEffectSet.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/SideEffectSet.java @@ -39,9 +39,11 @@ public class SideEffectSet { private final Set appliedSideEffects; private final boolean appliesAny; + //FAWE start private SideEffectSet() { this(ImmutableMap.of()); } + //FAWE end public SideEffectSet(Map sideEffects) { this.sideEffects = Maps.immutableEnumMap(sideEffects); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index 3095e2df8..9040a5c3a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -38,7 +38,9 @@ import javax.annotation.Nullable; */ public class TargetBlock { + //FAWE start - Extent > World private final Extent world; + //FAWE end private int maxDistance; private double checkDistance; @@ -74,15 +76,19 @@ public class TargetBlock { * @param checkDistance how often to check for blocks, the smaller the more precise */ public TargetBlock(Player player, int maxDistance, double checkDistance) { + //FAWE start this(player, player.getWorld(), maxDistance, checkDistance); + //FAWE end } + //FAWE start - Extend > World public TargetBlock(Player player, Extent extent, int maxDistance, double checkDistance) { this.world = player.getWorld(); this.setValues(player.getLocation().toVector(), player.getLocation().getYaw(), player.getLocation().getPitch(), maxDistance, 1.65, checkDistance); this.stopMask = new ExistingBlockMask(world); this.solidMask = new SolidBlockMask(world); } + //FAWE end /** * Set the mask used for determine where to stop traces. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index af84a67c7..a2a45ce00 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -40,7 +40,7 @@ import javax.annotation.Nullable; /** * Tree generator. */ -public class TreeGenerator { +public final class TreeGenerator { public enum TreeType { TREE("Oak tree", "oak", "tree", "regular"), @@ -171,7 +171,7 @@ public class TreeGenerator { */ @Nullable public static TreeType lookup(String name) { - return lookup.get(name.replace("_", "").toLowerCase(Locale.ROOT)); + return lookup.get(name.toLowerCase(Locale.ROOT)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index a1bd10721..f013cc488 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger; import java.io.IOException; import java.util.HashSet; +import java.util.Locale; /** * A less simple implementation of {@link LocalConfiguration} @@ -54,7 +55,7 @@ public class YAMLConfiguration extends LocalConfiguration { profile = config.getBoolean("debug", profile); traceUnflushedSessions = config.getBoolean("debugging.trace-unflushed-sessions", traceUnflushedSessions); - wandItem = convertLegacyItem(config.getString("wand-item", wandItem)); + wandItem = convertLegacyItem(config.getString("wand-item", wandItem)).toLowerCase(Locale.ROOT); defaultChangeLimit = Math.max(-1, config.getInt( "limits.max-blocks-changed.default", defaultChangeLimit)); @@ -81,7 +82,6 @@ public class YAMLConfiguration extends LocalConfiguration { butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius)); disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(getDefaultDisallowedBlocks()))); - disallowedBlocksMask = null; allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null)); registerHelp = config.getBoolean("register-help", true); @@ -100,7 +100,7 @@ public class YAMLConfiguration extends LocalConfiguration { useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides", useInventoryCreativeOverride); - navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)); + navigationWand = convertLegacyItem(config.getString("navigation-wand.item", navigationWand)).toLowerCase(Locale.ROOT); navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/auth/Subject.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/auth/Subject.java index 180b81525..35c3c3269 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/auth/Subject.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/auth/Subject.java @@ -48,6 +48,7 @@ public interface Subject { */ boolean hasPermission(String permission); + //FAWE start /** * Add and remove permissions from a subject to show and hide certain messages. * @@ -65,4 +66,5 @@ public interface Subject { } void setPermission(String permission, boolean value); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java index ae7ab5407..83215d7d6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/DoubleArrayList.java @@ -33,8 +33,8 @@ import java.util.NoSuchElementException; */ public class DoubleArrayList implements Iterable> { - private List listA = new ArrayList<>(); - private List listB = new ArrayList<>(); + private final List listA = new ArrayList<>(); + private final List listB = new ArrayList<>(); private boolean isReversed = false; /** @@ -102,8 +102,8 @@ public class DoubleArrayList implements Iterable> { public class ForwardEntryIterator> implements Iterator> { - private Iterator keyIterator; - private Iterator valueIterator; + private final Iterator keyIterator; + private final Iterator valueIterator; public ForwardEntryIterator(Iterator keyIterator, Iterator valueIterator) { this.keyIterator = keyIterator; @@ -132,8 +132,8 @@ public class DoubleArrayList implements Iterable> { public class ReverseEntryIterator> implements Iterator> { - private ListIterator keyIterator; - private ListIterator valueIterator; + private final ListIterator keyIterator; + private final ListIterator valueIterator; public ReverseEntryIterator(ListIterator keyIterator, ListIterator valueIterator) { this.keyIterator = keyIterator; @@ -160,8 +160,8 @@ public class DoubleArrayList implements Iterable> { * Class to masquerade as Map.Entry. */ public class Entry implements Map.Entry { - private A key; - private B value; + private final A key; + private final B value; private Entry(A key, B value) { this.key = key; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/LazyReference.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/LazyReference.java index 8463cac91..4af4ac72d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/LazyReference.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/LazyReference.java @@ -32,6 +32,7 @@ public class LazyReference { return new LazyReference<>(valueComputation); } + //FAWE start /** * Pre-computed reference, for setting a lazy reference field with a known value. * @@ -42,6 +43,7 @@ public class LazyReference { public static LazyReference computed(T value) { return new LazyReference<>(value); } + //FAWE end // Memory saving technique: hold the computation info in the same reference field that we'll // put the value into, so the memory possibly retained by those parts is GC'able as soon as @@ -62,9 +64,11 @@ public class LazyReference { this.value = new RefInfo<>(valueComputation); } + //FAWE start private LazyReference(T value) { this.value = value; } + //FAWE end // casts are safe, value is either RefInfo or T @SuppressWarnings("unchecked") diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java index b3a753318..34286db83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/eventbus/EventBus.java @@ -61,7 +61,7 @@ public final class EventBus { */ private final SubscriberFindingStrategy finder = new AnnotatedSubscriberFinder(); - private HierarchyCache flattenHierarchyCache = new HierarchyCache(); + private final HierarchyCache flattenHierarchyCache = new HierarchyCache(); /** * Registers the given handler for the given class to receive events. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java index 2438d8235..b9717c0d3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java @@ -30,9 +30,9 @@ import java.util.List; public class CommandListBox extends PaginationBox { - private List commands = Lists.newArrayList(); + private final List commands = Lists.newArrayList(); + private final String helpCommand; private boolean hideHelp; - private String helpCommand; /** * Create a new box. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java index 45811252a..585aa3a6f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/MessageBox.java @@ -35,8 +35,8 @@ public class MessageBox extends TextComponentProducer { private static final int GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH = 47; - private TextComponentProducer contents; - private TextColor borderColor; + private final TextComponentProducer contents; + private final TextColor borderColor; /** * Create a new box. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java index 5e61f5ce9..f0c3d0bcf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/PaginationBox.java @@ -78,11 +78,13 @@ public abstract class PaginationBox extends MessageBox { super(title, new TextComponentProducer()); if (pageCommand != null && !pageCommand.contains("%page%")) { + //FAWE start if (pageCommand.contains("-p ")) { pageCommand = pageCommand.replaceAll("-p [0-9]+", "-p %page%"); } else { pageCommand = pageCommand + " -p %page%"; } + //FAWE end } this.pageCommand = pageCommand; } @@ -171,6 +173,7 @@ public abstract class PaginationBox extends MessageBox { } } + //FAWE start public static class MergedPaginationBox extends PaginationBox { private final PaginationBox[] values; @@ -182,9 +185,11 @@ public abstract class PaginationBox extends MessageBox { @Override public Component getComponent(int number) { for (PaginationBox box : values) { + //FAWE start if (box == null) { continue; } + //FAWE end int size = box.getComponentsSize(); if (size > number) { return box.getComponent(number); @@ -198,12 +203,15 @@ public abstract class PaginationBox extends MessageBox { public int getComponentsSize() { int size = 0; for (PaginationBox box : values) { + //FAWE start if (box == null) { continue; } + //FAWE end size += box.getComponentsSize(); } return size; } } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SideEffectBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SideEffectBox.java index 78cc42a35..79fad489b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SideEffectBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/SideEffectBox.java @@ -41,12 +41,14 @@ public class SideEffectBox extends PaginationBox { private SideEffectSet sideEffectSet; private static List getSideEffects() { + //FAWE start if (sideEffects == null) { sideEffects = WorldEdit.getInstance().getPlatformManager().getSupportedSideEffects() .stream() .sorted(Comparator.comparing(Enum::name)) .collect(Collectors.toList()); } + //FAWE end return sideEffects; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveUnpacker.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveUnpacker.java new file mode 100644 index 000000000..9203c7543 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveUnpacker.java @@ -0,0 +1,122 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * 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 . + */ + +package com.sk89q.worldedit.util.io.file; + +import com.google.common.collect.ImmutableSet; +import com.google.common.hash.Hasher; +import com.google.common.hash.Hashing; +import com.google.common.io.ByteProcessor; +import com.google.common.io.ByteStreams; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.SeekableByteChannel; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public final class ArchiveUnpacker { + + private static final String UNPACK_FINISHED = ".unpack_finished"; + + private static final Lock lock = new ReentrantLock(); + + private final Path unpackDir; + + public ArchiveUnpacker(Path unpackDir) throws IOException { + this.unpackDir = unpackDir; + Files.createDirectories(unpackDir); + } + + public Path unpackArchive(URL archiveUrl) throws IOException { + String hash; + try (InputStream data = archiveUrl.openStream()) { + hash = ByteStreams.readBytes(data, new ByteProcessor() { + private final Hasher hasher = Hashing.crc32c().newHasher(); + + @Override + public boolean processBytes(byte[] buf, int off, int len) { + hasher.putBytes(buf, off, len); + return true; + } + + @Override + public String getResult() { + return hasher.hash().toString(); + } + }); + } + Path dest = unpackDir.resolve(hash); + if (Files.exists(dest.resolve(UNPACK_FINISHED))) { + // trust this, no other option :) + return dest; + } + lock.lock(); + try { + // check again after exclusive acquire + if (Files.exists(dest.resolve(UNPACK_FINISHED))) { + return dest; + } + try (InputStream in = archiveUrl.openStream(); + ZipInputStream zipReader = new ZipInputStream(in)) { + ZipEntry next; + while ((next = zipReader.getNextEntry()) != null) { + Path resolved = dest.resolve(next.getName()); + if (!resolved.startsWith(dest)) { + // bad entry + continue; + } + if (next.isDirectory()) { + Files.createDirectories( + resolved, + SafeFiles.getOwnerOnlyFileAttributes(AttributeTarget.DIRECTORY) + ); + } else { + try (SeekableByteChannel channel = Files.newByteChannel( + resolved, + ImmutableSet.of( + StandardOpenOption.CREATE, + StandardOpenOption.WRITE, + StandardOpenOption.TRUNCATE_EXISTING + ), + SafeFiles.getOwnerOnlyFileAttributes(AttributeTarget.FILE) + )) { + ByteStreams.copy( + Channels.newChannel(zipReader), + channel + ); + } + } + } + } + Files.createFile(dest.resolve(UNPACK_FINISHED)); + return dest; + } finally { + lock.unlock(); + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveNioSupport.java~18a55bc14... Add new experimental snapshot API (#524) b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/AttributeTarget.java similarity index 63% rename from worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveNioSupport.java~18a55bc14... Add new experimental snapshot API (#524) rename to worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/AttributeTarget.java index a50d1cf25..6f12c9492 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/ArchiveNioSupport.java~18a55bc14... Add new experimental snapshot API (#524) +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/AttributeTarget.java @@ -19,22 +19,6 @@ package com.sk89q.worldedit.util.io.file; -import java.io.IOException; -import java.nio.file.FileSystem; -import java.nio.file.Path; -import java.util.Optional; - -/** - * Something that can provide access to an archive file as a file system. - */ -public interface ArchiveNioSupport { - - /** - * Try to open the given archive as a file system. - * - * @param archive the archive to open - * @return the path for the root of the archive, if available - */ - Optional tryOpenAsDir(Path archive) throws IOException; - +public enum AttributeTarget { + FILE, DIRECTORY } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/SafeFiles.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/SafeFiles.java index 4d9e14931..61dad4039 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/SafeFiles.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/file/SafeFiles.java @@ -19,15 +19,20 @@ package com.sk89q.worldedit.util.io.file; -import org.jetbrains.annotations.Nullable; +import com.google.common.collect.ImmutableSet; import java.io.IOException; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.PosixFilePermissions; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Nullable; public class SafeFiles { @@ -141,6 +146,54 @@ public class SafeFiles { } } + private static final FileAttribute[] OWNER_ONLY_FILE_ATTRS; + private static final FileAttribute[] OWNER_ONLY_DIR_ATTRS; + + static { + if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { + OWNER_ONLY_FILE_ATTRS = new FileAttribute[] { + PosixFilePermissions.asFileAttribute( + ImmutableSet.of( + PosixFilePermission.OWNER_READ, + PosixFilePermission.OWNER_WRITE + ) + ) + }; + OWNER_ONLY_DIR_ATTRS = new FileAttribute[] { + PosixFilePermissions.asFileAttribute( + ImmutableSet.of( + PosixFilePermission.OWNER_READ, + PosixFilePermission.OWNER_WRITE, + PosixFilePermission.OWNER_EXECUTE + ) + ) + }; + } else { + OWNER_ONLY_FILE_ATTRS = new FileAttribute[0]; + OWNER_ONLY_DIR_ATTRS = new FileAttribute[0]; + } + } + + /** + * Get a set of file attributes for file creation with owner-only access, if possible. + * + *

+ * On POSIX, this returns o+rw (and o+x if directory), on Windows it returns nothing. + *

+ * + * @return the owner-only file attributes + */ + public static FileAttribute[] getOwnerOnlyFileAttributes(AttributeTarget attributeTarget) { + switch (attributeTarget) { + case FILE: + return OWNER_ONLY_FILE_ATTRS; + case DIRECTORY: + return OWNER_ONLY_DIR_ATTRS; + default: + throw new IllegalStateException("Unknown attribute target " + attributeTarget); + } + } + private SafeFiles() { } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java index 5cb0adbb9..74be79bfc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java @@ -217,13 +217,6 @@ public class HttpRequest implements Closeable { return conn.getResponseCode(); } - public String getSingleHeaderValue(String header) { - checkState(conn != null, "No connection has been made"); - - // maybe we should check for multi-header? - return conn.getHeaderField(header); - } - /** * Get the input stream. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java index 28d7380b2..a0e261451 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/ActorCallbackPaste.java @@ -72,7 +72,7 @@ public final class ActorCallbackPaste { AsyncCommandBuilder.wrap(task, sender) .registerWithSupervisor(supervisor, "Submitting content to a pastebin service.") - .sendMessageAfterDelay(Caption.of("worldedit.pastebin.uploading")) + .setDelayMessage(Caption.of("worldedit.pastebin.uploading")) .onSuccess((String) null, url -> sender.printInfo(successMessage.args(TextComponent.of(url.toString())).build())) .onFailure("Failed to submit paste", null) .buildAndExec(Pasters.getExecutor()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/LinkedFuture.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/LinkedFuture.java deleted file mode 100644 index 4db571854..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/LinkedFuture.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.sk89q.worldedit.util.task; - -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -public class LinkedFuture> implements Future { - private Future task; - - public LinkedFuture(Future task) { - this.task = task; - } - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - return task.cancel(mayInterruptIfRunning); - } - - @Override - public boolean isCancelled() { - return task.isCancelled(); - } - - @Override - public boolean isDone() { - return task.isDone(); - } - - @Override - public synchronized T get() throws InterruptedException, ExecutionException { - if (task != null) { - task = task.get(); - if (task != null) { - return (T) this; - } - } - return null; - } - - @Override - public synchronized T get(long timeout, @NotNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - if (task != null) { - task = task.get(timeout, unit); - if (task != null) { - return (T) this; - } - } - return null; - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java index 4d311ebbe..fe16819c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/TaskStateComparator.java @@ -31,7 +31,9 @@ public class TaskStateComparator implements Comparator> { public int compare(com.sk89q.worldedit.util.task.Task o1, Task o2) { int ordinal1 = o1.getState().ordinal(); int ordinal2 = o2.getState().ordinal(); + //FAWE start - use Integer#compare return Integer.compare(ordinal1, ordinal2); + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java index 7f76462c9..16f358ab2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java @@ -23,7 +23,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.function.mask.BlockMaskBuilder; +import com.fastasyncworldedit.core.function.mask.BlockMaskBuilder; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.math.BlockVector2; @@ -76,7 +76,9 @@ public abstract class AbstractWorld implements World { @Override public Mask createLiquidMask() { + //FAWE start - use BlockMaskBuilder return new BlockMaskBuilder().addTypes(BlockTypes.LAVA, BlockTypes.WATER).build(this); + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java index 198a78630..4a0a1047c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NbtValued.java @@ -43,9 +43,12 @@ public interface NbtValued { */ @Deprecated default boolean hasNbtData() { + //FAWE start - return & deprecation return getNbt() != null; + //FAWE end } + //FAWE start /** * Get the object's NBT data (tile entity data). The returned tag, if * modified in any way, should be sent to {@link #setNbtData(CompoundTag)} @@ -139,5 +142,6 @@ public interface NbtValued { default void setNbt(@Nullable CompoundBinaryTag nbtData) { setNbtReference(nbtData == null ? null : LazyReference.computed(nbtData)); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index dc6d4eaa4..3fdc12a14 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.world; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.blocks.NullChunkGet; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.blocks.NullChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.google.common.collect.ImmutableSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; @@ -160,6 +160,7 @@ public class NullWorld extends AbstractWorld { return BlockVector3.ZERO; } + //FAWE start @Override public void refreshChunk(int chunkX, int chunkZ) { @@ -169,6 +170,7 @@ public class NullWorld extends AbstractWorld { public IChunkGet get(int x, int z) { return NullChunkGet.getInstance(); } + //FAWE end @Override public BlockState getBlock(BlockVector3 position) { @@ -190,10 +192,12 @@ public class NullWorld extends AbstractWorld { return false; } + //FAWE start @Override public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { return false; } + //FAWE end @Override public BaseBlock getFullBlock(BlockVector3 position) { @@ -225,6 +229,7 @@ public class NullWorld extends AbstractWorld { return INSTANCE; } + //FAWE start @Override public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) { } @@ -236,4 +241,5 @@ public class NullWorld extends AbstractWorld { @Override public void flush() {} + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/RegenOptions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/RegenOptions.java index 6cf2b80b2..14a5c26e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/RegenOptions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/RegenOptions.java @@ -39,7 +39,9 @@ public abstract class RegenOptions { * @return the builder */ public static Builder builder() { + //FAWE start - biomeType return new AutoValue_RegenOptions.Builder().seed(OptionalLong.empty()).regenBiomes(false).biomeType(null); + //FAWE end } @AutoValue.Builder @@ -70,12 +72,14 @@ public abstract class RegenOptions { */ public abstract Builder regenBiomes(boolean regenBiomes); + //FAWE start /** * Defines the {@code BiomeType} the regenerator should use for regeneration. Defaults to {@code null}. * @param biomeType the {@code BiomeType} to be used for regeneration * @return this builder */ public abstract Builder biomeType(@Nullable BiomeType biomeType); + //FAWE end /** * Build the options object. @@ -107,10 +111,12 @@ public abstract class RegenOptions { return isRegenBiomes(); } + //FAWE start @Nullable public abstract BiomeType getBiomeType(); public boolean hasBiomeType() { return getBiomeType() != null; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index b39384370..8f4d88112 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -19,9 +19,9 @@ package com.sk89q.worldedit.world; -import com.fastasyncworldedit.core.beta.IChunkCache; -import com.fastasyncworldedit.core.beta.IChunkGet; -import com.fastasyncworldedit.core.beta.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; @@ -56,7 +56,9 @@ import javax.annotation.Nullable; /** * Represents a world (dimension). */ +//FAWE start - IChunkCache public interface World extends Extent, Keyed, IChunkCache { +//FAWE end /** * Get the name of the world. @@ -371,6 +373,7 @@ public interface World extends Extent, Keyed, IChunkCache { @Override int hashCode(); + //FAWE start @Override default boolean isWorld() { return true; @@ -414,4 +417,5 @@ public interface World extends Extent, Keyed, IChunkCache { } void flush(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java index c7fdf714a..fdb279fbc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java @@ -23,12 +23,14 @@ import com.sk89q.worldedit.function.pattern.BiomePattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; -import com.sk89q.worldedit.registry.RegistryItem; +import com.fastasyncworldedit.core.registry.RegistryItem; /** * All the types of biomes in the game. */ +//FAWE start - RegistryItem public class BiomeType implements RegistryItem, Keyed, BiomePattern { +//FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("biome type"); @@ -36,6 +38,7 @@ public class BiomeType implements RegistryItem, Keyed, BiomePattern { private int legacyId = -1; private int internalId; + //FAWE start public BiomeType(String id) { this.id = id; } @@ -57,6 +60,7 @@ public class BiomeType implements RegistryItem, Keyed, BiomePattern { public int getInternalId() { return internalId; } + //FAWE end /** * Gets the ID of this biome. @@ -75,7 +79,9 @@ public class BiomeType implements RegistryItem, Keyed, BiomePattern { @Override public int hashCode() { + //FAWE start - internalId > hashCode return this.internalId; // stop changing this + //FAWE end } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java index addfbd0d7..6e7960364 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java @@ -115,6 +115,15 @@ public final class BiomeTypes { private BiomeTypes() { } + /** + * Gets the {@link BiomeType} associated with the given id. + */ + @Nullable + public static BiomeType get(String id) { + return BiomeType.REGISTRY.get(id); + } + + //FAWE start private static BiomeType register(final String id) { return register(new BiomeType(id)); } @@ -136,14 +145,6 @@ public final class BiomeTypes { return BiomeType.REGISTRY.getByInternalId(internalId); } - /** - * Gets the {@link BiomeType} associated with the given id. - */ - @Nullable - public static BiomeType get(String id) { - return BiomeType.REGISTRY.get(id); - } - public static Collection values() { return BiomeType.REGISTRY.values(); } @@ -157,4 +158,5 @@ public final class BiomeTypes { } return maxBiomeId; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index bf1a0962f..de800e99d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.OutputExtent; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.util.nbt.TagStringIO; @@ -54,8 +54,11 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { private final BlockState blockState; @Nullable + //FAWE start - LR instead of CompoundTat private final LazyReference nbtData; + //FAWE end + //FAWE start /** * Construct a block with the given type and default data. * @deprecated Just use the BlockType.getDefaultState() @@ -65,7 +68,9 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { public BaseBlock(BlockType blockType) { this(blockType.getDefaultState()); } + //FAWE end + //FAWE start - made public from protected /** * Construct a block with a state. * @@ -75,7 +80,9 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { this.blockState = blockState; this.nbtData = null; } + //FAWE end + //FAWE start - deprecated upstream method and replaced CompoundTag with LR /** * Construct a block with the given ID, data value and NBT data structure. * @@ -86,6 +93,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { public BaseBlock(BlockState state, CompoundTag nbtData) { this(state, LazyReference.from(checkNotNull(nbtData)::asBinaryTag)); } + //FAWE end /** @@ -100,6 +108,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { this.nbtData = nbtData; } + //FAWE start /** * Construct a block with the given ID and data value. * @@ -118,6 +127,8 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { } return blockState; } + //FAWE end + /** * Gets a map of state to state values. * @@ -151,13 +162,16 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { @Override public String getNbtId() { + //FAWE start - LR > CompoundTag LazyReference nbtData = this.nbtData; if (nbtData == null) { return ""; } return nbtData.getValue().getString("id"); + //FAWE end } + //FAWE start @Nullable @Override public LazyReference getNbtReference() { @@ -168,6 +182,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { public void setNbtReference(@Nullable LazyReference nbtData) { throw new UnsupportedOperationException("This class is immutable."); } + //FAWE end /** * Checks whether the type ID and data value are equal. @@ -186,6 +201,7 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return this.blockState.equalsFuzzy(otherBlock.blockState) && Objects.equals(getNbt(), otherBlock.getNbt()); } + //FAWE start @Override public int getInternalId() { return blockState.getInternalId(); @@ -201,6 +217,12 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return blockState.getOrdinal(); } + @Override + public final char getOrdinalChar() { + return blockState.getOrdinalChar(); + } + //FAWE end + /** * Checks if the type is the same, and if the matched states are the same. * @@ -217,16 +239,12 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return this.blockState; } - @Override - public final char getOrdinalChar() { - return blockState.getOrdinalChar(); - } - @Override public BaseBlock toBaseBlock() { return this; } + //FAWE start @Override public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { set.setFullBlock(extent, this); @@ -277,16 +295,16 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return toImmutableState().getState(property); } - // Fawe start @Override public int hashCode() { return getOrdinal(); } - // Fawe end + //FAWE end @Override public String toString() { String nbtString = ""; + //FAWE start - use CBT CompoundBinaryTag nbtData = getNbt(); if (nbtData != null) { try { @@ -302,4 +320,5 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { public BlockState toBlockState() { return blockState; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java index 0c99fa704..ec79adeab 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -156,7 +156,9 @@ public final class BlockCategories { BlockCategory entry = BlockCategory.REGISTRY.get(id); if (entry == null) { BlockCategory blockCategory = new BlockCategory(id); + //FAWE start blockCategory.load(); + //FAWE end return blockCategory; } return entry; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java index cf8f5fe58..f3f1b2ffc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java @@ -32,7 +32,9 @@ import java.util.Set; * blocks such as wool into separate ids. */ public class BlockCategory extends Category implements Keyed { - private boolean[] flat_map; + //FAWE start + private boolean[] flatMap; + //FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block tag"); public BlockCategory(final String id) { @@ -45,15 +47,17 @@ public class BlockCategory extends Category implements Keyed { .queryCapability(Capability.GAME_HOOKS).getRegistries() .getBlockCategoryRegistry().getAll(this); + //FAWE start int max = -1; for (BlockType type : result) { max = Math.max(max, type.getInternalId()); } - this.flat_map = new boolean[max + 1]; + this.flatMap = new boolean[max + 1]; for (BlockType type : result) { - this.flat_map[type.getInternalId()] = true; + this.flatMap[type.getInternalId()] = true; } return result; + //FAWE end } /** @@ -64,7 +68,9 @@ public class BlockCategory extends Category implements Keyed { * @return If it's a part of this category */ public > boolean contains(B blockStateHolder) { + //FAWE start - use internal id int typeId = blockStateHolder.getBlockType().getInternalId(); - return flat_map.length > typeId && flat_map[typeId]; + return flatMap.length > typeId && flatMap[typeId]; + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index c60fa3a6f..a686599da 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -19,10 +19,12 @@ package com.sk89q.worldedit.world.block; -import com.fastasyncworldedit.core.beta.ITileInput; +import com.fastasyncworldedit.core.queue.ITileInput; import com.fastasyncworldedit.core.command.SuggestInputParseException; -import com.fastasyncworldedit.core.object.string.MutableCharSequence; +import com.fastasyncworldedit.core.util.MutableCharSequence; import com.fastasyncworldedit.core.util.StringMan; +import com.fastasyncworldedit.core.world.block.BlanketBaseBlock; +import com.fastasyncworldedit.core.world.block.CompoundInput; import com.google.common.base.Function; import com.google.common.collect.Maps; import com.sk89q.jnbt.CompoundTag; @@ -34,12 +36,12 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.extent.OutputExtent; import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.SingleBlockStateMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockStateMask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.world.registry.BlockMaterial; @@ -57,15 +59,19 @@ import javax.annotation.Nullable; */ @SuppressWarnings("unchecked") public class BlockState implements BlockStateHolder, Pattern { + + //FAWE start private final int internalId; private final int ordinal; private final char ordinalChar; - private final BlockType blockType; private BlockMaterial material; private final BaseBlock emptyBaseBlock; private CompoundInput compoundInput = CompoundInput.NULL; + //FAWE end + private final BlockType blockType; - protected BlockState(BlockType blockType, int internalId, int ordinal) { + //FAWE start + public BlockState(BlockType blockType, int internalId, int ordinal) { this.blockType = blockType; this.internalId = internalId; this.ordinal = ordinal; @@ -73,7 +79,7 @@ public class BlockState implements BlockStateHolder, Pattern { this.emptyBaseBlock = new BlanketBaseBlock(this); } - protected BlockState(BlockType blockType, int internalId, int ordinal, @NotNull CompoundTag tile) { + public BlockState(BlockType blockType, int internalId, int ordinal, @NotNull CompoundTag tile) { this.blockType = blockType; this.internalId = internalId; this.ordinal = ordinal; @@ -329,6 +335,7 @@ public class BlockState implements BlockStateHolder, Pattern { Map map = Maps.asMap(type.getPropertiesSet(), (Function) this::getState); return Collections.unmodifiableMap((Map, Object>) map); } + //FAWE end @Override public boolean equalsFuzzy(BlockStateHolder o) { @@ -361,11 +368,13 @@ public class BlockState implements BlockStateHolder, Pattern { return getState(getBlockType().getProperty(key)); } + //FAWE start @Deprecated @Override public CompoundTag getNbtData() { return getBlockType().getMaterial().isTile() ? getBlockType().getMaterial().getDefaultTile() : null; } + //FAWE end @Override public BaseBlock toBaseBlock(LazyReference compoundTag) { @@ -375,6 +384,7 @@ public class BlockState implements BlockStateHolder, Pattern { return new BaseBlock(this, compoundTag); } + //FAWE start @Override public int getInternalId() { return internalId; @@ -431,4 +441,5 @@ public class BlockState implements BlockStateHolder, Pattern { public BaseBlock toBaseBlock(ITileInput input, int x, int y, int z) { return compoundInput.get(this, input, x, y, z); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java index a51f69c1e..b555e518f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.world.block; -import com.fastasyncworldedit.core.beta.ITileInput; +import com.fastasyncworldedit.core.queue.ITileInput; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.extent.OutputExtent; @@ -28,7 +28,7 @@ import com.sk89q.worldedit.internal.util.DeprecationUtil; import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; @@ -37,7 +37,9 @@ import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; +//FAWE start - TileEntityBlock public interface BlockStateHolder> extends TileEntityBlock, Pattern { +//FAWE end /** * Get the block type. @@ -46,6 +48,7 @@ public interface BlockStateHolder> extends TileEnt */ BlockType getBlockType(); + //FAWE start /** * Magic number (legacy uses). */ @@ -77,6 +80,7 @@ public interface BlockStateHolder> extends TileEnt */ @Deprecated int getInternalPropertiesId(); + //FAWE end /** * Returns a BlockState with the given state and value applied. @@ -141,6 +145,7 @@ public interface BlockStateHolder> extends TileEnt */ BaseBlock toBaseBlock(); + //FAWE start /** * Gets a {@link BaseBlock} from this BlockStateHolder. * @@ -191,6 +196,7 @@ public interface BlockStateHolder> extends TileEnt default BaseBlock toBaseBlock(ITileInput input, int x, int y, int z) { throw new UnsupportedOperationException("State is immutable"); } + //FAWE end default String getAsString() { if (getStates().isEmpty()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 6ae60a706..c6b4f99e7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.NullExtent; -import com.sk89q.worldedit.function.mask.SingleBlockTypeMask; +import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; @@ -32,7 +32,7 @@ import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.world.item.ItemType; @@ -52,7 +52,9 @@ import javax.annotation.Nullable; import static com.google.common.base.Preconditions.checkArgument; +//FAWE start - Pattern public class BlockType implements Keyed, Pattern { +//FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block type"); private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -62,6 +64,7 @@ public class BlockType implements Keyed, Pattern { private final LazyReference emptyFuzzy = LazyReference.from(() -> new FuzzyBlockState(this)); + //FAWE start private final LazyReference legacyId = LazyReference.from(() -> computeLegacy(0)); private final LazyReference legacyData = LazyReference.from(() -> computeLegacy(1)); @@ -89,6 +92,7 @@ public class BlockType implements Keyed, Pattern { public int getMaxStateId() { return settings.permutations; } + //FAWE end /** * Gets the ID of this block. @@ -105,6 +109,7 @@ public class BlockType implements Keyed, Pattern { .getRegistries().getBlockRegistry().getRichName(this); } + //FAWE start public String getNamespace() { String id = getId(); int i = id.indexOf(':'); @@ -137,6 +142,7 @@ public class BlockType implements Keyed, Pattern { return defaultState; } */ + @Deprecated public BlockState withPropertyId(int propertyId) { if (settings.stateOrdinals == null) { @@ -157,6 +163,7 @@ public class BlockType implements Keyed, Pattern { public BlockState withStateId(int internalStateId) { // return this.withPropertyId(internalStateId >> BlockTypesCache.BIT_OFFSET); } + //FAWE end /** * Gets the properties of this BlockType in a {@code key->property} mapping. @@ -173,13 +180,17 @@ public class BlockType implements Keyed, Pattern { * @return the properties */ public List> getProperties() { - return this.settings.propertiesList; // stop changing this + //FAWE start - Don't use an ImmutableList here + return this.settings.propertiesList; + //FAWE end } + //FAWE start @Deprecated public Set> getPropertiesSet() { return this.settings.propertiesSet; } + //FAWE end /** * Gets a property by name. @@ -188,9 +199,12 @@ public class BlockType implements Keyed, Pattern { * @return The property */ public Property getProperty(String name) { - return (Property) this.settings.propertiesMap.get(name); // stop changing this (performance) + //FAWE start - use properties map + return (Property) this.settings.propertiesMap.get(name); + //FAWE end } + //FAWE start public boolean hasProperty(PropertyKey key) { int ordinal = key.getId(); return this.settings.propertiesMapArr.length > ordinal && this.settings.propertiesMapArr[ordinal] != null; @@ -203,6 +217,7 @@ public class BlockType implements Keyed, Pattern { return null; } } + //FAWE end /** * Gets the default state of this block type. @@ -210,7 +225,9 @@ public class BlockType implements Keyed, Pattern { * @return The default state */ public BlockState getDefaultState() { + //FAWE start - use settings return this.settings.defaultState; + //FAWE end } public FuzzyBlockState getFuzzyMatcher() { @@ -223,10 +240,12 @@ public class BlockType implements Keyed, Pattern { * @return All possible states */ public List getAllStates() { + //FAWE start - use ordinals if (settings.stateOrdinals == null) { return Collections.singletonList(getDefaultState()); } return IntStream.of(settings.stateOrdinals).filter(i -> i != -1).mapToObj(i -> BlockTypesCache.states[i]).collect(Collectors.toList()); + //FAWE end } /** @@ -234,7 +253,8 @@ public class BlockType implements Keyed, Pattern { * * @return The state, if it exists */ - public BlockState getState(Map, Object> key) { // + public BlockState getState(Map, Object> key) { + //FAWE start - use ids & btp (block type property) int id = getInternalId(); for (Map.Entry, Object> iter : key.entrySet()) { Property prop = iter.getKey(); @@ -250,6 +270,7 @@ public class BlockType implements Keyed, Pattern { id = btp.modify(id, btp.getValueFor((String) value)); } return withStateId(id); + //FAWE end } /** @@ -268,11 +289,13 @@ public class BlockType implements Keyed, Pattern { */ @Nullable public ItemType getItemType() { + //FAWE start - init this if (!initItemType) { initItemType = true; itemType = ItemTypes.get(this.id); } return itemType; + //FAWE end } /** @@ -281,7 +304,9 @@ public class BlockType implements Keyed, Pattern { * @return The material */ public BlockMaterial getMaterial() { + //FAWE start - use settings return this.settings.blockMaterial; + //FAWE end } /** @@ -293,8 +318,10 @@ public class BlockType implements Keyed, Pattern { */ @Deprecated public int getLegacyCombinedId() { + //FAWE start - use LegacyMapper Integer combinedId = LegacyMapper.getInstance().getLegacyCombined(this); return combinedId == null ? 0 : combinedId; + //FAWE end } /** @@ -306,7 +333,9 @@ public class BlockType implements Keyed, Pattern { */ @Deprecated public int getLegacyId() { + //FAWE start return computeLegacy(0); + //FAWE end } /** @@ -320,16 +349,21 @@ public class BlockType implements Keyed, Pattern { */ @Deprecated public int getLegacyData() { + //FAWE start return computeLegacy(1); + //FAWE end } private int computeLegacy(int index) { + //FAWE start if (this.legacyCombinedId == null) { this.legacyCombinedId = LegacyMapper.getInstance().getLegacyCombined(this.getDefaultState()); } return index == 0 ? legacyCombinedId >> 4 : legacyCombinedId & 15; + //FAWE end } + //FAWE start /** * The internal index of this type. * @@ -375,4 +409,5 @@ public class BlockType implements Keyed, Pattern { public SingleBlockTypeMask toMask(Extent extent) { return new SingleBlockTypeMask(extent, this); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeUtil.java deleted file mode 100644 index 546623c54..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypeUtil.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * 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 . - */ - -package com.sk89q.worldedit.world.block; - -import com.sk89q.worldedit.registry.state.PropertyGroup; -import com.sk89q.worldedit.registry.state.PropertyKey; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class BlockTypeUtil { - - public static double centralTopLimit(com.sk89q.worldedit.world.block.BlockType type) { - checkNotNull(type); - return centralTopLimit(type.getDefaultState()); - } - - public static double centralBottomLimit(BlockStateHolder block) { - checkNotNull(block); - BlockType type = block.getBlockType(); - switch (type.getInternalId()) { - case BlockID.CREEPER_WALL_HEAD: - case BlockID.DRAGON_WALL_HEAD: - case BlockID.PLAYER_WALL_HEAD: - case BlockID.ZOMBIE_WALL_HEAD: - return 0.25; - case BlockID.ACACIA_SLAB: - case BlockID.BIRCH_SLAB: - case BlockID.BRICK_SLAB: - case BlockID.COBBLESTONE_SLAB: - case BlockID.DARK_OAK_SLAB: - case BlockID.DARK_PRISMARINE_SLAB: - case BlockID.JUNGLE_SLAB: - case BlockID.NETHER_BRICK_SLAB: - case BlockID.OAK_SLAB: - case BlockID.PETRIFIED_OAK_SLAB: - case BlockID.PRISMARINE_BRICK_SLAB: - case BlockID.PRISMARINE_SLAB: - case BlockID.PURPUR_SLAB: - case BlockID.QUARTZ_SLAB: - case BlockID.RED_SANDSTONE_SLAB: - case BlockID.SANDSTONE_SLAB: - case BlockID.SPRUCE_SLAB: - case BlockID.STONE_BRICK_SLAB: - case BlockID.STONE_SLAB: { - String state = (String) block.getState(PropertyKey.TYPE); - if (state == null) { - return 0; - } - switch (state) { - case "top": - return 0.5; - case "double": - case "bottom": - default: - return 0; - } - } - case BlockID.ACACIA_TRAPDOOR: - case BlockID.BIRCH_TRAPDOOR: - case BlockID.DARK_OAK_TRAPDOOR: - case BlockID.IRON_TRAPDOOR: - case BlockID.JUNGLE_TRAPDOOR: - case BlockID.OAK_TRAPDOOR: - case BlockID.SPRUCE_TRAPDOOR: - if (block.getState(PropertyKey.OPEN) == Boolean.TRUE) { - return 1; - } else if ("bottom".equals(block.getState(PropertyKey.HALF))) { - return 0.8125; - } else { - return 0; - } - case BlockID.ACACIA_FENCE_GATE: - case BlockID.BIRCH_FENCE_GATE: - case BlockID.DARK_OAK_FENCE_GATE: - case BlockID.JUNGLE_FENCE_GATE: - case BlockID.OAK_FENCE_GATE: - case BlockID.SPRUCE_FENCE_GATE: - return block.getState(PropertyKey.OPEN) == Boolean.TRUE ? 1 : 0; - default: - if (type.getMaterial().isMovementBlocker()) { - return 0; - } - return 1; - } - } - - /** - * Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5. - * - * @param block the block - * @return the y offset - */ - public static double centralTopLimit(BlockStateHolder block) { - checkNotNull(block); - BlockType type = block.getBlockType(); - switch (type.getInternalId()) { - case BlockID.BLACK_BED: - case BlockID.BLUE_BED: - case BlockID.BROWN_BED: - case BlockID.CYAN_BED: - case BlockID.GRAY_BED: - case BlockID.GREEN_BED: - case BlockID.LIGHT_BLUE_BED: - case BlockID.LIGHT_GRAY_BED: - case BlockID.LIME_BED: - case BlockID.MAGENTA_BED: - case BlockID.ORANGE_BED: - case BlockID.PINK_BED: - case BlockID.PURPLE_BED: - case BlockID.RED_BED: - case BlockID.WHITE_BED: - case BlockID.YELLOW_BED: - return 0.5625; - case BlockID.BREWING_STAND: - return 0.875; - case BlockID.CAKE: - return (block.getState(PropertyKey.BITES) == (Integer) 6) ? 0 : 0.4375; - case BlockID.CAULDRON: - return 0.3125; - case BlockID.COCOA: - return 0.750; - case BlockID.ENCHANTING_TABLE: - return 0.75; - case BlockID.END_PORTAL_FRAME: - return block.getState(PropertyKey.EYE) == Boolean.TRUE ? 1 : 0.8125; - case BlockID.CREEPER_HEAD: - case BlockID.DRAGON_HEAD: - case BlockID.PISTON_HEAD: - case BlockID.PLAYER_HEAD: - case BlockID.ZOMBIE_HEAD: - return 0.5; - case BlockID.CREEPER_WALL_HEAD: - case BlockID.DRAGON_WALL_HEAD: - case BlockID.PLAYER_WALL_HEAD: - case BlockID.ZOMBIE_WALL_HEAD: - return 0.75; - case BlockID.ACACIA_FENCE: - case BlockID.BIRCH_FENCE: - case BlockID.DARK_OAK_FENCE: - case BlockID.JUNGLE_FENCE: - case BlockID.NETHER_BRICK_FENCE: - case BlockID.OAK_FENCE: - case BlockID.SPRUCE_FENCE: - return 1.5; - case BlockID.ACACIA_SLAB: - case BlockID.BIRCH_SLAB: - case BlockID.BRICK_SLAB: - case BlockID.COBBLESTONE_SLAB: - case BlockID.DARK_OAK_SLAB: - case BlockID.DARK_PRISMARINE_SLAB: - case BlockID.JUNGLE_SLAB: - case BlockID.NETHER_BRICK_SLAB: - case BlockID.OAK_SLAB: - case BlockID.PETRIFIED_OAK_SLAB: - case BlockID.PRISMARINE_BRICK_SLAB: - case BlockID.PRISMARINE_SLAB: - case BlockID.PURPUR_SLAB: - case BlockID.QUARTZ_SLAB: - case BlockID.RED_SANDSTONE_SLAB: - case BlockID.SANDSTONE_SLAB: - case BlockID.SPRUCE_SLAB: - case BlockID.STONE_BRICK_SLAB: - case BlockID.STONE_SLAB: { - String state = (String) block.getState(PropertyKey.TYPE); - if (state == null) { - return 0.5; - } - switch (state) { - case "bottom": - return 0.5; - case "top": - case "double": - return 1; - } - } - case BlockID.LILY_PAD: - return 0.015625; - case BlockID.REPEATER: - return 0.125; - case BlockID.SOUL_SAND: - return 0.875; - case BlockID.COBBLESTONE_WALL: - case BlockID.MOSSY_COBBLESTONE_WALL: - return 1.5; - case BlockID.FLOWER_POT: - return 0.375; - case BlockID.COMPARATOR: - return 0.125; - case BlockID.DAYLIGHT_DETECTOR: - return 0.375; - case BlockID.HOPPER: - return 0.625; - case BlockID.ACACIA_TRAPDOOR: - case BlockID.BIRCH_TRAPDOOR: - case BlockID.DARK_OAK_TRAPDOOR: - case BlockID.IRON_TRAPDOOR: - case BlockID.JUNGLE_TRAPDOOR: - case BlockID.OAK_TRAPDOOR: - case BlockID.SPRUCE_TRAPDOOR: - if (block.getState(PropertyKey.OPEN) == Boolean.TRUE) { - return 0; - } else if ("top".equals(block.getState(PropertyKey.HALF))) { - return 1; - } else { - return 0.1875; - } - case BlockID.ACACIA_FENCE_GATE: - case BlockID.BIRCH_FENCE_GATE: - case BlockID.DARK_OAK_FENCE_GATE: - case BlockID.JUNGLE_FENCE_GATE: - case BlockID.OAK_FENCE_GATE: - case BlockID.SPRUCE_FENCE_GATE: - return block.getState(PropertyKey.OPEN) == Boolean.TRUE ? 0 : 1.5; - default: - if (type.hasProperty(PropertyKey.LAYERS)) { - return PropertyGroup.LEVEL.get(block) * 0.0625; - } - if (!type.getMaterial().isMovementBlocker()) { - return 0; - } - return 1; - - } - } -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index 57f9d6aee..7bd2f92bf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.world.block; import com.fastasyncworldedit.core.command.SuggestInputParseException; -import com.fastasyncworldedit.core.object.string.JoinedCharSequence; +import com.fastasyncworldedit.core.util.JoinedCharSequence; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.world.registry.LegacyMapper; @@ -39,6 +39,7 @@ import javax.annotation.Nullable; */ @SuppressWarnings("unused") public final class BlockTypes { + //FAWE start - init // Doesn't really matter what the hardcoded values are, as FAWE will update it on load @Nullable public static final BlockType __RESERVED__ = init(); // Placeholder for null index (i.e. when block types are represented as primitives) @Nullable public static final BlockType ACACIA_BUTTON = init(); @@ -998,6 +999,7 @@ public final class BlockTypes { public static Set getNameSpaces() { return BlockTypesCache.$NAMESPACES; } + //FAWE end /** * Gets the {@link BlockType} associated with the given id. @@ -1007,6 +1009,7 @@ public final class BlockTypes { return BlockType.REGISTRY.get(id); } + //FAWE start @Nullable public static BlockType get(final CharSequence id) { return BlockType.REGISTRY.get(id.toString()); @@ -1030,5 +1033,6 @@ public final class BlockTypes { public static int size() { return BlockTypesCache.values.length; } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java index c5aa2732f..01079cb8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java @@ -1,6 +1,7 @@ package com.sk89q.worldedit.world.block; import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.world.block.BlockID; import com.google.common.primitives.Booleans; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEdit; @@ -8,7 +9,7 @@ import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockRegistry; import com.sk89q.worldedit.world.registry.Registries; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index 89958209e..6cb3a6595 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.world.block; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import java.util.Collections; import java.util.HashMap; @@ -33,10 +33,13 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * A Fuzzy BlockState. Used for partial matching. * + *

* Immutable, construct with {@link FuzzyBlockState.Builder}. + *

*/ public class FuzzyBlockState extends BlockState { + //FAWE start private final Map props; private final Map, Object> values; @@ -47,7 +50,9 @@ public class FuzzyBlockState extends BlockState { public FuzzyBlockState(BlockState state) { this(state, null); } + //FAWE end + //FAWE start - use internal ids private FuzzyBlockState(BlockState state, Map, Object> values) { super(state.getBlockType(), state.getInternalId(), state.getOrdinal()); if (values == null || values.isEmpty()) { @@ -62,6 +67,7 @@ public class FuzzyBlockState extends BlockState { } } + //FAWE end /** * Gets a full BlockState from this fuzzy one, filling in @@ -79,6 +85,7 @@ public class FuzzyBlockState extends BlockState { return state; } + //FAWE start @Override public boolean equalsFuzzy(BlockStateHolder o) { if (!getBlockType().equals(o.getBlockType())) { @@ -114,6 +121,7 @@ public class FuzzyBlockState extends BlockState { public Map, Object> getStates() { return values; } + //FAWE end /** * Gets an instance of a builder. @@ -124,18 +132,20 @@ public class FuzzyBlockState extends BlockState { return new Builder(); } + //FAWE start @Deprecated @Override public CompoundTag getNbtData() { return getBlockType().getMaterial().isTile() ? getBlockType().getMaterial().getDefaultTile() : null; } + //FAWE end /** * Builder for FuzzyBlockState */ public static class Builder { private BlockType type; - private Map, Object> values = new HashMap<>(); + private final Map, Object> values = new HashMap<>(); /** * The type of the Fuzzy BlockState diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java index bc1ca6fcd..d0af54b97 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.util.nbt.BinaryTagTypes; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.util.nbt.IntBinaryTag; import com.sk89q.worldedit.util.nbt.ListBinaryTag; -import com.sk89q.worldedit.util.nbt.NbtUtils; +import com.fastasyncworldedit.core.util.NbtUtils; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -41,7 +41,9 @@ import javax.annotation.Nullable; public class AnvilChunk implements Chunk { + //FAWE start - use CBT > CT private final CompoundBinaryTag rootTag; + //FAWE end private final byte[][] blocks; private final byte[][] blocksAdd; private final byte[][] data; @@ -51,6 +53,7 @@ public class AnvilChunk implements Chunk { private Map tileEntities; + //FAWE start /** * Construct the chunk with a compound tag. * @@ -58,9 +61,11 @@ public class AnvilChunk implements Chunk { * @throws DataException on a data error * @deprecated Use {@link #AnvilChunk(CompoundBinaryTag)} */ + @Deprecated public AnvilChunk(CompoundTag tag) throws DataException { this(tag.asBinaryTag()); } + //FAWE end /** * Construct the chunk with a compound tag. @@ -78,6 +83,7 @@ public class AnvilChunk implements Chunk { blocksAdd = new byte[16][16 * 16 * 8]; data = new byte[16][16 * 16 * 8]; + //FAWE start - use *BinaryTag > *Tag ListBinaryTag sections = NbtUtils.getChildTag(rootTag, "Sections", BinaryTagTypes.LIST); for (BinaryTag rawSectionTag : sections) { @@ -125,6 +131,7 @@ public class AnvilChunk implements Chunk { } } } + //FAWE end private int getBlockID(BlockVector3 position) throws DataException { int x = position.getX() - rootX * 16; @@ -190,6 +197,7 @@ public class AnvilChunk implements Chunk { * Used to load the tile entities. */ private void populateTileEntities() throws DataException { + //FAWE start - use *BinaryTag > *Tag ListBinaryTag tags = NbtUtils.getChildTag(rootTag, "TileEntities", BinaryTagTypes.LIST); tileEntities = new HashMap<>(); @@ -236,6 +244,7 @@ public class AnvilChunk implements Chunk { tileEntities.put(vec, values.build()); } } + //FAWE end /** * Get the map of tags keyed to strings for a block's tile entity data. May @@ -247,6 +256,7 @@ public class AnvilChunk implements Chunk { * @throws DataException thrown if there is a data error */ @Nullable + //FAWE start - use *BinaryTag > * Tag private CompoundBinaryTag getBlockTileEntity(BlockVector3 position) throws DataException { if (tileEntities == null) { populateTileEntities(); @@ -278,5 +288,6 @@ public class AnvilChunk implements Chunk { return state.toBaseBlock(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java index 91ebb9bbc..db9eb2daf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.util.nbt.BinaryTagTypes; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.util.nbt.IntBinaryTag; import com.sk89q.worldedit.util.nbt.ListBinaryTag; -import com.sk89q.worldedit.util.nbt.NbtUtils; +import com.fastasyncworldedit.core.util.NbtUtils; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -44,14 +44,17 @@ import javax.annotation.Nullable; */ public class AnvilChunk13 implements Chunk { + //FAWE start - CBT > CT private final CompoundBinaryTag rootTag; - private BlockState[][] blocks; - private int rootX; - private int rootZ; + //FAWE end + private final BlockState[][] blocks; + private final int rootX; + private final int rootZ; private Map tileEntities; + //FAWE start /** * Construct the chunk with a compound tag. * @@ -63,6 +66,7 @@ public class AnvilChunk13 implements Chunk { public AnvilChunk13(CompoundTag tag) throws DataException { this(tag.asBinaryTag()); } + //FAWE end /** * Construct the chunk with a compound tag. @@ -78,6 +82,7 @@ public class AnvilChunk13 implements Chunk { blocks = new BlockState[16][]; + //FAWE start - use *BinaryTag > *Tag ListBinaryTag sections = NbtUtils.getChildTag(rootTag, "Sections", BinaryTagTypes.LIST); for (BinaryTag rawSectionTag : sections) { @@ -124,6 +129,7 @@ public class AnvilChunk13 implements Chunk { } palette[paletteEntryId] = blockState; } + //FAWE end // parse block states long[] blockStatesSerialized = NbtUtils.getChildTag(sectionTag, "BlockStates", BinaryTagTypes.LONG_ARRAY).value(); @@ -181,6 +187,7 @@ public class AnvilChunk13 implements Chunk { if (rootTag.get("TileEntities") == null) { return; } + //FAWE start - use *BinaryTag > *Tag ListBinaryTag tags = NbtUtils.getChildTag(rootTag, "TileEntities", BinaryTagTypes.LIST); for (BinaryTag tag : tags) { @@ -197,6 +204,7 @@ public class AnvilChunk13 implements Chunk { BlockVector3 vec = BlockVector3.at(x, y, z); tileEntities.put(vec, t); } + //FAWE end } /** @@ -209,6 +217,7 @@ public class AnvilChunk13 implements Chunk { * @throws DataException thrown if there is a data error */ @Nullable + //FAWE start - use *BinaryTag > *Tag private CompoundBinaryTag getBlockTileEntity(BlockVector3 position) throws DataException { if (tileEntities == null) { populateTileEntities(); @@ -246,5 +255,6 @@ public class AnvilChunk13 implements Chunk { return state.toBaseBlock(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk16.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk16.java index 13e69458a..342b4f307 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk16.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk16.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.world.storage.InvalidFormatException; */ public class AnvilChunk16 extends AnvilChunk13 { + //FAWE start /** * Construct the chunk with a compound tag. * @@ -51,6 +52,7 @@ public class AnvilChunk16 extends AnvilChunk13 { public AnvilChunk16(CompoundBinaryTag tag) throws DataException { super(tag); } + //FAWE end @Override protected void readBlockStates(BlockState[] palette, long[] blockStatesSerialized, BlockState[] chunkSectionBlocks) throws InvalidFormatException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java index 83f695ed1..45dfd2f56 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.util.nbt.BinaryTagTypes; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.util.nbt.IntBinaryTag; import com.sk89q.worldedit.util.nbt.ListBinaryTag; -import com.sk89q.worldedit.util.nbt.NbtUtils; +import com.fastasyncworldedit.core.util.NbtUtils; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -43,7 +43,9 @@ import java.util.Map; */ public class OldChunk implements Chunk { + //FAWE start private final CompoundBinaryTag rootTag; + //FAWE end private final byte[] blocks; private final byte[] data; private final int rootX; @@ -51,7 +53,7 @@ public class OldChunk implements Chunk { private Map tileEntities; - + //FAWE start /** * Construct the chunk with a compound tag. * @@ -63,6 +65,7 @@ public class OldChunk implements Chunk { public OldChunk(CompoundTag tag) throws DataException { this(tag.asBinaryTag()); } + //FAWE end /** * Construct the chunk with a compound tag. @@ -70,6 +73,7 @@ public class OldChunk implements Chunk { * @param tag the tag * @throws DataException if there is an error getting the chunk data */ + //FAWE start - use *BinaryTag > *Tag public OldChunk(CompoundBinaryTag tag) throws DataException { rootTag = tag; @@ -209,5 +213,6 @@ public class OldChunk implements Chunk { return state.toBaseBlock(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java index ec6d04f9f..58d84e18d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java @@ -21,13 +21,15 @@ package com.sk89q.worldedit.world.entity; import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; -import com.sk89q.worldedit.registry.RegistryItem; +import com.fastasyncworldedit.core.registry.RegistryItem; +//FAWE start - implements RegistryItem public class EntityType implements RegistryItem, Keyed { +//FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("entity type"); - private String id; + private final String id; public EntityType(String id) { // If it has no namespace, assume minecraft. @@ -42,6 +44,7 @@ public class EntityType implements RegistryItem, Keyed { return this.id; } + //FAWE start private int internalId; @Override @@ -53,6 +56,7 @@ public class EntityType implements RegistryItem, Keyed { public int getInternalId() { return internalId; } + //FAWE end /** * Gets the name of this item, or the ID if the name cannot be found. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java index d613417d2..606032039 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java @@ -155,6 +155,7 @@ public final class EntityTypes { return EntityType.REGISTRY.get(id); } + //FAWE Start private static String convertEntityId(String id) { if (id.startsWith("minecraft:")) { id = id.substring(10); @@ -265,5 +266,6 @@ public final class EntityTypes { public static EntityType parse(String id) { return get(convertEntityId(id)); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java index 8f3e60ae3..ab3ec1989 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/fluid/FluidType.java @@ -21,17 +21,19 @@ package com.sk89q.worldedit.world.fluid; import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; -import com.sk89q.worldedit.registry.RegistryItem; +import com.fastasyncworldedit.core.registry.RegistryItem; /** * Minecraft now has a 'fluid' system. This is a * stub class to represent what it may be in the future. */ +//FAWE start - implements RegistryItem public class FluidType implements RegistryItem, Keyed { +//FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("fluid type"); - private String id; + private final String id; public FluidType(String id) { this.id = id; @@ -47,6 +49,7 @@ public class FluidType implements RegistryItem, Keyed { return this.id; } + //FAWE start private int internalId; //UNUSED @@ -60,6 +63,7 @@ public class FluidType implements RegistryItem, Keyed { public int getInternalId() { return internalId; } + //FAWE end @Override public String toString() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java index 987cbec1c..312caa3b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/gamemode/GameMode.java @@ -26,7 +26,7 @@ public class GameMode implements Keyed { public static final Registry REGISTRY = new Registry<>("game mode"); - private String id; + private final String id; public GameMode(String id) { this.id = id; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index 6dbe6c1bd..ef8bea2e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -25,7 +25,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; -import com.sk89q.worldedit.registry.RegistryItem; +import com.fastasyncworldedit.core.registry.RegistryItem; import com.sk89q.worldedit.util.GuavaUtil; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.formatting.text.Component; @@ -35,7 +35,9 @@ import com.sk89q.worldedit.world.registry.ItemMaterial; import javax.annotation.Nullable; +//FAWE start - implements RegistryItem public class ItemType implements RegistryItem, Keyed { +//FAWE end public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type"); @@ -57,9 +59,11 @@ public class ItemType implements RegistryItem, Keyed { WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getMaterial(this) ); + //FAWE start private BlockType blockType; private boolean initBlockType; private BaseItem defaultState; + //FAWE end public ItemType(String id) { // If it has no namespace, assume minecraft. @@ -74,6 +78,7 @@ public class ItemType implements RegistryItem, Keyed { return this.id; } + //FAWE start private int internalId; @Override @@ -89,6 +94,7 @@ public class ItemType implements RegistryItem, Keyed { public Component getRichName() { return richName.getValue(); } + //FAWE end /** * Gets the name of this item, or the ID if the name cannot be found. @@ -125,12 +131,14 @@ public class ItemType implements RegistryItem, Keyed { return this.blockType; } + //FAWE start public BaseItem getDefaultState() { if (defaultState == null) { this.defaultState = new BaseItemStack(this); } return this.defaultState; } + //FAWE end /** * Get the material for this ItemType. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java index 6bd091dc3..1afe9a6e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -19,8 +19,8 @@ package com.sk89q.worldedit.world.item; -import com.fastasyncworldedit.core.object.string.JoinedCharSequence; -import com.sk89q.worldedit.world.block.ItemTypesCache; +import com.fastasyncworldedit.core.util.JoinedCharSequence; +import com.fastasyncworldedit.core.world.block.ItemTypesCache; import com.sk89q.worldedit.world.registry.LegacyMapper; import java.lang.reflect.Field; @@ -35,6 +35,7 @@ import javax.annotation.Nullable; */ @SuppressWarnings("unused") public final class ItemTypes { + //FAWE start - init @Nullable public static final ItemType ACACIA_BOAT = init(); @Nullable public static final ItemType ACACIA_BUTTON = init(); @Nullable public static final ItemType ACACIA_DOOR = init(); @@ -1187,6 +1188,7 @@ public final class ItemTypes { } return get(input); } + //FAWE end /** * Gets the {@link ItemType} associated with the given id. @@ -1196,6 +1198,7 @@ public final class ItemTypes { return ItemType.REGISTRY.get(id); } + //FAWE start @Deprecated public static ItemType get(int ordinal) { return ItemType.REGISTRY.getByInternalId(ordinal); @@ -1208,4 +1211,5 @@ public final class ItemTypes { public static Collection values() { return ItemType.REGISTRY.values(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java index 875d654c1..64e801069 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java @@ -97,12 +97,6 @@ public interface BlockMaterial { */ int getLightValue(); - /** - * Get the opacity of the block. - * @return opacity - */ - int getLightOpacity(); - /** * Get whether this block breaks when it is pushed by a piston. * @@ -168,6 +162,13 @@ public interface BlockMaterial { */ boolean hasContainer(); + //FAWE start + /** + * Get the opacity of the block. + * @return opacity + */ + int getLightOpacity(); + /** * Gets whether the block is a tile entity. * @@ -188,4 +189,5 @@ public interface BlockMaterial { * @return or 0 */ int getMapColor(); + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index e7bad3d86..26ebf619d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -65,10 +65,12 @@ public interface BlockRegistry { @Nullable BlockMaterial getMaterial(BlockType blockType); + //FAWE start @Nullable default BlockMaterial getMaterial(BlockState state) { return getMaterial(state.getBlockType()); } + //FAWE end /** * Get an unmodifiable map of states for this block. @@ -86,10 +88,12 @@ public interface BlockRegistry { */ OptionalInt getInternalBlockStateId(BlockState state); + //FAWE start /** * Register all blocks. */ default Collection values() { return Collections.emptyList(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java index 9fdd1baad..3bf4633b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java @@ -82,6 +82,7 @@ public final class BundledBlockData { private void loadFromResource() throws IOException { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); + //FAWE start gsonBuilder.registerTypeAdapter(int.class, (JsonDeserializer) (json, typeOfT, context) -> { JsonPrimitive primitive = (JsonPrimitive) json; if (primitive.isString()) { @@ -93,6 +94,7 @@ public final class BundledBlockData { } return primitive.getAsInt(); }); + //FAWE end Gson gson = gsonBuilder.create(); URL url = null; final int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion(); @@ -162,9 +164,11 @@ public final class BundledBlockData { } public static class BlockEntry { + //FAWE start - made public public String id; public String localizedName; public SimpleBlockMaterial material = new SimpleBlockMaterial(); + //FAWE end } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index a5965f0db..2e497c765 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -53,6 +53,16 @@ public class BundledBlockRegistry implements BlockRegistry { ); } + @Nullable + @Override + @Deprecated + // dumb_intellij.jpg - Ok?? + @SuppressWarnings("deprecation") + public String getName(BlockType blockType) { + BundledBlockData.BlockEntry blockEntry = BundledBlockData.getInstance().findById(blockType.getId()); + return blockEntry != null ? blockEntry.localizedName : null; + } + @Nullable @Override public BlockMaterial getMaterial(BlockType blockType) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/EntityRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/EntityRegistry.java index af3b3f8f9..205a9df7c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/EntityRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/EntityRegistry.java @@ -39,15 +39,6 @@ public interface EntityRegistry { * @return the entity, which may be null if the entity does not exist */ @Nullable - default BaseEntity createFromId(String id) { - EntityType entType = EntityTypes.get(id); - return entType == null ? null : new BaseEntity(entType); - } + BaseEntity createFromId(String id); - /** - * Register all entities. - */ - default Collection registerEntities() { - return Collections.emptyList(); - } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 7458da4d9..483166f9c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -69,10 +69,12 @@ public interface ItemRegistry { @Nullable ItemMaterial getMaterial(ItemType itemType); + //FAWE start /** * Register all items. */ default Collection values() { return Collections.emptyList(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java index 4362d1140..ca25ba29e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java @@ -35,7 +35,7 @@ import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.registry.state.PropertyKey; +import com.fastasyncworldedit.core.registry.state.PropertyKey; import com.sk89q.worldedit.util.gson.VectorAdapter; import com.sk89q.worldedit.util.io.ResourceLoader; import com.sk89q.worldedit.world.DataFixer; @@ -60,15 +60,15 @@ public final class LegacyMapper { private static LegacyMapper INSTANCE; private final ResourceLoader resourceLoader; + //FAWE start private final Int2ObjectArrayMap blockStateToLegacyId4Data = new Int2ObjectArrayMap<>(); private final Int2ObjectArrayMap extraId4DataToStateId = new Int2ObjectArrayMap<>(); private final int[] blockArr = new int[4096]; private final BiMap itemMap = HashBiMap.create(); - private Map blockEntries = new HashMap<>(); + private final Map blockEntries = new HashMap<>(); + //FAWE end private final Map stringToBlockMap = new HashMap<>(); private final Multimap blockToStringMap = HashMultimap.create(); - private final Map stringToItemMap = new HashMap<>(); - private final Multimap itemToStringMap = HashMultimap.create(); /** * Create a new instance. @@ -107,11 +107,14 @@ public final class LegacyMapper { for (Map.Entry blockEntry : dataFile.blocks.entrySet()) { String id = blockEntry.getKey(); - Integer combinedId = getCombinedId(blockEntry.getKey()); final String value = blockEntry.getValue(); + //FAWE start + Integer combinedId = getCombinedId(blockEntry.getKey()); blockEntries.put(id, value); + //FAWE end BlockState state = null; + //FAWE start try { state = BlockState.get(null, blockEntry.getValue()); BlockType type = state.getBlockType(); @@ -120,11 +123,12 @@ public final class LegacyMapper { } } catch (InputParseException f) { BlockFactory blockFactory = WorldEdit.getInstance().getBlockFactory(); + //FAWE end // if fixer is available, try using that first, as some old blocks that were renamed share names with new blocks if (fixer != null) { try { - String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, value, 1631); + String newEntry = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, value, Constants.DATA_VERSION_MC_1_13_2); state = blockFactory.parseFromInput(newEntry, parserContext).toImmutableState(); } catch (InputParseException ignored) { } @@ -147,6 +151,7 @@ public final class LegacyMapper { stringToBlockMap.put(id, state); } } + //FAWE start if (state != null) { blockArr[combinedId] = state.getInternalId(); blockStateToLegacyId4Data.put(state.getInternalId(), (Integer) combinedId); @@ -164,6 +169,7 @@ public final class LegacyMapper { } } } + //FAWE end for (Map.Entry itemEntry : dataFile.items.entrySet()) { String id = itemEntry.getKey(); @@ -184,6 +190,7 @@ public final class LegacyMapper { } } + //FAWE start private int getCombinedId(String input) { String[] split = input.split(":"); return (Integer.parseInt(split[0]) << 4) + (split.length == 2 ? Integer.parseInt(split[1]) : 0); @@ -200,7 +207,9 @@ public final class LegacyMapper { } return itemMap.get(getCombinedId(input)); } + //FAWE end + //FAWE start - use internal ids public BlockState getBlockFromLegacy(String input) { if (input.startsWith("minecraft:")) { input = input.substring(10); @@ -212,6 +221,7 @@ public final class LegacyMapper { } return null; } + //FAWE end @Nullable public ItemType getItemFromLegacy(int legacyId, int data) { @@ -233,6 +243,7 @@ public final class LegacyMapper { } } + //FAWE start @Nullable public BlockState getBlockFromLegacy(int legacyId) { return getBlock(legacyId << 4); @@ -297,6 +308,7 @@ public final class LegacyMapper { public Integer getLegacyCombined(BlockType type) { return blockStateToLegacyId4Data.get(type.getDefaultState().getInternalId()); } + //FAWE end @Deprecated public int[] getLegacyFromBlock(BlockState blockState) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java index b6bdb6502..95743b80a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java @@ -50,6 +50,7 @@ public class PassthroughBlockMaterial implements BlockMaterial { return blockMaterial.isAir(); } + //FAWE start @Override public int getMapColor() { if (blockMaterial == null) { @@ -58,6 +59,7 @@ public class PassthroughBlockMaterial implements BlockMaterial { return blockMaterial.getMapColor(); } } + //FAWE end @Override public boolean isFullCube() { @@ -104,10 +106,12 @@ public class PassthroughBlockMaterial implements BlockMaterial { return blockMaterial.getLightValue(); } + //FAWE start @Override public int getLightOpacity() { return blockMaterial.getLightOpacity(); } + //FAWE end @Override public boolean isFragileWhenPushed() { @@ -154,6 +158,7 @@ public class PassthroughBlockMaterial implements BlockMaterial { return blockMaterial.hasContainer(); } + //FAWE start @Override public boolean isTile() { return blockMaterial.isTile(); @@ -163,4 +168,5 @@ public class PassthroughBlockMaterial implements BlockMaterial { public CompoundTag getDefaultTile() { return blockMaterial.getDefaultTile(); } + //FAWE end } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java index 4eeb5f139..bf1e7f6b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java @@ -42,16 +42,19 @@ class SimpleBlockMaterial implements BlockMaterial { private boolean replacedDuringPlacement; private boolean isTranslucent; private boolean hasContainer; + //FAWE start private int lightOpacity; private int mapColor; private boolean isTile; private CompoundTag tile = null; + //FAWE end @Override public boolean isAir() { return this.isAir; } + //FAWE start @Override public int getMapColor() { return mapColor; @@ -69,6 +72,7 @@ class SimpleBlockMaterial implements BlockMaterial { public void setLightOpacity(int lightOpacity) { this.lightOpacity = lightOpacity; } + //FAWE end public void setIsAir(boolean isAir) { this.isAir = isAir; @@ -232,6 +236,7 @@ class SimpleBlockMaterial implements BlockMaterial { return this.hasContainer; } + //FAWE start public void setIsTile(boolean isTile) { this.isTile = isTile; } @@ -249,6 +254,7 @@ class SimpleBlockMaterial implements BlockMaterial { public CompoundTag getDefaultTile() { return tile; } + //FAWE end public void setHasContainer(boolean hasContainer) { this.hasContainer = hasContainer; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java index c121260a3..fc7c36cb9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleItemMaterial.java @@ -21,8 +21,8 @@ package com.sk89q.worldedit.world.registry; public class SimpleItemMaterial implements ItemMaterial { - private int maxStackSize; - private int maxDamage; + private final int maxStackSize; + private final int maxDamage; public SimpleItemMaterial(int maxStackSize, int maxDamage) { this.maxStackSize = maxStackSize; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java index 0965dcf24..52d3b6fd8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.world.snapshot; -import com.fastasyncworldedit.core.object.collection.LocalBlockVectorSet; +import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.math.BlockVector2; @@ -43,7 +43,9 @@ import java.util.Set; */ public class SnapshotRestore { + //FAWE start - Set instead of ArrayList private final Map> neededChunks = new LinkedHashMap<>(); + //FAWE end private final ChunkStore chunkStore; private final EditSession editSession; private ArrayList missingChunks; @@ -129,7 +131,7 @@ public class SnapshotRestore { /** * Restores to world. * - * @throws MaxChangedBlocksException + * @throws MaxChangedBlocksException if the max block change limit is exceeded */ public void restore() throws MaxChangedBlocksException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/YYMMDDHHIISSParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/YYMMDDHHIISSParser.java index f7b5af070..49a8269aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/YYMMDDHHIISSParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/YYMMDDHHIISSParser.java @@ -27,7 +27,7 @@ import java.util.regex.Pattern; public class YYMMDDHHIISSParser implements SnapshotDateParser { - private Pattern datePattern = + private final Pattern datePattern = Pattern.compile("([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)[^0-9]?" + "([0-9]+)[^0-9]?([0-9]+)[^0-9]?([0-9]+)(\\..*)?"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java index cce124cf4..9d1f15256 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/experimental/SnapshotRestore.java @@ -127,7 +127,7 @@ public class SnapshotRestore { /** * Restores to world. * - * @throws MaxChangedBlocksException + * @throws MaxChangedBlocksException if the max block change limit is exceeded */ public void restore() throws MaxChangedBlocksException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java index 76a1c82b5..4b1a2f927 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStoreHelper.java @@ -97,7 +97,9 @@ public class ChunkStoreHelper { if (tag.getValue().containsKey("Sections") && dataVersion < currentDataVersion) { // only fix up MCA format, DFU doesn't support MCR chunks final DataFixer dataFixer = platform.getDataFixer(); if (dataFixer != null) { + //FAWE start - use Adventure tag = (CompoundTag) ((CompoundTag) AdventureNBTConverter.fromAdventure(dataFixer.fixUp(DataFixer.FixTypes.CHUNK, rootTag.asBinaryTag(), dataVersion))).getValue().get("Level"); + //FAWE end dataVersion = currentDataVersion; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/FileMcRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/FileMcRegionChunkStore.java index b9a045de4..2eb1f4c19 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/FileMcRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/FileMcRegionChunkStore.java @@ -30,7 +30,7 @@ import java.util.regex.Pattern; public class FileMcRegionChunkStore extends McRegionChunkStore { - private File path; + private final File path; /** * Create an instance. The passed path is the folder to read the diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java index 2a50f7ed2..69a531f3f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java @@ -92,7 +92,7 @@ public abstract class LegacyChunkStore extends ChunkStore { * @param f2 the second part of the path * @param name the name * @return an input stream - * @throws IOException + * @throws IOException if there is an error getting the chunk data */ protected abstract InputStream getInputStream(String f1, String f2, String name) throws IOException, DataException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java index 8daf257dc..4e284623d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java @@ -78,7 +78,7 @@ public abstract class McRegionChunkStore extends ChunkStore { * @param name the name of the chunk file * @param worldName the world name * @return an input stream - * @throws IOException + * @throws IOException if there is an error getting the chunk data */ protected abstract InputStream getInputStream(String name, String worldName) throws IOException, DataException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java index b441d4e14..6131be919 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java @@ -87,10 +87,9 @@ public class McRegionReader { * Construct the reader. * * @param stream the stream - * @throws DataException - * @throws IOException + * @throws IOException if there is an error getting the region data */ - public McRegionReader(InputStream stream) throws DataException, IOException { + public McRegionReader(InputStream stream) throws IOException { this.stream = new ForwardSeekableInputStream(stream); this.dataStream = new DataInputStream(this.stream); @@ -100,7 +99,7 @@ public class McRegionReader { /** * Read the header. * - * @throws IOException + * @throws IOException if there is an error getting the header data */ private void readHeader() throws IOException { offsets = new int[SECTOR_INTS]; @@ -116,8 +115,8 @@ public class McRegionReader { * * @param position chunk position * @return an input stream - * @throws IOException - * @throws DataException + * @throws IOException if there is an error getting the chunk data + * @throws DataException if there is an error getting the chunk data */ public synchronized InputStream getChunkInputStream(BlockVector2 position) throws IOException, DataException { int x = position.getBlockX() & 31; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java index cd5fac2a0..20a7ddb8f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedLegacyChunkStore.java @@ -45,6 +45,8 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore { * * @param zipFile the zip file * @param folder the folder + * @throws IOException if there is an error opening the zip + * @throws ZipException if there is an error opening the zip */ public ZippedLegacyChunkStore(File zipFile, String folder) throws IOException, ZipException { this.folder = folder; @@ -57,6 +59,8 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore { * be detected. * * @param zipFile the zip file + * @throws IOException if there is an error opening the zip + * @throws ZipException if there is an error opening the zip */ public ZippedLegacyChunkStore(File zipFile) throws IOException, ZipException { zip = new ZipFile(zipFile); @@ -69,6 +73,8 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore { * @param f2 the second part of the path * @param name the name of the file * @return an input stream + * @throws IOException if there is an error getting the chunk data + * @throws DataException if there is an error getting the chunk data */ @Override protected InputStream getInputStream(String f1, String f2, String name) throws IOException, DataException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java index 67f656071..030004ee3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ZippedMcRegionChunkStore.java @@ -48,6 +48,8 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { * * @param zipFile the ZIP file * @param folder the folder + * @throws IOException if there is an error opening the zip + * @throws ZipException if there is an error opening the zip */ public ZippedMcRegionChunkStore(File zipFile, String folder) throws IOException, ZipException { this.zipFile = zipFile; @@ -61,6 +63,8 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { * be detected. * * @param zipFile the ZIP file + * @throws IOException if there is an error opening the zip + * @throws ZipException if there is an error opening the zip */ public ZippedMcRegionChunkStore(File zipFile) throws IOException, ZipException { this.zipFile = zipFile; @@ -77,12 +81,18 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore { } } else { Pattern pattern = Pattern.compile(".*\\.mc[ra]$"); + Pattern worldPattern = Pattern.compile(worldName + "[\\\\/].*"); for (Enumeration e = zip.entries(); e.hasMoreElements(); ) { ZipEntry testEntry = e.nextElement(); // Check for world - if (testEntry.getName().startsWith(worldName + "/")) { - if (pattern.matcher(testEntry.getName()).matches()) { // does entry end in .mca - folder = testEntry.getName().substring(0, testEntry.getName().lastIndexOf('/')); + String entryName = testEntry.getName(); + if (worldPattern.matcher(entryName).matches()) { + if (pattern.matcher(entryName).matches()) { // does entry end in .mca + int endIndex = entryName.lastIndexOf('/'); + if (endIndex < 0) { + endIndex = entryName.lastIndexOf('\\'); + } + folder = entryName.substring(0, endIndex); if (folder.endsWith("poi")) { continue; } diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index e5a435fe9..1d3cb2537 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -252,6 +252,7 @@ "worldedit.tool.error.cannot-bind": "Can't bind tool to {0}: {1}", "worldedit.error.file-aborted": "File selection aborted.", "worldedit.error.world-unloaded": "The world was unloaded already.", + "worldedit.error.blocks-cant-be-used": "Blocks can't be used", "worldedit.brush.radius-too-large": "Maximum allowed brush radius: {0}", "worldedit.brush.apply.description": "Apply brush, apply a function to every block", @@ -278,7 +279,7 @@ "worldedit.setbiome.changed": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.", "worldedit.drawsel.disabled": "Server CUI disabled.", - "worldedit.drawsel.enabled": "Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32 on versions lower than 1.16, otherwise 48x48x48.", + "worldedit.drawsel.enabled": "Server CUI enabled. This only supports cuboid regions, with a maximum size of {0}x{1}x{2}.", "worldedit.drawsel.disabled.already": "Server CUI already disabled.", "worldedit.drawsel.enabled.already": "Server CUI already enabled.", "worldedit.limit.too-high": "Your maximum allowable limit is {0}.", @@ -380,8 +381,8 @@ "worldedit.pos.console-require-coords": "You must provide coordinates as console.", "worldedit.hpos.no-block": "No block in sight!", "worldedit.hpos.already-set": "Position already set.", - "worldedit.chunk.selected-multiple": "Chunks selected: ({0}, {1}) - ({2}, {3})", - "worldedit.chunk.selected": "Chunk selected: {0}, {1}", + "worldedit.chunk.selected-multiple": "Chunks selected: ({0}, {1}, {2}) - ({3}, {4}, {5})", + "worldedit.chunk.selected": "Chunk selected: {0}, {1}, {2}", "worldedit.wand.invalid": "Wand item is mis-configured or disabled.", "worldedit.wand.selwand.info": "Left click: select pos #1; Right click: select pos #2", "worldedit.wand.selwand.now.tool": "The selection wand is now a normal tool. You can disable it with {0} and rebind it to any item with {1} or get a new wand with {2}.", diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlatform.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlatform.java index c466cba48..8c9555f35 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlatform.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlatform.java @@ -189,12 +189,12 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform { return mod.getInternalVersion(); } - // FAWE start + //FAWE start @Override public String getId() { return "intellectualsites:fabric"; } - // FAWE end + //FAWE end @Override public Map getCapabilities() { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java index dd55d77d2..6e7edc987 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlatform.java @@ -195,12 +195,12 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform { return mod.getInternalVersion(); } - // FAWE start + //FAWE start @Override public String getId() { return "intellectualsites:forge"; } - // FAWE end + //FAWE end @Override public Map getCapabilities() { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java index 370fddbe9..077c408f0 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlatform.java @@ -184,12 +184,12 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform { return mod.getInternalVersion(); } - // FAWE start + //FAWE start @Override public String getId() { return "intellectualsites:sponge"; } - // FAWE end + //FAWE end @Override public Map getCapabilities() {