Update to 1.20.3

This commit is contained in:
tastybento 2023-12-06 13:45:44 -08:00
parent 6964f8c61a
commit af861f2a34
5 changed files with 34 additions and 42 deletions

View File

@ -73,7 +73,7 @@
<postgresql.version>42.2.18</postgresql.version> <postgresql.version>42.2.18</postgresql.version>
<hikaricp.version>5.0.1</hikaricp.version> <hikaricp.version>5.0.1</hikaricp.version>
<!-- More visible way to change dependency versions --> <!-- More visible way to change dependency versions -->
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version> <spigot.version>1.20.3-R0.1-SNAPSHOT</spigot.version>
<!-- Might differ from the last Spigot release for short periods <!-- Might differ from the last Spigot release for short periods
of time --> of time -->
<paper.version>1.20.2-R0.1-SNAPSHOT</paper.version> <paper.version>1.20.2-R0.1-SNAPSHOT</paper.version>

View File

@ -1,4 +1,4 @@
package world.bentobox.bentobox.nms.v1_20_R2; package world.bentobox.bentobox.nms.v1_20_R3;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -11,8 +11,8 @@ import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld; import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition; import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
@ -30,26 +30,18 @@ public class PasteHandlerImpl implements PasteHandler {
@Override @Override
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) { public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
return blockMap.entrySet().stream() return blockMap.entrySet().stream().map(entry -> setBlock(island, entry.getKey(), entry.getValue()))
.map(entry -> setBlock(island, entry.getKey(), entry.getValue())) .collect(Collectors.collectingAndThen(Collectors.toList(),
.collect( list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))));
Collectors.collectingAndThen(
Collectors.toList(),
list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))
)
);
} }
@Override @Override
public CompletableFuture<Void> pasteEntities(Island island, World world, Map<Location, List<BlueprintEntity>> entityMap) { public CompletableFuture<Void> pasteEntities(Island island, World world,
Map<Location, List<BlueprintEntity>> entityMap) {
return entityMap.entrySet().stream() return entityMap.entrySet().stream()
.map(entry -> DefaultPasteUtil.setEntity(island, entry.getKey(), entry.getValue())) .map(entry -> DefaultPasteUtil.setEntity(island, entry.getKey(), entry.getValue()))
.collect( .collect(Collectors.collectingAndThen(Collectors.toList(),
Collectors.collectingAndThen( list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))));
Collectors.toList(),
list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))
)
);
} }
/** /**

View File

@ -1,10 +1,10 @@
package world.bentobox.bentobox.nms.v1_20_R2; package world.bentobox.bentobox.nms.v1_20_R3;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld; import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition; import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World; import net.minecraft.world.level.World;
@ -12,13 +12,13 @@ import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk; import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.nms.CopyWorldRegenerator; import world.bentobox.bentobox.nms.CopyWorldRegenerator;
public class WorldRegeneratorImpl extends CopyWorldRegenerator { public class WorldRegeneratorImpl extends CopyWorldRegenerator {
private static final IBlockData AIR = ((CraftBlockData) Bukkit.createBlockData(Material.AIR)).getState(); private static final IBlockData AIR = ((CraftBlockData) Bukkit.createBlockData(Material.AIR)).getState();
@Override @Override
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, boolean applyPhysics) { public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData,
boolean applyPhysics) {
CraftBlockData craft = (CraftBlockData) blockData; CraftBlockData craft = (CraftBlockData) blockData;
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle(); World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ()); Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());

View File

@ -23,7 +23,8 @@ public class ServerCompatibility {
return instance; return instance;
} }
private ServerCompatibility() { } private ServerCompatibility() {
}
// ---- CONTENT ---- // ---- CONTENT ----
@ -70,14 +71,9 @@ public class ServerCompatibility {
* Any software that is not listed here is implicitly considered as "INCOMPATIBLE". * Any software that is not listed here is implicitly considered as "INCOMPATIBLE".
*/ */
public enum ServerSoftware { public enum ServerSoftware {
CRAFTBUKKIT(Compatibility.INCOMPATIBLE), CRAFTBUKKIT(Compatibility.INCOMPATIBLE), BUKKIT(Compatibility.INCOMPATIBLE),
BUKKIT(Compatibility.INCOMPATIBLE), GLOWSTONE(Compatibility.INCOMPATIBLE), SPIGOT(Compatibility.COMPATIBLE), PAPER(Compatibility.SUPPORTED),
GLOWSTONE(Compatibility.INCOMPATIBLE), PURPUR(Compatibility.SUPPORTED), TACOSPIGOT(Compatibility.NOT_SUPPORTED), AKARIN(Compatibility.NOT_SUPPORTED),
SPIGOT(Compatibility.COMPATIBLE),
PAPER(Compatibility.SUPPORTED),
PURPUR(Compatibility.SUPPORTED),
TACOSPIGOT(Compatibility.NOT_SUPPORTED),
AKARIN(Compatibility.NOT_SUPPORTED),
/** /**
* @since 1.14.0 * @since 1.14.0
*/ */
@ -120,9 +116,7 @@ public class ServerCompatibility {
* Any version that is not listed here is implicitly considered as "INCOMPATIBLE". * Any version that is not listed here is implicitly considered as "INCOMPATIBLE".
*/ */
public enum ServerVersion { public enum ServerVersion {
V1_13(Compatibility.INCOMPATIBLE), V1_13(Compatibility.INCOMPATIBLE), V1_13_1(Compatibility.INCOMPATIBLE), V1_13_2(Compatibility.INCOMPATIBLE),
V1_13_1(Compatibility.INCOMPATIBLE),
V1_13_2(Compatibility.INCOMPATIBLE),
/** /**
* @since 1.5.0 * @since 1.5.0
*/ */
@ -230,7 +224,10 @@ public class ServerCompatibility {
* @since 2.0.0 * @since 2.0.0
*/ */
V1_20_2(Compatibility.COMPATIBLE), V1_20_2(Compatibility.COMPATIBLE),
; /**
* @since 2.0.0
*/
V1_20_3(Compatibility.COMPATIBLE),;
private final Compatibility compatibility; private final Compatibility compatibility;
@ -287,12 +284,14 @@ public class ServerCompatibility {
return result; return result;
} }
if (software.getCompatibility().equals(Compatibility.NOT_SUPPORTED) || version.getCompatibility().equals(Compatibility.NOT_SUPPORTED)) { if (software.getCompatibility().equals(Compatibility.NOT_SUPPORTED)
|| version.getCompatibility().equals(Compatibility.NOT_SUPPORTED)) {
result = Compatibility.NOT_SUPPORTED; result = Compatibility.NOT_SUPPORTED;
return result; return result;
} }
if (software.getCompatibility().equals(Compatibility.SUPPORTED) || version.getCompatibility().equals(Compatibility.SUPPORTED)) { if (software.getCompatibility().equals(Compatibility.SUPPORTED)
|| version.getCompatibility().equals(Compatibility.SUPPORTED)) {
result = Compatibility.SUPPORTED; result = Compatibility.SUPPORTED;
return result; return result;
} }

View File

@ -53,7 +53,7 @@ import world.bentobox.bentobox.util.Util;
* *
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest( {BentoBox.class, Flags.class, Util.class, Bukkit.class} ) @PrepareForTest({ BentoBox.class, Flags.class, Util.class, Bukkit.class })
public class BreakBlocksListenerTest extends AbstractCommonSetup { public class BreakBlocksListenerTest extends AbstractCommonSetup {
private BreakBlocksListener bbl; private BreakBlocksListener bbl;
@ -104,7 +104,8 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
*/ */
@Test @Test
public void testOnBlockHarvestNotAllowed() { public void testOnBlockHarvestNotAllowed() {
when(island.isAllowed(any(), eq(Flags.HARVEST))).thenReturn(false); when(island.isAllowed(any(),
eq(Flags.HARVEST))).thenReturn(false);
Block block = mock(Block.class); Block block = mock(Block.class);
when(block.getType()).thenReturn(Material.PUMPKIN); when(block.getType()).thenReturn(Material.PUMPKIN);
when(block.getLocation()).thenReturn(location); when(block.getLocation()).thenReturn(location);
@ -217,6 +218,7 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
verify(notifier, never()).notify(any(), eq("protection.protected")); verify(notifier, never()).notify(any(), eq("protection.protected"));
} }
/** /**
* Test method for {@link world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener#onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent)}. * Test method for {@link world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener#onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent)}.
*/ */
@ -478,7 +480,6 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
assertFalse(e.isCancelled()); assertFalse(e.isCancelled());
} }
/** /**
* Test method for {@link world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. * Test method for {@link world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}.
*/ */