From 2cfed8b84d2cb59f497a3cd05d65a201251c9c97 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 22 Dec 2023 09:24:49 +0100 Subject: [PATCH] Fix CancelPacketHandleException in SmartPlaceListener --- .../features/smartplace/SmartPlaceListener.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java index f3ab68bf..61b69c31 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/smartplace/SmartPlaceListener.java @@ -103,9 +103,14 @@ public class SmartPlaceListener implements Plain, Listener { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { if (sneaking) SMART_PLACING.add(player); player.setSneaking(shouldSneak || sneaking); - packetExecutor.invoke(playerConnection.get(getHandle.invoke(player)), packet); - SMART_PLACING.remove(player); - player.setSneaking(sneaking); + try { + packetExecutor.invoke(playerConnection.get(getHandle.invoke(player)), packet); + } catch (Exception e) { + return; + } finally { + SMART_PLACING.remove(player); + player.setSneaking(sneaking); + } if (!WAS_EXECUTED.contains(player) && first) { run(player, packet, false, sneaking, shouldSneak);