From 014d25819743429a5fc889d3c2ea0002c195109e Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 29 Jul 2026 16:07:48 -0700 Subject: [PATCH] Notify the sign owner when a warp falls back to the sign block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit warpPlayer(world, user, owner) has two teleport paths: the normal one, used when the spot in front of the sign is safe, fires WarpInitiateEvent, respects vanished players, and tells the sign owner that someone warped to them; and a fallback, used when no safe spot in front exists, which teleported the visitor directly onto the sign's own block and did none of that. Owners silently missed warp visits whenever the fallback ran. The fallback is common on cramped islands — a ChunkBlock island starts as a single chunk, so warp signs often sit at the platform edge with void in front, which fails isSafeLocation and always takes the silent path. That is how this surfaced: owners got warp messages in AOneBlock but never in ChunkBlock. The fallback now routes through the same warpPlayer completion path as a normal warp, so the event, the vanish check, the sounds, and the owner notification behave identically wherever the visitor lands. The sign's facing is used for the arrival yaw, matching normal warps. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Y7xSdVPS5vRu6wqf6XshRq --- .../warps/managers/WarpSignsManager.java | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/world/bentobox/warps/managers/WarpSignsManager.java b/src/main/java/world/bentobox/warps/managers/WarpSignsManager.java index 77e1747..48af539 100644 --- a/src/main/java/world/bentobox/warps/managers/WarpSignsManager.java +++ b/src/main/java/world/bentobox/warps/managers/WarpSignsManager.java @@ -384,9 +384,10 @@ public SignCacheItem getSignInfo(@NonNull World world, @NonNull UUID uuid) { } /** - * Warps a player to a spot in front of a sign. + * Warps a player to a spot in front of a sign, or to the sign block itself when no + * safe spot in front exists. * @param user - user who is warping - * @param inFront - location in front of sign - previously checked for safety + * @param inFront - warp destination - previously checked for safety * @param signOwner - warp sign owner * @param directionFacing - direction that sign is facing * @param pvp - true if this location allowed PVP @@ -475,9 +476,10 @@ public void warpPlayer(@NonNull World world, @NonNull User user, @NonNull UUID o } // Find out which direction the warp is facing Block b = warpSpot.getBlock(); + BlockFace directionFacing; if (Tag.WALL_SIGNS.isTagged(b.getType())) { org.bukkit.block.data.type.WallSign s = (org.bukkit.block.data.type.WallSign) b.getBlockData(); - BlockFace directionFacing = s.getFacing(); + directionFacing = s.getFacing(); Location inFront = b.getRelative(directionFacing).getLocation(); Location oneDown = b.getRelative(directionFacing).getRelative(BlockFace.DOWN).getLocation(); if ((plugin.getIslands().isSafeLocation(inFront))) { @@ -489,6 +491,7 @@ public void warpPlayer(@NonNull World world, @NonNull User user, @NonNull UUID o return; } } else if (Tag.ALL_HANGING_SIGNS.isTagged(b.getType())) { + directionFacing = BlockFace.DOWN; Location below = b.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).getLocation(); if ((addon.getIslands().isSafeLocation(below))) { warpPlayer(user, below, owner, BlockFace.DOWN, pvp); @@ -496,7 +499,7 @@ public void warpPlayer(@NonNull World world, @NonNull User user, @NonNull UUID o } } else if (Tag.STANDING_SIGNS.isTagged(b.getType())) { org.bukkit.block.data.type.Sign s = (org.bukkit.block.data.type.Sign) b.getBlockData(); - BlockFace directionFacing = s.getRotation(); + directionFacing = s.getRotation(); Location inFront = b.getRelative(directionFacing).getLocation(); if ((addon.getIslands().isSafeLocation(inFront))) { warpPlayer(user, inFront, owner, directionFacing, pvp); @@ -511,15 +514,10 @@ public void warpPlayer(@NonNull World world, @NonNull User user, @NonNull UUID o if (!(plugin.getIslands().isSafeLocation(warpSpot))) { user.sendMessage("warps.error.not-safe"); } else { - final Location actualWarp = new Location(warpSpot.getWorld(), warpSpot.getBlockX() + 0.5D, warpSpot.getBlockY(), - warpSpot.getBlockZ() + 0.5D); - if (pvp) { - user.sendMessage("protection.flags.PVP_OVERWORLD.enabled"); - user.getWorld().playSound(Objects.requireNonNull(user.getLocation()), Sound.ENTITY_ARROW_HIT, 1F, 1F); - } else { - user.getWorld().playSound(Objects.requireNonNull(user.getLocation()), Sound.ENTITY_BAT_TAKEOFF, 1F, 1F); - } - Util.teleportAsync(user.getPlayer(), actualWarp, TeleportCause.COMMAND); + // Fall back to the sign's own block, but through the same path as a normal + // warp so that the initiate event fires, vanished players stay hidden, and + // the sign owner is told that someone warped to them + warpPlayer(user, warpSpot, owner, directionFacing, pvp); } }