mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 11:15:24 +01:00
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop
This commit is contained in:
commit
524cb46e27
4
pom.xml
4
pom.xml
@ -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>
|
||||
@ -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>
|
||||
|
@ -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<User, Integer> 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())) {
|
||||
|
@ -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())
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -176,16 +176,21 @@ 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.18.0
|
||||
*/
|
||||
V1_18(Compatibility.COMPATIBLE),
|
||||
|
||||
;
|
||||
|
||||
private final Compatibility compatibility;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user