mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 09:57:40 +01:00
Update to Minecraft 1.18 (#1887)
This commit is contained in:
parent
79abf965f3
commit
59de6a8efb
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())) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user