Skip to content

Commit

Permalink
#536 Improved stats placeholders.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Aug 22, 2024
1 parent 9d02daa commit 6ad6e84
Show file tree
Hide file tree
Showing 13 changed files with 344 additions and 88 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")

// Custom dependencies
implementation("com.github.shynixn.mcutils:common:2024.21")
implementation("com.github.shynixn.mcutils:common:2024.23")
implementation("com.github.shynixn.mcutils:packet:2024.33")
implementation("com.github.shynixn.mcutils:database:2024.2")
implementation("com.github.shynixn.mcutils:sign:2024.3")
Expand Down
82 changes: 49 additions & 33 deletions docs/wiki/docs/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,53 @@
The following placeholders are available in BlockBall and can also be used via PlaceHolderApi.

!!! note "PlaceHolder Api"
As BlockBall supports multiple games per server, you need to specify the name of the game in external plugins. You can do this by appending the name of the game ``_game1`` ``_mygame``.
This results into placeholders such as e.g. ``%blockball_game_displayName_game1%`` or ``%blockball_game_blueScore_mygame%``. This is only relevant in external plugins. For placeholders in BlockBall, you can directly use the placeholders below.
As BlockBall supports multiple games per server, you need to specify the name of the game in external plugins. You can
do this by appending the name of the game ``_game1`` ``_mygame``.
This results into placeholders such as e.g. ``%blockball_game_displayName_game1%``
or ``%blockball_game_blueScore_mygame%``. This is only relevant in external plugins. For placeholders in BlockBall, you
can directly use the placeholders below.

| Placeholders | Description |
|--------------------------------------|----------------------------------------------------------------------------------------------------------|
| %blockball_game_displayName% | DisplayName of the game |
| %blockball_game_name% | Id of the game |
| %blockball_game_maxPlayers% | Max amount of players who can join this game |
| %blockball_game_players% | Current amount of players in this game |
| %blockball_game_redScore% | Score of the red team |
| %blockball_game_blueScore% | Score of the blue team |
| %blockball_game_time% | Remaining time until the match ends |
| %blockball_game_lastHitPlayerName% | Name of the player who was the last one to hit the ball, returns an empty text if no one has hit the ball yet |
| %blockball_game_state% | Returns JOINABLE,RUNNING,DISABLED |
| %blockball_game_stateDisplayName% | Returns the state color formatted from the language file |
| %blockball_game_isEnabled% | true if the game is enabled, false if not |
| %blockball_game_isJoinAble% | true if the game is joinable, false if not |
| %blockball_game_remainingPlayers% | Remaining amount of players required to start a match in minigame mode |
| %blockball_team_name% | DisplayName of the team. |
| %blockball_team_maxPlayers% | Max amount of player who can join this team |
| %blockball_team_players% | Current amount of players in the team |
| %blockball_player_name% | Name of the player during a BlockBall event e.g. scoring goal |
| %blockball_player_isInGame% | true if the player is in a game, false if not |
| %blockball_player_isInTeamRed% | true if the player is in a game and in team red, false if not |
| %blockball_player_isInTeamBlue% | true if the player is in a game and in team blue, false if not |
| %blockball_player_goals% | Amount of goals a player has scored |
| %blockball_player_games% | Amount of games a player has started playing |
| %blockball_player_gamesFull% | Amount of games a player has fully played |
| %blockball_player_wins% | Amount of wins a player has got by playing |
| %blockball_player_losses% | Amount of losses a player has got by playing|
| %blockball_player_winrate% | Ratio between amount of games a player has started playing and wins|
| %blockball_player_winrateFull% | Ratio between amount of games a player has fully played and wins|
| %blockball_player_goalsPerGame% | Ratio between amount of games a player has started playing and scored goals|
| %blockball_player_goalsPerGameFull% | Ratio between amount of games a player has fully played and scored goals|
| Game Context Placeholders | Description |
|------------------------------------|---------------------------------------------------------------------------------------------------------------|
| %blockball_game_name% | Id of the game |
| %blockball_game_displayName% | DisplayName of the game |
| %blockball_game_maxPlayers% | Max amount of players who can join this game |
| %blockball_game_players% | Current amount of players in this game |
| %blockball_game_redScore% | Score of the red team |
| %blockball_game_blueScore% | Score of the blue team |
| %blockball_game_time% | Remaining time until the match ends |
| %blockball_game_lastHitPlayerName% | Name of the player who was the last one to hit the ball, returns an empty text if no one has hit the ball yet |
| %blockball_game_lastHitPlayerTeam% | DisplayName of the team of the player who was the last one to hit the ball. |
| %blockball_game_state% | Returns JOINABLE,RUNNING,DISABLED |
| %blockball_game_stateDisplayName% | Returns the state color formatted from the language file |
| %blockball_game_isEnabled% | true if the game is enabled, false if not |
| %blockball_game_isJoinAble% | true if the game is joinable, false if not |
| %blockball_game_remainingPlayers% | Remaining amount of players required to start a match in minigame mode |

| Player Context Placeholders | Description |
|---------------------------------|---------------------------------------------------------------------------------------------------------------|
| %blockball_player_name% | Name of the player during a BlockBall event e.g. scoring goal |
| %blockball_player_isInGame% | true if the player is in a game, false if not |
| %blockball_player_isInTeamRed% | true if the player is in a game and in team red, false if not |
| %blockball_player_isInTeamBlue% | true if the player is in a game and in team blue, false if not | |

| Stats Placeholders (Patreon Only) | Description |
|------------------------------------------|-----------------------------------------------------------------------------------|
| %blockball_player_goals% | Amount of goals a player has scored |
| %blockball_player_goalsFull% | Amount of goals a player has scored by playing full games. |
| %blockball_player_ownGoals% | Amount of own goals a player has scored |
| %blockball_player_ownGoalsFull% | Amount of own goals a player has scored by playing full games. |
| %blockball_player_totalGoals% | Amount of goals and own goals a player has scored |
| %blockball_player_totalGoalsFull% | Amount of goals and own goals a player has scored by playing full games. |
| %blockball_player_games% | Amount of games a player has started playing |
| %blockball_player_gamesFull% | Amount of games a player has fully played |
| %blockball_player_wins% | Amount of wins a player has got by playing |
| %blockball_player_losses% | Amount of losses a player has got by playing |
| %blockball_player_winrate% | Ratio between amount of games a player has started playing and wins |
| %blockball_player_winrateFull% | Ratio between amount of games a player has fully played and wins |
| %blockball_player_goalsPerGame% | Ratio between amount of games a player has started playing and scored goals |
| %blockball_player_goalsPerGameFull% | Ratio between amount of games a player has fully played and scored goals |
| %blockball_player_ownGoalsPerGame% | Ratio between amount of games a player has started playing and scored own goals |
| %blockball_player_ownGoalsPerGameFull% | Ratio between amount of games a player has fully played and scored own goals |
| %blockball_player_totalGoalsPerGame% | Ratio between amount of games a player has started playing and scored total goals |
| %blockball_player_totalGoalsPerGameFull% | Ratio between amount of games a player has fully played and scored total goals |
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ object BlockBallLanguageImpl : BlockBallLanguage {
/** 60 **/
override var winDrawStay : String = "60"

/** Team Red **/
override var teamRedDisplayName : String = "Team Red"

/** Allows to reload all games or a specific single one. **/
override var commandReloadToolTip : String = "Allows to reload all games or a specific single one."

Expand Down Expand Up @@ -266,4 +269,7 @@ object BlockBallLanguageImpl : BlockBallLanguage {

/** 60 **/
override var scoreBlueStay : String = "60"

/** Team Blue **/
override var teamBlueDisplayName : String = "Team Blue"
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ interface BlockBallLanguage {
/** 60 **/
var winDrawStay : String

/** Team Red **/
var teamRedDisplayName : String

/** Allows to reload all games or a specific single one. **/
var commandReloadToolTip : String

Expand Down Expand Up @@ -264,4 +267,7 @@ interface BlockBallLanguage {

/** 60 **/
var scoreBlueStay : String

/** Team Blue **/
var teamBlueDisplayName : String
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ interface SoccerGame {
/**
* All players which are already fix in team red.
*/
val redTeam: List<Player>
val redTeam: Set<Player>

/**
* All players which are already fix in team blue.
*/
val blueTeam: List<Player>
val blueTeam: Set<Player>

/**
* Status.
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/github/shynixn/blockball/entity/GameStorage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ class GameStorage {
*/
var walkingSpeed: Double = 1.0

/**
* Counter of enemy goals.
*/
var scoredGoals : Int = 0

/**
* Counter of scored own goals.
*/
var scoredOwnGoals : Int = 0

/**
* Inventory cache.
*/
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/github/shynixn/blockball/entity/StatsMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@ package com.github.shynixn.blockball.entity

class StatsMeta {
/**
* Scored amount of goals.
* Version of the tracking.
*/
var version: Int = 1

/**
* Scored goals in enemy goal.
*/
var scoredGoals: Int = 0

/**
* Scored goals in enemy goal over all win games.
*/
var scoredGoalsFull: Int = 0

/**
* Scored goals in own goal.
*/
var scoredOwnGoals: Int = 0

/**
* Scored goals in own goal over all win games.
*/
var scoredOwnGoalsFull: Int = 0

/**
* Amount of completed played games.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ enum class PlaceHolder(
*/
val fullPlaceHolder: String
) {

// Game PlaceHolders
GAME_DISPLAYNAME("%blockball_game_displayName%"),

GAME_NAME("%blockball_game_name%"),

GAME_DISPLAYNAME("%blockball_game_displayName%"),

GAME_SUM_MAXPLAYERS("%blockball_game_maxPlayers%"),

GAME_SUM_CURRENTPLAYERS("%blockball_game_players%"),
Expand All @@ -23,6 +25,8 @@ enum class PlaceHolder(

GAME_LASTHITPLAYER_NAME("%blockball_game_lastHitPlayerName%"),

GAME_LASTHITPLAYER_TEAM_NAME("%blockball_game_lastHitPlayerTeam%"),

GAME_STATE("%blockball_game_state%"),

GAME_STATE_DISPLAYNAME("%blockball_game_stateDisplayName%"),
Expand All @@ -33,16 +37,6 @@ enum class PlaceHolder(

GAME_REMAININGPLAYERS_TO_START("%blockball_game_remainingPlayers%"),

// Team PlaceHolders

TEAM_NAME("%blockball_team_name%"),

TEAM_COLOR("%blockball_team_color%"),

TEAM_MAX_PLAYERS("%blockball_team_maxPlayers%"),

TEAM_PLAYERS("%blockball_team_players%"),

// Player PlaceHolders

PLAYER_NAME("%blockball_player_name%"),
Expand All @@ -53,21 +47,41 @@ enum class PlaceHolder(

PLAYER_IS_IN_TEAM_BLUE("%blockball_player_isInTeamBlue%"),

PLAYER_STATS_SCOREDGOALS("%blockball_player_goals%"),
// Play Stats PlaceHolders

PLAYER_STATS_STARTEDGAMES("%blockball_player_games%"),
PLAYER_STATS_GOALS("%blockball_player_goals%"),

PLAYER_STATS_COMPLETEDGAMES("%blockball_player_gamesFull%"),
PLAYER_STATS_GOALSFULL("%blockball_player_goalsFull%"),

PLAYER_STATS_OWNGOALS("%blockball_player_ownGoals%"),

PLAYER_STATS_OWNGOALSFULL("%blockball_player_ownGoalsFull%"),

PLAYER_STATS_TOTALGOALS("%blockball_player_totalGoals%"),

PLAYER_STATS_TOTALGOALSFULL("%blockball_player_totalGoalsFull%"),

PLAYER_STATS_GAMES("%blockball_player_games%"),

PLAYER_STATS_GAMESFULL("%blockball_player_gamesFull%"),

PLAYER_STATS_WINS("%blockball_player_wins%"),

PLAYER_STATS_LOSSES("%blockball_player_losses%"),

PLAYER_STATS_STARTEDWINRATE("%blockball_player_winrate%"),
PLAYER_STATS_WINRATE("%blockball_player_winrate%"),

PLAYER_STATS_WINRATEFULL("%blockball_player_winrateFull%"),

PLAYER_STATS_GOALSPERGAME("%blockball_player_goalsPerGame%"),

PLAYER_STATS_GOALSPERGAMEFULL("%blockball_player_goalsPerGameFull%"),

PLAYER_STATS_OWNGOALSPERGAME("%blockball_player_ownGoalsPerGame%"),

PLAYER_STATS_COMPLETEDWINRATE("%blockball_player_winrateFull%"),
PLAYER_STATS_OWNGOALSPERGAMEFULL("%blockball_player_ownGoalsPerGameFull%"),

PLAYER_STATS_STARTEDGOALSPER("%blockball_player_goalsPerGame%"),
PLAYER_STATS_TOTALGOALSPERGAME("%blockball_player_totalGoalsPerGame%"),

PLAYER_STATS_COMPLETEDGOALSPER("%blockball_player_goalsPerGameFull%")
PLAYER_STATS_TOTALGOALSPERGAMEFULL("%blockball_player_totalGoalsPerGameFull%")
}
Loading

0 comments on commit 6ad6e84

Please sign in to comment.