Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "com.github.shynixn"
version = "7.41.1"
version = "7.41.2"

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions docs/footer-github.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/<version>/BlockBall.jar)
39 changes: 27 additions & 12 deletions src/main/java/com/github/shynixn/blockball/impl/SoccerGameImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-1.17.0-1.21.11-folia.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-1.17.0-1.21.11.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-1.8.8-1.16.5.yml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion src/main/resources/plugin-26.1.0-latest-folia.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-26.1.0-latest.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
Loading