diff --git a/pom.xml b/pom.xml index 3193a6fae..96209f160 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 2.0.9 3.12.8 - 1.17-R0.1-SNAPSHOT + 1.18-R0.1-SNAPSHOT 1.16.5-R0.1-SNAPSHOT @@ -83,7 +83,7 @@ -LOCAL - 1.18.1 + 1.19.0 bentobox-world https://sonarcloud.io diff --git a/src/main/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommand.java index 0b8e726b2..8e0bed0b2 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommand.java @@ -9,6 +9,8 @@ import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; +import com.google.common.base.Enums; + import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; @@ -22,6 +24,8 @@ public class AdminRangeDisplayCommand extends CompositeCommand { private static final String DISPLAY = "display"; private static final String SHOW = "show"; private static final String HIDE = "hide"; + // Since 1.18, the Particle.BARRIER was replaced by BLOCK_MARKER + private static final Particle BARRIER = Enums.getIfPresent(Particle.class, "BARRIER").or(Enums.getIfPresent(Particle.class, "BLOCK_MARKER").or(Particle.LAVA)); // Map of users to which ranges must be displayed private final Map displayRanges = new HashMap<>(); @@ -46,15 +50,15 @@ public class AdminRangeDisplayCommand extends CompositeCommand { if (!displayRanges.containsKey(user)) { switch (label) { - case DISPLAY, SHOW -> showZones(user); - case HIDE -> user.sendMessage("commands.admin.range.display.already-off"); - default -> showHelp(this, user); + case DISPLAY, SHOW -> showZones(user); + case HIDE -> user.sendMessage("commands.admin.range.display.already-off"); + default -> showHelp(this, user); } } else { switch (label) { - case DISPLAY, HIDE -> hideZones(user); - case SHOW -> user.sendMessage("commands.admin.range.display.already-on"); - default -> showHelp(this, user); + case DISPLAY, HIDE -> hideZones(user); + case SHOW -> user.sendMessage("commands.admin.range.display.already-on"); + default -> showHelp(this, user); } } @@ -71,7 +75,7 @@ public class AdminRangeDisplayCommand extends CompositeCommand { getIslands().getIslandAt(user.getLocation()).ifPresent(island -> { // Draw the island protected area - drawZone(user, Particle.BARRIER, null, island, island.getProtectionRange()); + drawZone(user, BARRIER, null, island, island.getProtectionRange()); // Draw the default protected area if island protected zone is different if (island.getProtectionRange() != getPlugin().getIWM().getIslandProtectionRange(getWorld())) { diff --git a/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java b/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java index 47819492c..53143b804 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java +++ b/src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java @@ -39,12 +39,12 @@ public class BlockEndDragon implements Listener { World w = location.getWorld(); if (w == null || !plugin.getIWM().isIslandEnd(w) || !Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(w) - || w.getBlockAt(0, 255, 0).getType().equals(Material.END_PORTAL)) { + || w.getBlockAt(0, w.getMaxHeight() - 1, 0).getType().equals(Material.END_PORTAL)) { return; } // Setting a End Portal at the top will trick dragon legacy check. - w.getBlockAt(0, 255, 0).setType(Material.END_PORTAL, false); + w.getBlockAt(0, w.getMaxHeight() - 1, 0).setType(Material.END_PORTAL, false); } /** @@ -68,9 +68,9 @@ public class BlockEndDragon implements Listener { } private boolean testBlock(Block block) { - return block.getY() == 255 - && block.getX() == 0 + return block.getX() == 0 && block.getZ() == 0 + && block.getY() == block.getWorld().getMaxHeight() - 1 && block.getWorld().getEnvironment().equals(Environment.THE_END) && Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(block.getWorld()) && plugin.getIWM().inWorld(block.getWorld()) diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/settings/PVPListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/settings/PVPListener.java index 28228bfa2..95cf5ee01 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/settings/PVPListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/settings/PVPListener.java @@ -225,8 +225,8 @@ public class PVPListener extends FlagListener { String message = "protection.flags." + flag.getID() + "." + (e.isSetTo() ? "enabled" : "disabled"); // Send the message to visitors e.getIsland().getVisitors().forEach(visitor -> User.getInstance(visitor).sendMessage(message)); - // Send the message to island members (and coops and trusted) - e.getIsland().getMemberSet(RanksManager.COOP_RANK).forEach(member -> User.getInstance(member).sendMessage(message)); + // Send the message to players on the island + e.getIsland().getPlayersOnIsland().forEach(player -> User.getInstance(player).sendMessage(message)); } } diff --git a/src/main/java/world/bentobox/bentobox/nms/v1_17_R1/NMSHandler.java b/src/main/java/world/bentobox/bentobox/nms/v1_18_R1/NMSHandler.java similarity index 73% rename from src/main/java/world/bentobox/bentobox/nms/v1_17_R1/NMSHandler.java rename to src/main/java/world/bentobox/bentobox/nms/v1_18_R1/NMSHandler.java index 7d807f559..f0585bde3 100644 --- a/src/main/java/world/bentobox/bentobox/nms/v1_17_R1/NMSHandler.java +++ b/src/main/java/world/bentobox/bentobox/nms/v1_18_R1/NMSHandler.java @@ -1,10 +1,10 @@ -package world.bentobox.bentobox.nms.v1_17_R1; +package world.bentobox.bentobox.nms.v1_18_R1; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData; import net.minecraft.core.BlockPosition; import net.minecraft.world.level.World; @@ -21,11 +21,11 @@ public class NMSHandler implements NMSAbstraction { 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.getChunkAt(chunk.getX(), chunk.getZ()); + 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.setType(bp, AIR, applyPhysics, true); - nmsChunk.setType(bp, craft.getState(), applyPhysics, true); + nmsChunk.a(bp, AIR, applyPhysics); + nmsChunk.a(bp, craft.getState(), applyPhysics); } } \ No newline at end of file diff --git a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java index d29b4b849..cc2ff5bc8 100644 --- a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java +++ b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java @@ -176,16 +176,24 @@ public class ServerCompatibility { /** * @since 1.16.0 */ - V1_16_5(Compatibility.INCOMPATIBLE), + V1_16_5(Compatibility.NOT_SUPPORTED), /** * @since 1.17.0 */ - V1_17(Compatibility.COMPATIBLE), + V1_17(Compatibility.NOT_SUPPORTED), /** * @since 1.17.1 */ - V1_17_1(Compatibility.COMPATIBLE) + V1_17_1(Compatibility.SUPPORTED), + /** + * @since 1.19.0 + */ + V1_18(Compatibility.COMPATIBLE), + /** + * @since 1.19.0 + */ + V1_18_1(Compatibility.COMPATIBLE), ; private final Compatibility compatibility; diff --git a/src/test/java/world/bentobox/bentobox/listeners/BlockEndDragonTest.java b/src/test/java/world/bentobox/bentobox/listeners/BlockEndDragonTest.java index 11ad13ffb..3d41bcd81 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/BlockEndDragonTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/BlockEndDragonTest.java @@ -96,6 +96,7 @@ public class BlockEndDragonTest { when(block.getZ()).thenReturn(0); when(block.getWorld()).thenReturn(world); when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(block); + when(world.getMaxHeight()).thenReturn(256); when(world.getEnvironment()).thenReturn(Environment.THE_END); // Player UUID uuid = UUID.randomUUID();