Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes to master --release #530

Merged
merged 4 commits into from
Jul 20, 2024
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
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "com.github.shynixn"
version = "6.46.0"
version = "6.46.1"

repositories {
mavenLocal()
Expand Down Expand Up @@ -42,7 +42,7 @@ dependencies {

// Custom dependencies
implementation("com.github.shynixn.mcutils:common:2024.19")
implementation("com.github.shynixn.mcutils:packet:2024.30")
implementation("com.github.shynixn.mcutils:packet:2024.32")
implementation("com.github.shynixn.mcutils:database:2024.2")
implementation("com.github.shynixn.mcutils:sign:2024.2")
implementation("com.github.shynixn.mcutils:guice:2024.2")
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = '6.46.0'
version = '6.46.1'
# The full version, including alpha/beta/rc tags.
release = '6.46.0'
release = '6.46.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/github/shynixn/blockball/entity/TeamMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ class TeamMeta(
"%blockball_lang_teamSignLine4%",
)

@JsonProperty("armor")
var armor: Array<String?> = arrayOfNulls(4)

@JsonProperty("inventory")
var inventory: Array<String?> = arrayOfNulls(36)

var scoreMessageFadeIn: Int = 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import kotlin.math.sin
*/
class BallHitboxEntity(val entityId: Int, val spawnpoint: Vector3d) {
private var stuckCounter = 0
private var cachedLength = 0.5

/**
* Origin coordinate to make relative rotations in the world.
Expand Down Expand Up @@ -200,14 +201,15 @@ class BallHitboxEntity(val entityId: Int, val spawnpoint: Vector3d) {
if (rayTraceEvent.hitBlock) {
if (rayTraceEvent.blockDirection == BlockDirection.UP) {
this.stuckCounter = 0
this.cachedLength = this.motion.length()
calculateBallOnGround(players, targetPosition)
return
} else {
stuckCounter++
this.motion = calculateWallBounce(this.motion, rayTraceEvent.blockDirection)
// Fix ball getting stuck in wall by moving back in the direction of its spawnpoint.
if (stuckCounter > 4) {
val velocity = this.spawnpoint.copy().subtract(this.position).normalize().multiply(0.5)
val velocity = this.spawnpoint.copy().subtract(this.position).normalize().multiply(cachedLength)
this.motion = velocity
this.motion.y = 0.1
this.position = this.position.add(this.motion.x, this.motion.y, this.motion.z)
Expand All @@ -220,6 +222,7 @@ class BallHitboxEntity(val entityId: Int, val spawnpoint: Vector3d) {
}

this.stuckCounter = 0
this.cachedLength = this.motion.length()
calculateBallOnAir(players, targetPosition)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,55 +172,20 @@ class BlockBallMiniGameImpl constructor(
return JoinResult.GAME_FULL
}

if (ingamePlayersStorage.containsKey(player) && team != null) {
var targetTeam = team
val amount = getAmountOfQueuedPlayersInThisTeam(targetTeam)

if (arena.meta.lobbyMeta.onlyAllowEventTeams) {
val blueTeamAmount = getAmountOfQueuedPlayersInThisTeam(Team.BLUE)
val redTeamAmount = getAmountOfQueuedPlayersInThisTeam(Team.RED)

if (blueTeamAmount > redTeamAmount) {
targetTeam = Team.RED
} else if (blueTeamAmount < redTeamAmount) {
targetTeam = Team.BLUE
}
}

if (targetTeam == Team.RED) {
if (amount >= arena.meta.redTeamMeta.maxAmount) {
return JoinResult.TEAM_FULL
}

joinTeam(player, Team.RED, arena.meta.redTeamMeta)
} else if (targetTeam == Team.BLUE) {
if (amount >= arena.meta.blueTeamMeta.maxAmount) {
return JoinResult.TEAM_FULL
}

joinTeam(player, Team.BLUE, arena.meta.blueTeamMeta)
}

ingamePlayersStorage[player]!!.team = targetTeam
ingamePlayersStorage[player]!!.goalTeam = targetTeam

if (targetTeam == Team.BLUE) {
executeCommandsWithPlaceHolder(listOf(player), arena.meta.blueTeamMeta.joinCommands)
return JoinResult.SUCCESS_BLUE
} else {
executeCommandsWithPlaceHolder(listOf(player), arena.meta.redTeamMeta.joinCommands)
return JoinResult.SUCCESS_RED
}
}

var joinResult = JoinResult.SUCCESS_QUEUED
val storage = this.createPlayerStorage(player)
ingamePlayersStorage[player] = storage
player.teleport(arena.meta.minigameMeta.lobbySpawnpoint!!.toLocation())

if (team != null) {
val innerResult = join(player, team)
if (innerResult != JoinResult.SUCCESS_BLUE && innerResult != JoinResult.SUCCESS_RED) {
return innerResult
if (team == Team.RED && redTeam.size < arena.meta.redTeamMeta.maxAmount) {
joinTeam(player, team, arena.meta.redTeamMeta)
storage.team = team
joinResult = JoinResult.SUCCESS_RED
} else if (team == Team.BLUE && blueTeam.size < arena.meta.blueTeamMeta.maxAmount) {
joinTeam(player, team, arena.meta.blueTeamMeta)
storage.team = team
joinResult = JoinResult.SUCCESS_BLUE
}
}

Expand All @@ -231,7 +196,7 @@ class BlockBallMiniGameImpl constructor(
}
}

return JoinResult.SUCCESS_QUEUED
return joinResult
}

/**
Expand Down Expand Up @@ -657,21 +622,6 @@ class BlockBallMiniGameImpl constructor(
}
}

/**
* Returns the amount of queues players.
*/
private fun getAmountOfQueuedPlayersInThisTeam(team: Team): Int {
var amount = 0

ingamePlayersStorage.values.forEach { p ->
if (p.team != null && p.team == team) {
amount++
}
}

return amount
}

/**
* Gets called when the game ends.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,10 @@ class JoinCommandExecutor @Inject constructor(
.equals(args[0], true)
) {
var team: Team? = null
if (args[1].equals(
g.arena.meta.redTeamMeta.displayName.translateChatColors().stripChatColors(),
true
)
) {
// TODO: Work around will be removed with the command rework
if (args[1].equals("team red", true) || args[1].equals("red", true)) {
team = Team.RED
} else if (args[1].equals(
g.arena.meta.blueTeamMeta.displayName.translateChatColors().stripChatColors(),
true
)
) {
} else if (args[1].equals("team blue", true) || args[1].equals("blue", true)) {
team = Team.BLUE
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ class OpenPage @Inject constructor(
return@runBlocking MenuCommandResult.CANCEL_MESSAGE
}
} else if (command == MenuCommand.OPEN_CREATE_ARENA) {
var idGen = 1
var idGen: Int

runBlocking {
for (arena in arenaRepository.getAll()) {
val arenas = arenaRepository.getAll()
idGen = arenas.size + 1

for (arena in arenas) {
if (arena.name == "arena_$idGen") {
idGen++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class TeamSettingsPage @Inject constructor() :
}.toTypedArray()
} else if (command == MenuCommand.TEAM_INVENTORY) {
val teamMeta = getTeamMeta(cache)
teamMeta.armor = player.inventory.contents.clone().map { e ->
teamMeta.inventory = player.inventory.contents.clone().map { e ->
val yamlConfiguration = YamlConfiguration()
yamlConfiguration.set("item", e)
yamlConfiguration.saveToString()
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-legacy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BlockBall
version: 6.46.0
version: 6.46.1
author: Shynixn
website: https://www.spigotmc.org/members/shynixn.63455/
main: com.github.shynixn.blockball.BlockBallPlugin
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BlockBall
version: 6.46.0
version: 6.46.1
author: Shynixn
website: https://www.spigotmc.org/members/shynixn.63455/
main: com.github.shynixn.blockball.BlockBallPlugin
Expand Down
Loading