From d8791cc5a8a057c74f528eb361248b4cb7b326aa Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 8 Oct 2020 16:02:53 +0200 Subject: [PATCH] Allow for accurate teleport signs --- .../erethon/dungeonsxl/sign/button/TeleportSign.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/sign/button/TeleportSign.java b/core/src/main/java/de/erethon/dungeonsxl/sign/button/TeleportSign.java index 6c3a1aaa..0283fc4f 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/sign/button/TeleportSign.java +++ b/core/src/main/java/de/erethon/dungeonsxl/sign/button/TeleportSign.java @@ -105,9 +105,13 @@ public class TeleportSign extends Button implements LocationSign { double y = NumberUtil.parseDouble(loc[1]); double z = NumberUtil.parseDouble(loc[2]); - // If round number, add 0.5 to tp to middle of block - x = NumberUtil.parseInt(loc[0]) + 0.5; - z = NumberUtil.parseInt(loc[2]) + 0.5; + // If number is even, add +0.5 to teleport to the middle of the block + if (!loc[0].contains(".")) { + x += 0.5; + } + if (!loc[2].contains(".")) { + z += 0.5; + } location.setX(x); location.setY(y);