From 0b0dc5b2626eb02768f0c17bc5347dbf9d301e9c Mon Sep 17 00:00:00 2001 From: Giraffe1966 <35208168+Giraffe1966@users.noreply.github.com> Date: Sat, 20 Feb 2021 01:48:24 -0500 Subject: [PATCH] Fix issue where the sever would freeze if a particle marking a claim boundary was over the void. This bug could have caused crashes if a claim was created between islands in the End. --- .../java/com/flemmli97/flan/player/ClaimDisplay.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/flemmli97/flan/player/ClaimDisplay.java b/src/main/java/com/flemmli97/flan/player/ClaimDisplay.java index 307b583..e258f7d 100644 --- a/src/main/java/com/flemmli97/flan/player/ClaimDisplay.java +++ b/src/main/java/com/flemmli97/flan/player/ClaimDisplay.java @@ -69,12 +69,16 @@ public class ClaimDisplay { }; } for (int[] pos : this.poss) { + if (pos[2] == -1) + continue; if (pos[1] != pos[2]) player.networkHandler.sendPacket(new ParticleS2CPacket(this.corner, true, pos[0] + 0.5, pos[2] + 0.25, pos[3] + 0.5, 0, 0.5f, 0, 0, 1)); player.networkHandler.sendPacket(new ParticleS2CPacket(this.corner, true, pos[0] + 0.5, pos[1] + 0.25, pos[3] + 0.5, 0, 0.5f, 0, 0, 1)); } if (this.middlePoss != null) for (int[] pos : this.middlePoss) { + if (pos[2] == -1) + continue; if (pos[1] != pos[2]) player.networkHandler.sendPacket(new ParticleS2CPacket(this.middle, true, pos[0] + 0.5, pos[2] + 0.25, pos[3] + 0.5, 0, 0.5f, 0, 0, 1)); player.networkHandler.sendPacket(new ParticleS2CPacket(this.middle, true, pos[0] + 0.5, pos[1] + 0.25, pos[3] + 0.5, 0, 0.5f, 0, 0, 1)); @@ -144,6 +148,11 @@ public class ClaimDisplay { while (state.getMaterial().isReplaceable()) { pos = pos.down(); state = world.getBlockState(pos); + // check if void is reached + if(pos.getY() == -1 && !world.getBlockState(pos.up()).getMaterial().isLiquid()) + return new int[]{-1, -1}; + else if(pos.getY() == -1) + break; } pos = pos.up(); state = world.getBlockState(pos);