Skip to content

Commit 60cde53

Browse files
tastybentoBONNe
andauthored
Release 1.19.0 (#1890)
* 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 <bonne@bonne.id.lv>
1 parent 11a3bf9 commit 60cde53

File tree

7 files changed

+37
-24
lines changed

7 files changed

+37
-24
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<powermock.version>2.0.9</powermock.version>
6969
<mongodb.version>3.12.8</mongodb.version>
7070
<!-- More visible way to change dependency versions -->
71-
<spigot.version>1.17-R0.1-SNAPSHOT</spigot.version>
71+
<spigot.version>1.18-R0.1-SNAPSHOT</spigot.version>
7272
<!-- Might differ from the last Spigot release for short periods
7373
of time -->
7474
<paper.version>1.16.5-R0.1-SNAPSHOT</paper.version>
@@ -83,7 +83,7 @@
8383
<!-- Do not change unless you want different name for local builds. -->
8484
<build.number>-LOCAL</build.number>
8585
<!-- This allows to change between versions. -->
86-
<build.version>1.18.1</build.version>
86+
<build.version>1.19.0</build.version>
8787
<sonar.organization>bentobox-world</sonar.organization>
8888
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
8989
</properties>

src/main/java/world/bentobox/bentobox/api/commands/admin/range/AdminRangeDisplayCommand.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.bukkit.Location;
1010
import org.bukkit.Particle;
1111

12+
import com.google.common.base.Enums;
13+
1214
import world.bentobox.bentobox.api.commands.CompositeCommand;
1315
import world.bentobox.bentobox.api.user.User;
1416
import world.bentobox.bentobox.database.objects.Island;
@@ -22,6 +24,8 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
2224
private static final String DISPLAY = "display";
2325
private static final String SHOW = "show";
2426
private static final String HIDE = "hide";
27+
// Since 1.18, the Particle.BARRIER was replaced by BLOCK_MARKER
28+
private static final Particle BARRIER = Enums.getIfPresent(Particle.class, "BARRIER").or(Enums.getIfPresent(Particle.class, "BLOCK_MARKER").or(Particle.LAVA));
2529

2630
// Map of users to which ranges must be displayed
2731
private final Map<User, Integer> displayRanges = new HashMap<>();
@@ -46,15 +50,15 @@ public boolean execute(User user, String label, List<String> args) {
4650

4751
if (!displayRanges.containsKey(user)) {
4852
switch (label) {
49-
case DISPLAY, SHOW -> showZones(user);
50-
case HIDE -> user.sendMessage("commands.admin.range.display.already-off");
51-
default -> showHelp(this, user);
53+
case DISPLAY, SHOW -> showZones(user);
54+
case HIDE -> user.sendMessage("commands.admin.range.display.already-off");
55+
default -> showHelp(this, user);
5256
}
5357
} else {
5458
switch (label) {
55-
case DISPLAY, HIDE -> hideZones(user);
56-
case SHOW -> user.sendMessage("commands.admin.range.display.already-on");
57-
default -> showHelp(this, user);
59+
case DISPLAY, HIDE -> hideZones(user);
60+
case SHOW -> user.sendMessage("commands.admin.range.display.already-on");
61+
default -> showHelp(this, user);
5862
}
5963
}
6064

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

7276
getIslands().getIslandAt(user.getLocation()).ifPresent(island -> {
7377
// Draw the island protected area
74-
drawZone(user, Particle.BARRIER, null, island, island.getProtectionRange());
78+
drawZone(user, BARRIER, null, island, island.getProtectionRange());
7579

7680
// Draw the default protected area if island protected zone is different
7781
if (island.getProtectionRange() != getPlugin().getIWM().getIslandProtectionRange(getWorld())) {

src/main/java/world/bentobox/bentobox/listeners/BlockEndDragon.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ private void testLocation(Location location) {
3939
World w = location.getWorld();
4040
if (w == null || !plugin.getIWM().isIslandEnd(w)
4141
|| !Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(w)
42-
|| w.getBlockAt(0, 255, 0).getType().equals(Material.END_PORTAL)) {
42+
|| w.getBlockAt(0, w.getMaxHeight() - 1, 0).getType().equals(Material.END_PORTAL)) {
4343
return;
4444
}
4545

4646
// Setting a End Portal at the top will trick dragon legacy check.
47-
w.getBlockAt(0, 255, 0).setType(Material.END_PORTAL, false);
47+
w.getBlockAt(0, w.getMaxHeight() - 1, 0).setType(Material.END_PORTAL, false);
4848
}
4949

5050
/**
@@ -68,9 +68,9 @@ public void onEndBlockPlace(BlockPlaceEvent e) {
6868
}
6969

7070
private boolean testBlock(Block block) {
71-
return block.getY() == 255
72-
&& block.getX() == 0
71+
return block.getX() == 0
7372
&& block.getZ() == 0
73+
&& block.getY() == block.getWorld().getMaxHeight() - 1
7474
&& block.getWorld().getEnvironment().equals(Environment.THE_END)
7575
&& Flags.REMOVE_END_EXIT_ISLAND.isSetForWorld(block.getWorld())
7676
&& plugin.getIWM().inWorld(block.getWorld())

src/main/java/world/bentobox/bentobox/listeners/flags/settings/PVPListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ public void onPVPFlagToggle(final FlagSettingChangeEvent e) {
225225
String message = "protection.flags." + flag.getID() + "." + (e.isSetTo() ? "enabled" : "disabled");
226226
// Send the message to visitors
227227
e.getIsland().getVisitors().forEach(visitor -> User.getInstance(visitor).sendMessage(message));
228-
// Send the message to island members (and coops and trusted)
229-
e.getIsland().getMemberSet(RanksManager.COOP_RANK).forEach(member -> User.getInstance(member).sendMessage(message));
228+
// Send the message to players on the island
229+
e.getIsland().getPlayersOnIsland().forEach(player -> User.getInstance(player).sendMessage(message));
230230
}
231231
}
232232

src/main/java/world/bentobox/bentobox/nms/v1_17_R1/NMSHandler.java renamed to src/main/java/world/bentobox/bentobox/nms/v1_18_R1/NMSHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package world.bentobox.bentobox.nms.v1_17_R1;
1+
package world.bentobox.bentobox.nms.v1_18_R1;
22

33
import org.bukkit.Bukkit;
44
import org.bukkit.Material;
55
import org.bukkit.block.data.BlockData;
6-
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
7-
import org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData;
6+
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
7+
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
88

99
import net.minecraft.core.BlockPosition;
1010
import net.minecraft.world.level.World;
@@ -21,11 +21,11 @@ public class NMSHandler implements NMSAbstraction {
2121
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData, boolean applyPhysics) {
2222
CraftBlockData craft = (CraftBlockData) blockData;
2323
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
24-
Chunk nmsChunk = nmsWorld.getChunkAt(chunk.getX(), chunk.getZ());
24+
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());
2525
BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z);
2626
// Setting the block to air before setting to another state prevents some console errors
27-
nmsChunk.setType(bp, AIR, applyPhysics, true);
28-
nmsChunk.setType(bp, craft.getState(), applyPhysics, true);
27+
nmsChunk.a(bp, AIR, applyPhysics);
28+
nmsChunk.a(bp, craft.getState(), applyPhysics);
2929
}
3030

3131
}

src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,24 @@ public enum ServerVersion {
176176
/**
177177
* @since 1.16.0
178178
*/
179-
V1_16_5(Compatibility.INCOMPATIBLE),
179+
V1_16_5(Compatibility.NOT_SUPPORTED),
180180

181181
/**
182182
* @since 1.17.0
183183
*/
184-
V1_17(Compatibility.COMPATIBLE),
184+
V1_17(Compatibility.NOT_SUPPORTED),
185185
/**
186186
* @since 1.17.1
187187
*/
188-
V1_17_1(Compatibility.COMPATIBLE)
188+
V1_17_1(Compatibility.SUPPORTED),
189+
/**
190+
* @since 1.19.0
191+
*/
192+
V1_18(Compatibility.COMPATIBLE),
193+
/**
194+
* @since 1.19.0
195+
*/
196+
V1_18_1(Compatibility.COMPATIBLE),
189197
;
190198

191199
private final Compatibility compatibility;

src/test/java/world/bentobox/bentobox/listeners/BlockEndDragonTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public void setUp() throws Exception {
9696
when(block.getZ()).thenReturn(0);
9797
when(block.getWorld()).thenReturn(world);
9898
when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(block);
99+
when(world.getMaxHeight()).thenReturn(256);
99100
when(world.getEnvironment()).thenReturn(Environment.THE_END);
100101
// Player
101102
UUID uuid = UUID.randomUUID();

0 commit comments

Comments
 (0)