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>
<hikaricp.version>5.0.1</hikaricp.version>
<!-- 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
of time -->
<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.Map;
@ -11,8 +11,8 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;
@ -30,26 +30,18 @@ public class PasteHandlerImpl implements PasteHandler {
@Override
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
return blockMap.entrySet().stream()
.map(entry -> setBlock(island, entry.getKey(), entry.getValue()))
.collect(
Collectors.collectingAndThen(
Collectors.toList(),
list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))
)
);
return blockMap.entrySet().stream().map(entry -> setBlock(island, entry.getKey(), entry.getValue()))
.collect(Collectors.collectingAndThen(Collectors.toList(),
list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))));
}
@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()
.map(entry -> DefaultPasteUtil.setEntity(island, entry.getKey(), entry.getValue()))
.collect(
Collectors.collectingAndThen(
Collectors.toList(),
list -> CompletableFuture.allOf(list.toArray(new CompletableFuture[0]))
)
);
.collect(Collectors.collectingAndThen(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.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R2.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
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 world.bentobox.bentobox.nms.CopyWorldRegenerator;
public class WorldRegeneratorImpl extends CopyWorldRegenerator {
private static final IBlockData AIR = ((CraftBlockData) Bukkit.createBlockData(Material.AIR)).getState();
@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;
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());

View File

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

View File

@ -53,7 +53,7 @@ import world.bentobox.bentobox.util.Util;
*
*/
@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 {
private BreakBlocksListener bbl;
@ -104,7 +104,8 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
*/
@Test
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);
when(block.getType()).thenReturn(Material.PUMPKIN);
when(block.getLocation()).thenReturn(location);
@ -217,6 +218,7 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
assertFalse(e.isCancelled());
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)}.
*/
@ -478,7 +480,6 @@ public class BreakBlocksListenerTest extends AbstractCommonSetup {
assertFalse(e.isCancelled());
}
/**
* Test method for {@link world.bentobox.bentobox.listeners.flags.protection.BreakBlocksListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}.
*/