diff --git a/CHANGELOG.md b/CHANGELOG.md index 414a4f9bf..d64c451b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Release 7.41.2 + +### Bugs/Issues + +* #749 Fixed throw-ins and corner kicks positions were not calculated correctly. + +--- + ## Release 7.41.1 ### Bugs/Issues diff --git a/build.gradle.kts b/build.gradle.kts index 22579efe7..3ea0146b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "com.github.shynixn" -version = "7.41.1" +version = "7.41.2" repositories { mavenCentral() diff --git a/docs/footer-github.md b/docs/footer-github.md index aedc5e623..809500b61 100644 --- a/docs/footer-github.md +++ b/docs/footer-github.md @@ -1,7 +1,7 @@ ### BlockBall (Premium) -* For Minecraft 1.8.9 - 26.1 +* For Minecraft 1.8.9 - 26.2 * Bedrock GeyserMC resource pack (skin and ball rotation for bedrock servers) * Stats tracking (Amount of Goals, WinRate, etc.) * Supports Folia @@ -12,5 +12,5 @@ ### BlockBall (Free) -* For Minecraft 26.1 (the free version only supports the latest Minecraft version) +* For Minecraft 26.2 (the free version only supports the latest Minecraft version) * Download: [BlockBall.jar](https://github.com/Shynixn/BlockBall/releases/download//BlockBall.jar) \ No newline at end of file diff --git a/src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt b/src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt index 4f0a4ed0b..880f376fc 100644 --- a/src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt +++ b/src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt @@ -1119,18 +1119,24 @@ abstract class SoccerGameImpl( * Projects [ballLocation] onto the boundary of the inner playing field in the given [exitDirection]. * This gives the sideline position where a throw-in should be taken. * If the exit direction cannot be determined (DOWN), the ball spawn point is used as fallback. + * + * Coordinate convention (from [Selection.getRelativeBlockDirectionToLocation]): + * - EAST = maxX (corner1.x) + * - WEST = minX (corner2.x) + * - SOUTH = maxZ (corner1.z) + * - NORTH = minZ (corner2.z) */ private fun findThrowInLocation(ballLocation: Vector3d, exitDirection: BlockFace): Location { - val c1 = arena.corner1!! // higher X (WEST edge) / higher Z (NORTH edge) - val c2 = arena.corner2!! // lower X (EAST edge) / lower Z (SOUTH edge) + val c1 = arena.corner1!! // max corner (maxX, maxZ) — East / South + val c2 = arena.corner2!! // min corner (minX, minZ) — West / North val world = org.bukkit.Bukkit.getWorld(arena.ballSpawnPoint!!.world!!) val y = arena.ballSpawnPoint!!.y val location = when (exitDirection) { - BlockFace.WEST -> Location(world, c1.x, y, ballLocation.z.coerceIn(c2.z, c1.z)) - BlockFace.EAST -> Location(world, c2.x, y, ballLocation.z.coerceIn(c2.z, c1.z)) - BlockFace.NORTH -> Location(world, ballLocation.x.coerceIn(c2.x, c1.x), y, c1.z) - BlockFace.SOUTH -> Location(world, ballLocation.x.coerceIn(c2.x, c1.x), y, c2.z) + BlockFace.WEST -> Location(world, c2.x, y, ballLocation.z.coerceIn(c2.z, c1.z)) + BlockFace.EAST -> Location(world, c1.x, y, ballLocation.z.coerceIn(c2.z, c1.z)) + BlockFace.NORTH -> Location(world, ballLocation.x.coerceIn(c2.x, c1.x), y, c2.z) + BlockFace.SOUTH -> Location(world, ballLocation.x.coerceIn(c2.x, c1.x), y, c1.z) else -> arena.ballSpawnPoint!!.toLocation() } @@ -1146,10 +1152,19 @@ abstract class SoccerGameImpl( /** * Returns the corner of the playing field nearest to [ballLocation] on the given [exitDirection] goal-line. * The player facing direction is set toward the arena center. + * + * Coordinate convention (from [Selection.getRelativeBlockDirectionToLocation]): + * - EAST = maxX (corner1.x) + * - WEST = minX (corner2.x) + * - SOUTH = maxZ (corner1.z) + * - NORTH = minZ (corner2.z) + * + * Note: corner kicks are only triggered for goal-line exits (EAST/WEST), so the + * NORTH/SOUTH branches serve as a safe fallback. */ private fun findCornerKickLocation(ballLocation: Vector3d, exitDirection: BlockFace): Location { - val c1 = arena.corner1!! - val c2 = arena.corner2!! + val c1 = arena.corner1!! // max corner (maxX, maxZ) — East / South + val c2 = arena.corner2!! // min corner (minX, minZ) — West / North val world = org.bukkit.Bukkit.getWorld(arena.ballSpawnPoint!!.world!!) val y = arena.ballSpawnPoint!!.y val centerX = (c1.x + c2.x) / 2.0 @@ -1158,22 +1173,22 @@ abstract class SoccerGameImpl( val location = when (exitDirection) { BlockFace.NORTH -> { val cornerX = if (ballLocation.x >= centerX) c1.x else c2.x - Location(world, cornerX, y, c1.z) + Location(world, cornerX, y, c2.z) } BlockFace.SOUTH -> { val cornerX = if (ballLocation.x >= centerX) c1.x else c2.x - Location(world, cornerX, y, c2.z) + Location(world, cornerX, y, c1.z) } BlockFace.WEST -> { val cornerZ = if (ballLocation.z >= centerZ) c1.z else c2.z - Location(world, c1.x, y, cornerZ) + Location(world, c2.x, y, cornerZ) } BlockFace.EAST -> { val cornerZ = if (ballLocation.z >= centerZ) c1.z else c2.z - Location(world, c2.x, y, cornerZ) + Location(world, c1.x, y, cornerZ) } else -> arena.ballSpawnPoint!!.toLocation() diff --git a/src/main/resources/plugin-1.17.0-1.21.11-folia.yml b/src/main/resources/plugin-1.17.0-1.21.11-folia.yml index 6d574406b..4e4663b18 100644 --- a/src/main/resources/plugin-1.17.0-1.21.11-folia.yml +++ b/src/main/resources/plugin-1.17.0-1.21.11-folia.yml @@ -1,5 +1,5 @@ name: BlockBall -version: 7.41.1 +version: 7.41.2 author: Shynixn main: com.github.shynixn.blockball.BlockBallPlugin softdepend: [ PlaceholderAPI, LuckPerms] diff --git a/src/main/resources/plugin-1.17.0-1.21.11.yml b/src/main/resources/plugin-1.17.0-1.21.11.yml index 7339afa2b..aa2610ea8 100644 --- a/src/main/resources/plugin-1.17.0-1.21.11.yml +++ b/src/main/resources/plugin-1.17.0-1.21.11.yml @@ -1,5 +1,5 @@ name: BlockBall -version: 7.41.1 +version: 7.41.2 author: Shynixn main: com.github.shynixn.blockball.BlockBallPlugin softdepend: [ PlaceholderAPI, LuckPerms] diff --git a/src/main/resources/plugin-1.8.8-1.16.5.yml b/src/main/resources/plugin-1.8.8-1.16.5.yml index 34047c3e5..15f01bb89 100644 --- a/src/main/resources/plugin-1.8.8-1.16.5.yml +++ b/src/main/resources/plugin-1.8.8-1.16.5.yml @@ -1,5 +1,5 @@ name: BlockBall -version: 7.41.1 +version: 7.41.2 author: Shynixn main: com.github.shynixn.blockball.BlockBallPlugin softdepend: [ PlaceholderAPI, LuckPerms] diff --git a/src/main/resources/plugin-26.1.0-latest-folia.yml b/src/main/resources/plugin-26.1.0-latest-folia.yml index 2be0fdb18..808682bdf 100644 --- a/src/main/resources/plugin-26.1.0-latest-folia.yml +++ b/src/main/resources/plugin-26.1.0-latest-folia.yml @@ -1,5 +1,5 @@ name: BlockBall -version: 7.41.1 +version: 7.41.2 author: Shynixn main: com.github.shynixn.blockball.BlockBallPlugin softdepend: [ PlaceholderAPI, LuckPerms] diff --git a/src/main/resources/plugin-26.1.0-latest.yml b/src/main/resources/plugin-26.1.0-latest.yml index 71ae19e4f..8f8f61c49 100644 --- a/src/main/resources/plugin-26.1.0-latest.yml +++ b/src/main/resources/plugin-26.1.0-latest.yml @@ -1,5 +1,5 @@ name: BlockBall -version: 7.41.1 +version: 7.41.2 author: Shynixn main: com.github.shynixn.blockball.BlockBallPlugin softdepend: [ PlaceholderAPI, LuckPerms]