Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/modrinth-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
1.21.11
26.1
26.1.1
26.1.2

# Path to the built JAR — Maven produces Warps-<version>.jar in target/
# Note: glob patterns are not supported; use the release tag directly.
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!-- Non-minecraft related dependencies -->
<junit.version>5.10.2</junit.version>
<mockito.version>5.11.0</mockito.version>
<mock-bukkit.version>v1.21-SNAPSHOT</mock-bukkit.version>
<mock-bukkit.version>4.110.0</mock-bukkit.version>
<!-- More visible way how to change dependency versions -->
<paper.version>1.21.11-R0.1-SNAPSHOT</paper.version>
<bentobox.version>3.14.0-SNAPSHOT</bentobox.version>
Expand All @@ -64,7 +64,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.19.0</build.version>
<build.version>1.19.1</build.version>
<!-- Sonar Cloud -->
<sonar.projectKey>BentoBoxWorld_Warps</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -182,8 +182,8 @@
</dependency>
<!-- MockBukkit -->
<dependency>
<groupId>com.github.MockBukkit</groupId>
<artifactId>MockBukkit</artifactId>
<groupId>org.mockbukkit.mockbukkit</groupId>
<artifactId>mockbukkit-v1.21</artifactId>
<version>${mock-bukkit.version}</version>
<scope>test</scope>
</dependency>
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/world/bentobox/warps/managers/WarpSignsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))) {
Expand All @@ -489,14 +491,15 @@ 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);
return;
}
} 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);
Expand All @@ -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);
}
}

Expand Down
Loading