From 210fd0bd9fb0d9c4b4df5c71671eee0362d29f51 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 28 Aug 2022 17:22:25 +0200 Subject: [PATCH] Closes: #118 Signed-off-by: yoyosource --- .../bausystem/features/world/SignEdit.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java index 376adfba..cb4cd3b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java @@ -58,10 +58,7 @@ public class SignEdit implements Listener { if (!event.getPlayer().isSneaking()) return; if (event.getClickedBlock() == null || !event.getClickedBlock().getType().name().contains("SIGN")) return; - if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getItem() == null || event.getItem().getType() == Material.AIR)) { - event.setCancelled(true); - edit(event.getPlayer(), event.getClickedBlock()); - } else if (event.getAction() == Action.LEFT_CLICK_BLOCK) { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (event.getItem() == null || event.getItem().getType() == Material.AIR) || event.getAction() == Action.LEFT_CLICK_BLOCK) { event.setCancelled(true); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { edit(event.getPlayer(), event.getClickedBlock()); @@ -75,11 +72,13 @@ public class SignEdit implements Listener { for (int i = 0; i < lines.length; i++) { sign.setLine(i, lines[i].replace('ยง', '&')); } - sign.update(); + sign.update(true); - Object openSignObject = Reflection.newInstance(openSign); - blockPositionFieldAccessor.set(openSignObject, getPosition.invoke(block)); - TinyProtocol.instance.sendPacket(player, openSignObject); + Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + Object openSignObject = Reflection.newInstance(openSign); + blockPositionFieldAccessor.set(openSignObject, getPosition.invoke(block)); + TinyProtocol.instance.sendPacket(player, openSignObject); + }, 1); } {