Skip to content

Commit

Permalink
Merge pull request #547 from Shynixn/development
Browse files Browse the repository at this point in the history
Merge changes to master --release
  • Loading branch information
Shynixn authored Aug 24, 2024
2 parents 19f7828 + dd78d8a commit dce7f3d
Show file tree
Hide file tree
Showing 22 changed files with 480 additions and 313 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Shynixn Plugin Distribution LICENCE

You are not allowed to redistribute the BlockBall binary files.
The plugin binary files are BlockBall.jar, BlockBall-Legacy.jar and BlockBall-Premium.jar.

Commercial usage of this plugin is only allowed by obtaining a lifetime licence of a particular version of the BlockBall-Legacy.jar or BlockBall-Premium.jar plugin.
e.g. being an actively paying subscribed member of the Patreon https://www.patreon.com/Shynixn at the time this particular version was available.
You do not have any rights on any potential future released versions. You need to obtain a new licence for each individual version.

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ BlockBall is a spigot plugin to play soccer games in Minecraft.

![alt tag](http://www.mediafire.com/convkey/3383/6zhpiiijhk022s5zg.jpg)
![alt tag](http://www.mediafire.com/convkey/a253/ur76bhb6doccomvzg.jpg)

# Licence

Take a look into the ``LICENCE`` file for further details.

* Shynixn Plugin Distribution LICENCE
* GNU GENERAL PUBLIC LICENSE Version 3
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 = "7.1.0"
version = "7.2.0"

repositories {
mavenLocal()
Expand Down 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
2 changes: 2 additions & 0 deletions docs/wiki/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ public class YourPlugin extends JavaPlugin {
}
}
```

BlockBall broadcasts the following [events.](https://github.com/Shynixn/BlockBall/tree/master/src/main/java/com/github/shynixn/blockball/event)
5 changes: 2 additions & 3 deletions docs/wiki/docs/permission.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ The following permissions are available in BlockBall.
|--------------------------|------------|------------------------------------------------------------------------------------------------------|
| blockball.command | User | Allows to use the /blockball command. |
| blockball.join.* | User | Allows to join all games. The **blockball.command** permission is also required. |
| blockball.join.[name] | User | Allows to join a specific game. The **blockball.command** permission is also required. |
| blockball.edit | Admin | Allows to create, edit and delete games. |
| blockball.join.[name] | User | Allows to join a specific game. The **blockball.command** permission is also required. |
| blockball.command.staff | Admin/User | Allows to execute commands while ingame. This permission will be replaced in the future. |
| blockball.game.inventory | Admin/User | Allows open and click in inventories while ingame. This permission will be replaced in the future. |

| blockball.edit | Admin | Allows to create, edit and delete games. |

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 @@ -123,6 +123,9 @@ object BlockBallLanguageImpl : BlockBallLanguage {
/** **/
override var leaveSignLine4 : String = ""

/** &0&l[&f&lBlockBall&0&l]&7 &cFailed to reload arena %1$1s. Recommended action: &e%2$1s **/
override var failedToReloadMessage : String = "&0&l[&f&lBlockBall&0&l]&7 &cFailed to reload arena %1$1s. Recommended action: &e%2$1s"

/** 20 **/
override var winBlueFadeIn : String = "20"

Expand Down Expand Up @@ -219,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 @@ -263,4 +269,7 @@ object BlockBallLanguageImpl : BlockBallLanguage {

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

/** Team Blue **/
override var teamBlueDisplayName : String = "Team Blue"
}
14 changes: 10 additions & 4 deletions src/main/java/com/github/shynixn/blockball/BlockBallPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.github.shynixn.blockball.contract.SoccerBallFactory
import com.github.shynixn.blockball.entity.PlayerInformation
import com.github.shynixn.blockball.entity.SoccerArena
import com.github.shynixn.blockball.impl.commandexecutor.BlockBallCommandExecutor
import com.github.shynixn.blockball.impl.exception.SoccerGameException
import com.github.shynixn.blockball.impl.listener.*
import com.github.shynixn.mccoroutine.bukkit.launch
import com.github.shynixn.mcutils.common.ChatColor
Expand Down Expand Up @@ -132,16 +133,17 @@ class BlockBallPlugin : JavaPlugin() {
// Load Language
val language = configurationService.findValue<String>("language")
try {
plugin.reloadTranslation(language, BlockBallLanguageImpl::class.java, "en_us")
plugin.reloadTranslation(language, BlockBallLanguageImpl::class.java, "en_us", "es_es")
logger.log(Level.INFO, "Loaded language file $language.properties.")
} catch (e: Exception) {
// Compatibility to < 6.46.3
Files.move(
plugin.dataFolder.toPath().resolve("lang").resolve("en_us.properties"),
plugin.dataFolder.toPath().resolve("lang").resolve("old_" + UUID.randomUUID().toString() + ".properties"),
plugin.dataFolder.toPath().resolve("lang")
.resolve("old_" + UUID.randomUUID().toString() + ".properties"),
StandardCopyOption.REPLACE_EXISTING
)
plugin.reloadTranslation(language, BlockBallLanguageImpl::class.java, "en_us")
plugin.reloadTranslation(language, BlockBallLanguageImpl::class.java, "en_us", "es_es")
logger.log(
Level.WARNING,
"Your language file is not compatible. Your existing file has been renamed and the original file has been reset."
Expand All @@ -151,7 +153,11 @@ class BlockBallPlugin : JavaPlugin() {

// Load Games
val gameService = module.getService<GameService>()
gameService.reloadAll()
try {
gameService.reloadAll()
} catch (e: SoccerGameException) {
plugin.logger.log(Level.WARNING, "Cannot start game of soccerArena ${e.arena.name}.", e)
}

// Connect to PlayerData Repository.
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ interface BlockBallLanguage {
/** **/
var leaveSignLine4 : String

/** &0&l[&f&lBlockBall&0&l]&7 &cFailed to reload arena %1$1s. Recommended action: &e%2$1s **/
var failedToReloadMessage : String

/** 20 **/
var winBlueFadeIn : String

Expand Down Expand Up @@ -217,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 @@ -261,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
Loading

0 comments on commit dce7f3d

Please sign in to comment.