Skip to content

Commit

Permalink
Release 1.19.0 (#1890)
Browse files Browse the repository at this point in the history
* Update to Minecraft 1.18 (#1887)

* Make BlockEndDragon support custom max world height (#1888)

Use max world height instead of magic 255 value.

* Send PVP toggle messages only to on-island players.

#1885

* Add 1.18.1

Co-authored-by: BONNe <[email protected]>
  • Loading branch information
tastybento and BONNe authored Dec 13, 2021
1 parent 11a3bf9 commit 60cde53
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<powermock.version>2.0.9</powermock.version>
<mongodb.version>3.12.8</mongodb.version>
<!-- More visible way to change dependency versions -->
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.18-R0.1-SNAPSHOT</spigot.version>
<!-- Might differ from the last Spigot release for short periods
of time -->
<paper.version>1.16.5-R0.1-SNAPSHOT</paper.version>
Expand All @@ -83,7 +83,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.18.1</build.version>
<build.version>1.19.0</build.version>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
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;
Expand All @@ -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<User, Integer> displayRanges = new HashMap<>();
Expand All @@ -46,15 +50,15 @@ public boolean execute(User user, String label, List<String> args) {

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);
}
}

Expand All @@ -71,7 +75,7 @@ private void showZones(User user) {

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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ private void testLocation(Location location) {
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);
}

/**
Expand All @@ -68,9 +68,9 @@ public void onEndBlockPlace(BlockPlaceEvent e) {
}

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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ public void onPVPFlagToggle(final FlagSettingChangeEvent e) {
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));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,24 @@ public enum ServerVersion {
/**
* @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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void setUp() throws Exception {
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();
Expand Down

0 comments on commit 60cde53

Please sign in to comment.