diff --git a/.github/workflows/modrinth-publish.yml b/.github/workflows/modrinth-publish.yml index 3f8b753..911a8fd 100644 --- a/.github/workflows/modrinth-publish.yml +++ b/.github/workflows/modrinth-publish.yml @@ -89,6 +89,7 @@ jobs: 1.21.11 26.1 26.1.1 + 26.1.2 # Path to the built JAR — Maven produces Warps-.jar in target/ # Note: glob patterns are not supported; use the release tag directly. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7415e44 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +# Warps — .github/workflows/publish.yml +# Publishes the jar attached to a GitHub release to CurseForge and Hangar via the +# shared BentoBoxWorld/.github reusable workflow. Downloads the release asset instead of +# rebuilding from source. The reusable workflow is pinned to a commit SHA (Sonar +# githubactions:S7637). workflow_dispatch lets you (re)publish a given version. + +name: Publish release to CurseForge and Hangar + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: "Version to publish (e.g. 1.2.3)" + required: true + type: string + +jobs: + publish: + uses: bentoboxworld/.github/.github/workflows/publish-platforms.yml@1f91a0edf72e8c86d671b3b8fdd3121ac6fb88e1 # master + with: + use_release_asset: "true" # publish the jar attached to the release; do not rebuild + hangar_slug: "Warps-for-BentoBox" # blank = skip Hangar + curseforge_id: "1514815" + game_versions: "26.2,26.1.2,26.1.1,26.1,1.21.11,1.21.10,1.21.9,1.21.8,1.21.7,1.21.6,1.21.5" + version: ${{ inputs.version }} # empty on release events -> falls back to the release tag + secrets: + HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index b3192f9..883701b 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ 5.10.2 5.11.0 - v1.21-SNAPSHOT + 4.110.0 1.21.11-R0.1-SNAPSHOT 3.14.0-SNAPSHOT @@ -64,7 +64,7 @@ -LOCAL - 1.19.0 + 1.19.1 BentoBoxWorld_Warps bentobox-world @@ -182,8 +182,8 @@ - com.github.MockBukkit - MockBukkit + org.mockbukkit.mockbukkit + mockbukkit-v1.21 ${mock-bukkit.version} test 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); } }