Skip to content

Commit

Permalink
#38,#36 Added support for 1.21.1 and added set placeholders.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Aug 14, 2024
1 parent d722e05 commit c5986c7
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 8 deletions.
6 changes: 3 additions & 3 deletions 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 = "1.6.1"
version = "1.7.0"

repositories {
mavenCentral()
Expand Down Expand Up @@ -38,9 +38,9 @@ dependencies {
implementation("com.google.code.gson:gson:2.8.6")

// Custom dependencies
implementation("com.github.shynixn.mcutils:common:2024.19")
implementation("com.github.shynixn.mcutils:common:2024.21")
implementation("com.github.shynixn.mcutils:guice:2024.2")
implementation("com.github.shynixn.mcutils:packet:2024.32")
implementation("com.github.shynixn.mcutils:packet:2024.33")
implementation("com.github.shynixn.mcutils:sign:2024.3")

// Test
Expand Down
9 changes: 6 additions & 3 deletions docs/wiki/docs/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ The following placeholders are available in MCTennis and can also be used via Pl
| %mctennis_game_isJoinAble% | true if the game can be joined, false if not |
| %mctennis_game_isRunning% | true if the game is running, false if not |
| %mctennis_game_displayName% | DisplayName of a game. |
| %mctennis_game_rawScoreTeamRed% | Score of team red |
| %mctennis_game_rawScoreTeamBlue% | Score of team blue |
| %mctennis_game_score% | Overall game score |
| %mctennis_game_score% | Score of both teams with text |
| %mctennis_game_rawScoreTeamRed% | Numeric score of team red |
| %mctennis_game_rawScoreTeamBlue% | Numeric score of team blue |
| %mctennis_game_currentSet% | The current set |
| %mctennis_game_wonSetsTeamRed% | Number of won sets of team red |
| %mctennis_game_wonSetsTeamBlue% | Number of won sets of team blue |
| %mctennis_game_state% | State of the game: DISABLED, JOINABLE, RUNNING |
| %mctennis_game_stateDisplayName% | State of the game with color codes |
| %mctennis_game_players% | Current amount of players in the game |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ interface TennisGame {
*/
val teamBlueSetScore: Int

/**
* The index number of the current set.
*/
val currentSet : Int

/**
* Gets the team who is serving.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ enum class PlaceHolder(val fullPlaceHolder: String) {
GAME_RAWSCORETEAMRED("%mctennis_game_rawScoreTeamRed%"),
GAME_RAWSCORETEAMBLUE("%mctennis_game_rawScoreTeamBlue%"),
GAME_SCORE("%mctennis_game_score%"),
GAME_CURRENT_SET("%mctennis_game_currentSet%"),
GAME_WON_SETS_TEAM_RED("%mctennis_game_wonSetsTeamRed%"),
GAME_WON_SETS_TEAM_BLUE("%mctennis_game_wonSetsTeamBlue%"),
GAME_STATE("%mctennis_game_state%"),
GAME_STATE_DISPLAYNAME("%mctennis_game_stateDisplayName%"),
GAME_PLAYER_AMOUNT("%mctennis_game_players%"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ class TennisGameImpl(
*/
override var teamBlueSetScore: Int = 0

/**
* The index number of the current set.
*/
override var currentSet: Int = 1

/**
* Gets the team who is serving.
*/
Expand Down Expand Up @@ -450,6 +455,8 @@ class TennisGameImpl(
*/
private suspend fun winSet(team: Team) {
gameState = GameState.ENDING
currentSet++

when (team) {
Team.RED -> {
teamRedSetScore++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ class PlaceHolderServiceImpl @Inject constructor(private val gameService: GameSe
"0"
}
}
gamePlayerHolderFunctions[PlaceHolder.GAME_CURRENT_SET] = { g ->
g.currentSet.toString()
}
gamePlayerHolderFunctions[PlaceHolder.GAME_WON_SETS_TEAM_BLUE] = { g ->
g.teamBlueSetScore.toString()
}
gamePlayerHolderFunctions[PlaceHolder.GAME_WON_SETS_TEAM_RED] = { g ->
g.teamRedSetScore.toString()
}

// Game and Player
gameAndPlayerHolderFunctions[PlaceHolder.GAME_ISTEAMBLUEPLAYER] =
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: MCTennis
version: 1.6.1
version: 1.7.0
author: Shynixn
website: https://www.spigotmc.org/members/shynixn.63455/
main: com.github.shynixn.mctennis.MCTennisPlugin
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: MCTennis
version: 1.6.1
version: 1.7.0
author: Shynixn
website: https://www.spigotmc.org/members/shynixn.63455/
main: com.github.shynixn.mctennis.MCTennisPlugin
Expand Down

0 comments on commit c5986c7

Please sign in to comment.