From 6b3d7a6ddec50cdd3383e670aba976fefc4a48bf Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 4 Dec 2024 19:29:59 -0800 Subject: [PATCH] Update to MC 1 21 4. Remove code for older versions. --- pom.xml | 6 +++ .../PasteHandlerImpl.java | 52 ------------------- .../WorldRegeneratorImpl.java | 26 ---------- .../PasteHandlerImpl.java | 51 ------------------ .../WorldRegeneratorImpl.java | 26 ---------- .../PasteHandlerImpl.java | 52 ------------------- .../WorldRegeneratorImpl.java | 26 ---------- .../PasteHandlerImpl.java | 6 +-- .../WorldRegeneratorImpl.java | 6 +-- .../versions/ServerCompatibility.java | 38 +++++++++----- 10 files changed, 36 insertions(+), 253 deletions(-) delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/PasteHandlerImpl.java delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/WorldRegeneratorImpl.java delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/PasteHandlerImpl.java delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/WorldRegeneratorImpl.java delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/PasteHandlerImpl.java delete mode 100644 src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/WorldRegeneratorImpl.java rename src/main/java/world/bentobox/bentobox/nms/{v1_20_4_R0_1_SNAPSHOT => v1_21_4_R0_1_SNAPSHOT}/PasteHandlerImpl.java (92%) rename src/main/java/world/bentobox/bentobox/nms/{v1_20_4_R0_1_SNAPSHOT => v1_21_4_R0_1_SNAPSHOT}/WorldRegeneratorImpl.java (84%) diff --git a/pom.xml b/pom.xml index 90bf01ed9..243d6dfbe 100644 --- a/pom.xml +++ b/pom.xml @@ -234,6 +234,12 @@ ${spigot.version} provided + + org.spigotmc...... + spigot + 1.21.4-R0.1-SNAPSHOT + provided + org.spigotmc..... spigot diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/PasteHandlerImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/PasteHandlerImpl.java deleted file mode 100644 index d9cc8f9f2..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/PasteHandlerImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_0_R0_1_SNAPSHOT; - -import java.util.concurrent.CompletableFuture; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.block.state.IBlockData; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock; -import world.bentobox.bentobox.database.objects.Island; -import world.bentobox.bentobox.nms.PasteHandler; -import world.bentobox.bentobox.util.DefaultPasteUtil; -import world.bentobox.bentobox.util.Util; - -public class PasteHandlerImpl implements PasteHandler { - - - protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState(); - - /** - * Set the block to the location - * - * @param island - island - * @param location - location - * @param bpBlock - blueprint block - */ - public CompletableFuture setBlock(Island island, Location location, BlueprintBlock bpBlock) { - return Util.getChunkAtAsync(location).thenRun(() -> { - Block block = location.getBlock(); - // Set the block data - default is AIR - BlockData bd = DefaultPasteUtil.createBlockData(bpBlock); - CraftBlockData craft = (CraftBlockData) bd; - net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4); - BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, AIR, false); - nmsChunk.a(bp, craft.getState(), false); - block.setBlockData(bd, false); - DefaultPasteUtil.setBlockState(island, block, bpBlock); - // Set biome - if (bpBlock.getBiome() != null) { - block.setBiome(bpBlock.getBiome()); - } - }); - } -} diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/WorldRegeneratorImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/WorldRegeneratorImpl.java deleted file mode 100644 index 6b85d7272..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_0_R0_1_SNAPSHOT/WorldRegeneratorImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_0_R0_1_SNAPSHOT; - -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.World; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.nms.CopyWorldRegenerator; - -public class WorldRegeneratorImpl extends CopyWorldRegenerator { - - @Override - public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, - boolean applyPhysics) { - CraftBlockData craft = (CraftBlockData) blockData; - World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ()); - BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics); - nmsChunk.a(bp, craft.getState(), applyPhysics); - } - -} \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/PasteHandlerImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/PasteHandlerImpl.java deleted file mode 100644 index 483025c52..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/PasteHandlerImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_1_R0_1_SNAPSHOT; - -import java.util.concurrent.CompletableFuture; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.block.state.IBlockData; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock; -import world.bentobox.bentobox.database.objects.Island; -import world.bentobox.bentobox.nms.PasteHandler; -import world.bentobox.bentobox.util.DefaultPasteUtil; -import world.bentobox.bentobox.util.Util; - -public class PasteHandlerImpl implements PasteHandler { - - protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState(); - - /** - * Set the block to the location - * - * @param island - island - * @param location - location - * @param bpBlock - blueprint block - */ - public CompletableFuture setBlock(Island island, Location location, BlueprintBlock bpBlock) { - return Util.getChunkAtAsync(location).thenRun(() -> { - Block block = location.getBlock(); - // Set the block data - default is AIR - BlockData bd = DefaultPasteUtil.createBlockData(bpBlock); - CraftBlockData craft = (CraftBlockData) bd; - net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4); - BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, AIR, false); - nmsChunk.a(bp, craft.getState(), false); - block.setBlockData(bd, false); - DefaultPasteUtil.setBlockState(island, block, bpBlock); - // Set biome - if (bpBlock.getBiome() != null) { - block.setBiome(bpBlock.getBiome()); - } - }); - } -} diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/WorldRegeneratorImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/WorldRegeneratorImpl.java deleted file mode 100644 index d15d4809b..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_1_R0_1_SNAPSHOT/WorldRegeneratorImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_1_R0_1_SNAPSHOT; - -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.World; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.nms.CopyWorldRegenerator; - -public class WorldRegeneratorImpl extends CopyWorldRegenerator { - - @Override - public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, - boolean applyPhysics) { - CraftBlockData craft = (CraftBlockData) blockData; - World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ()); - BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics); - nmsChunk.a(bp, craft.getState(), applyPhysics); - } - -} \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/PasteHandlerImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/PasteHandlerImpl.java deleted file mode 100644 index 49efdc370..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/PasteHandlerImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_6_R0_1_SNAPSHOT; - -import java.util.concurrent.CompletableFuture; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.block.state.IBlockData; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock; -import world.bentobox.bentobox.database.objects.Island; -import world.bentobox.bentobox.nms.PasteHandler; -import world.bentobox.bentobox.util.DefaultPasteUtil; -import world.bentobox.bentobox.util.Util; - -public class PasteHandlerImpl implements PasteHandler { - - protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState(); - - /** - * Set the block to the location - * - * @param island - island - * @param location - location - * @param bpBlock - blueprint block - */ - @Override - public CompletableFuture setBlock(Island island, Location location, BlueprintBlock bpBlock) { - return Util.getChunkAtAsync(location).thenRun(() -> { - Block block = location.getBlock(); - // Set the block data - default is AIR - BlockData bd = DefaultPasteUtil.createBlockData(bpBlock); - CraftBlockData craft = (CraftBlockData) bd; - net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4); - BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, AIR, false); - nmsChunk.a(bp, craft.getState(), false); - block.setBlockData(bd, false); - DefaultPasteUtil.setBlockState(island, block, bpBlock); - // Set biome - if (bpBlock.getBiome() != null) { - block.setBiome(bpBlock.getBiome()); - } - }); - } -} diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/WorldRegeneratorImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/WorldRegeneratorImpl.java deleted file mode 100644 index fbff31665..000000000 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_6_R0_1_SNAPSHOT/WorldRegeneratorImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package world.bentobox.bentobox.nms.v1_20_6_R0_1_SNAPSHOT; - -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData; - -import net.minecraft.core.BlockPosition; -import net.minecraft.world.level.World; -import net.minecraft.world.level.chunk.Chunk; -import world.bentobox.bentobox.nms.CopyWorldRegenerator; - -public class WorldRegeneratorImpl extends CopyWorldRegenerator { - - @Override - public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, - boolean applyPhysics) { - CraftBlockData craft = (CraftBlockData) blockData; - World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle(); - Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ()); - BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z); - // Setting the block to air before setting to another state prevents some console errors - nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics); - nmsChunk.a(bp, craft.getState(), applyPhysics); - } - -} \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/PasteHandlerImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/PasteHandlerImpl.java similarity index 92% rename from src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/PasteHandlerImpl.java rename to src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/PasteHandlerImpl.java index af6a83d7a..e0096f298 100644 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/PasteHandlerImpl.java +++ b/src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/PasteHandlerImpl.java @@ -1,12 +1,12 @@ -package world.bentobox.bentobox.nms.v1_20_4_R0_1_SNAPSHOT; +package world.bentobox.bentobox.nms.v1_21_4_R0_1_SNAPSHOT; import java.util.concurrent.CompletableFuture; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_21_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R3.block.data.CraftBlockData; import net.minecraft.core.BlockPosition; import net.minecraft.world.level.block.state.IBlockData; diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java b/src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java similarity index 84% rename from src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java rename to src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java index f259a92bb..ca4215070 100644 --- a/src/main/java/world/bentobox/bentobox/nms/v1_20_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java +++ b/src/main/java/world/bentobox/bentobox/nms/v1_21_4_R0_1_SNAPSHOT/WorldRegeneratorImpl.java @@ -1,8 +1,8 @@ -package world.bentobox.bentobox.nms.v1_20_4_R0_1_SNAPSHOT; +package world.bentobox.bentobox.nms.v1_21_4_R0_1_SNAPSHOT; import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_21_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R3.block.data.CraftBlockData; import net.minecraft.core.BlockPosition; import net.minecraft.world.level.World; diff --git a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java index 2b356e31e..a5566b07a 100644 --- a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java +++ b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java @@ -197,23 +197,23 @@ public enum ServerVersion { /** * @since 1.21.0 */ - V1_19(Compatibility.COMPATIBLE), + V1_19(Compatibility.INCOMPATIBLE), /** * @since 1.21.0 */ - V1_19_1(Compatibility.COMPATIBLE), + V1_19_1(Compatibility.INCOMPATIBLE), /** * @since 1.21.0 */ - V1_19_2(Compatibility.COMPATIBLE), + V1_19_2(Compatibility.INCOMPATIBLE), /** * @since 1.22.0 */ - V1_19_3(Compatibility.COMPATIBLE), + V1_19_3(Compatibility.INCOMPATIBLE), /** * @since 1.22.1 */ - V1_19_4(Compatibility.COMPATIBLE), + V1_19_4(Compatibility.INCOMPATIBLE), /** * @since 1.24.0 */ @@ -221,40 +221,50 @@ public enum ServerVersion { /** * @since 1.24.0 */ - V1_20_1(Compatibility.COMPATIBLE), + V1_20_1(Compatibility.INCOMPATIBLE), /** * @since 2.0.0 */ - V1_20_2(Compatibility.COMPATIBLE), + V1_20_2(Compatibility.INCOMPATIBLE), /** * @since 2.0.0 */ - V1_20_3(Compatibility.COMPATIBLE), + V1_20_3(Compatibility.INCOMPATIBLE), /** * @since 2.0.0 */ - V1_20_4(Compatibility.COMPATIBLE), + V1_20_4(Compatibility.INCOMPATIBLE), /** * @since 2.4.0 */ - V1_20_5(Compatibility.COMPATIBLE), + V1_20_5(Compatibility.INCOMPATIBLE), /** * @since 2.4.0 */ - V1_20_6(Compatibility.COMPATIBLE), + V1_20_6(Compatibility.INCOMPATIBLE), /** * @since 2.4.0 */ - V1_21(Compatibility.COMPATIBLE), + V1_21(Compatibility.INCOMPATIBLE), /** * @since 2.5.0 */ - V1_21_1(Compatibility.COMPATIBLE), + V1_21_1(Compatibility.INCOMPATIBLE), /** * @since 2.7.0 */ - V1_21_2(Compatibility.INCOMPATIBLE), V1_21_3(Compatibility.COMPATIBLE); + V1_21_2(Compatibility.INCOMPATIBLE), + + /** + * @since 3.0.0 + */ + V1_21_3(Compatibility.COMPATIBLE), + + /** + * @since 3.0.1 + */ + V1_21_4(Compatibility.COMPATIBLE),; private final Compatibility compatibility;