diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..462a49c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +# These are supported funding model platforms +patreon: Shynixn diff --git a/build.gradle.kts b/build.gradle.kts index c854257..04dc367 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,7 +19,7 @@ repositories { } tasks.register("printVersion") { - println(version) + println(version) } dependencies { @@ -38,7 +38,7 @@ dependencies { implementation("com.google.code.gson:gson:2.8.6") // Custom dependencies - implementation("com.github.shynixn.mcutils:common:2024.25") + implementation("com.github.shynixn.mcutils:common:2024.36") implementation("com.github.shynixn.mcutils:packet:2024.42") implementation("com.github.shynixn.mcutils:sign:2024.3") implementation("com.github.shynixn.mcutils:guice:2024.2") @@ -196,26 +196,27 @@ tasks.register("pluginJarLegacy", com.github.jengelman.gradle.plugins.shadow.tas tasks.register("languageFile") { val kotlinSrcFolder = project.sourceSets.toList()[0].allJava.srcDirs.first { e -> e.endsWith("kotlin") } - val languageKotlinFile = kotlinSrcFolder.resolve("com/github/shynixn/mctennis/MCTennisLanguage.kt") - val resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.properties") - val bundle = FileInputStream(resourceFile).use { stream -> - PropertyResourceBundle(stream) - } + val contractFile = kotlinSrcFolder.resolve("com/github/shynixn/mctennis/contract/Language.kt") + val resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.yaml") + val lines = resourceFile.readLines() val contents = ArrayList() - contents.add("package com.github.shynixn.mctennis") + contents.add("package com.github.shynixn.mctennis.contract") + contents.add("") + contents.add("import com.github.shynixn.mcutils.common.language.LanguageItem") + contents.add("import com.github.shynixn.mcutils.common.language.LanguageProvider") contents.add("") - contents.add("object MCTennisLanguage {") - for (key in bundle.keys) { - val value = bundle.getString(key) - contents.add(" /** $value **/") - contents.add(" var ${key} : String = \"$value\"") - contents.add("") + contents.add("interface Language : LanguageProvider {") + for (key in lines) { + if (key.toCharArray()[0].isLetter()) { + contents.add(" var ${key} LanguageItem") + contents.add("") + } } contents.removeLast() contents.add("}") - languageKotlinFile.printWriter().use { out -> + contractFile.printWriter().use { out -> for (line in contents) { out.println(line) } diff --git a/docs/wiki/docs/placeholders.md b/docs/wiki/docs/placeholders.md index 22efe53..462df8e 100644 --- a/docs/wiki/docs/placeholders.md +++ b/docs/wiki/docs/placeholders.md @@ -31,8 +31,8 @@ The following placeholders are available in MCTennis and can also be used via Pl | Player PlaceHolders | Description | |----------------------------|-------------------------------------------------| +| %mctennis_player_name% | Name of the player during an event e.g. | | %mctennis_player_isInGame% | true if the player is in the game, false if not | -| %mctennis_player_name% | Name of the player | | Game and Player PlaceHolders | Description | |----------------------------------|--------------------------------------------------| diff --git a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisDependencyInjectionModule.kt b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisDependencyInjectionModule.kt index 8451a86..2b9093e 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisDependencyInjectionModule.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisDependencyInjectionModule.kt @@ -2,10 +2,7 @@ package com.github.shynixn.mctennis import com.fasterxml.jackson.core.type.TypeReference import com.github.shynixn.mccoroutine.bukkit.launch -import com.github.shynixn.mctennis.contract.BedrockService -import com.github.shynixn.mctennis.contract.GameService -import com.github.shynixn.mctennis.contract.PlaceHolderService -import com.github.shynixn.mctennis.contract.TennisBallFactory +import com.github.shynixn.mctennis.contract.* import com.github.shynixn.mctennis.entity.TennisArena import com.github.shynixn.mctennis.enumeration.PluginDependency import com.github.shynixn.mctennis.impl.service.* @@ -54,6 +51,14 @@ class MCTennisDependencyInjectionModule(private val plugin: Plugin) : Dependency override fun configure() { // Common addService(plugin) + addService { + val chatMessageService = getService() + val language = MCTennisLanguageImpl() + language.chatMessageService = chatMessageService + language.placeHolderFun = + { text, player -> getService().replacePlaceHolders(text, player) } + language + } // Repositories val tennisArenaRepository = YamlFileRepositoryImpl(plugin, @@ -67,7 +72,7 @@ class MCTennisDependencyInjectionModule(private val plugin: Plugin) : Dependency // Services addService { - SignServiceImpl(plugin, getService(), MCTennisLanguage.noPermissionMessage) + SignServiceImpl(plugin, getService(), getService().noPermissionMessage.text) } addService { PhysicObjectServiceImpl(plugin, getService()) diff --git a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguage.kt b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguage.kt deleted file mode 100644 index 1c6395e..0000000 --- a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguage.kt +++ /dev/null @@ -1,186 +0,0 @@ -package com.github.shynixn.mctennis - -object MCTennisLanguage { - /** %2$1s scored for &cTeam Red. **/ - var scoreRedSubTitle : String = "%2$1s scored for &cTeam Red." - - /** &9&l%1$1s **/ - var scoreBlueTitle : String = "&9&l%1$1s" - - /** &cTeam Red **/ - var winRedTitle : String = "&cTeam Red" - - /** &1Running **/ - var gameStateRunning : String = "&1Running" - - /** [&9MCTennis&f] Game %1$1s already exists. **/ - var gameAlreadyExistsMessage : String = "[&9MCTennis&f] Game %1$1s already exists." - - /** [&9MCTennis&f] Successfully joined team blue. **/ - var joinTeamBlueMessage : String = "[&9MCTennis&f] Successfully joined team blue." - - /** [&9MCTennis&f] Team %1$1s does not exist. **/ - var teamDoesNotExistMessage : String = "[&9MCTennis&f] Team %1$1s does not exist." - - /** &cTeam Red &ahas won this set **/ - var winSetRedSubTitle : String = "&cTeam Red &ahas won this set" - - /** This version of MCTennis does only allow 1 game per server. Go to https://patreon.com/Shynixn for the premium version. **/ - var freeVersionMessage : String = "This version of MCTennis does only allow 1 game per server. Go to https://patreon.com/Shynixn for the premium version." - - /** [&9MCTennis&f] Reloaded game %1$1s. **/ - var reloadedGameMessage : String = "[&9MCTennis&f] Reloaded game %1$1s." - - /** &9Team Blue &ahas won the match **/ - var winBlueSubTitle : String = "&9Team Blue &ahas won the match" - - /** A sign was added to the game. **/ - var addedSignMessage : String = "A sign was added to the game." - - /** [&9MCTennis&f] Left the game. **/ - var leftGameMessage : String = "[&9MCTennis&f] Left the game." - - /** [&9MCTennis&f] Reloaded all games. **/ - var reloadedAllGamesMessage : String = "[&9MCTennis&f] Reloaded all games." - - /** &f[&r&lMCTennis&r&f] **/ - var joinSignLine1 : String = "&f[&r&lMCTennis&r&f]" - - /** %mctennis_game_stateDisplayName% **/ - var joinSignLine2 : String = "%mctennis_game_stateDisplayName%" - - /** [&9MCTennis&f] You do not have permission to join game %1$1s. **/ - var noPermissionForGameMessage : String = "[&9MCTennis&f] You do not have permission to join game %1$1s." - - /** [&9MCTennis&f] Updated armor of game. **/ - var updatedArmorMessage : String = "[&9MCTennis&f] Updated armor of game." - - /** [&9MCTennis&f] Not enough players! Game start was cancelled. **/ - var notEnoughPlayersMessage : String = "[&9MCTennis&f] Not enough players! Game start was cancelled." - - /** [&9MCTennis&f] Use /mctennis help to see more info about the plugin. **/ - var commandUsage : String = "[&9MCTennis&f] Use /mctennis help to see more info about the plugin." - - /** %mctennis_game_players%/%mctennis_game_maxPlayers% **/ - var joinSignLine3 : String = "%mctennis_game_players%/%mctennis_game_maxPlayers%" - - /** **/ - var joinSignLine4 : String = "" - - /** &c&l%1$1s **/ - var scoreRedTitle : String = "&c&l%1$1s" - - /** RightClick on a sign to convert it into a game sign. **/ - var rightClickOnSignMessage : String = "RightClick on a sign to convert it into a game sign." - - /** &l2nd Bounce **/ - var bounceSecondHologram : String = "&l2nd Bounce" - - /** [&9MCTennis&f] %1$1s second(s) remaining. **/ - var secondsRemaining : String = "[&9MCTennis&f] %1$1s second(s) remaining." - - /** &4Disabled **/ - var gameStateDisabled : String = "&4Disabled" - - /** [&9MCTennis&f] Game is starting in %1$1d seconds. **/ - var gameStartingMessage : String = "[&9MCTennis&f] Game is starting in %1$1d seconds." - - /** [&9MCTennis&f] Created game %1$1s. **/ - var gameCreatedMessage : String = "[&9MCTennis&f] Created game %1$1s." - - /** &f[&r&lMCTennis&r&f] **/ - var leaveSignLine1 : String = "&f[&r&lMCTennis&r&f]" - - /** &f&lLeave **/ - var leaveSignLine2 : String = "&f&lLeave" - - /** &9Team Blue &ahas won this set **/ - var winSetBlueSubTitle : String = "&9Team Blue &ahas won this set" - - /** %mctennis_game_players%/%mctennis_game_maxPlayers% **/ - var leaveSignLine3 : String = "%mctennis_game_players%/%mctennis_game_maxPlayers%" - - /** This sign type does not exist. **/ - var signTypeDoesNotExist : String = "This sign type does not exist." - - /** [&9MCTennis&f] Game has been cancelled. **/ - var gameCancelledMessage : String = "[&9MCTennis&f] Game has been cancelled." - - /** **/ - var leaveSignLine4 : String = "" - - /** &aJoin **/ - var gameStateJoinAble : String = "&aJoin" - - /** &6&lReady? **/ - var readyTitle : String = "&6&lReady?" - - /** &9Team Blue **/ - var winSetBlueTitle : String = "&9Team Blue" - - /** All commands for the MCTennis plugin. **/ - var commandDescription : String = "All commands for the MCTennis plugin." - - /** [&9MCTennis&f] This location type is not known. For more locations, open the arena.yml. **/ - var locationTypeDoesNotExistMessage : String = "[&9MCTennis&f] This location type is not known. For more locations, open the arena.yml." - - /** [&9MCTennis&f] You do not have permission. **/ - var noPermissionMessage : String = "[&9MCTennis&f] You do not have permission." - - /** [&9MCTennis&f] Game enable state was set to %1$1s. **/ - var enabledArenaMessage : String = "[&9MCTennis&f] Game enable state was set to %1$1s." - - /** &cTeam Red &ahas won the match **/ - var winRedSubTitle : String = "&cTeam Red &ahas won the match" - - /** The text length has to be less than 20 characters. **/ - var maxLength20Characters : String = "The text length has to be less than 20 characters." - - /** %2$1s scored for &9Team Blue. **/ - var scoreBlueSubTitle : String = "%2$1s scored for &9Team Blue." - - /** [&9MCTennis&f] Successfully joined team red. **/ - var joinTeamRedMessage : String = "[&9MCTennis&f] Successfully joined team red." - - /** [&9MCTennis&f] Game %1$1s does not exist. **/ - var gameDoesNotExistMessage : String = "[&9MCTennis&f] Game %1$1s does not exist." - - /** [&9MCTennis&f] Game is already full. **/ - var gameIsFullMessage : String = "[&9MCTennis&f] Game is already full." - - /** [&9MCTennis&f] Deleted game %1$1s. **/ - var deletedGameMessage : String = "[&9MCTennis&f] Deleted game %1$1s." - - /** &9Team Blue **/ - var winBlueTitle : String = "&9Team Blue" - - /** **/ - var readySubTitle : String = "" - - /** &lOut **/ - var bounceOutHologram : String = "&lOut" - - /** [&9MCTennis&f] Game start has been cancelled. **/ - var gameStartCancelledMessage : String = "[&9MCTennis&f] Game start has been cancelled." - - /** [&9MCTennis&f] Updated inventory of game. **/ - var updatedInventoryMessage : String = "[&9MCTennis&f] Updated inventory of game." - - /** [&9MCTennis&f] Location was set on %1$1s. **/ - var spawnPointSetMessage : String = "[&9MCTennis&f] Location was set on %1$1s." - - /** [&9MCTennis&f] Player %1$1s has scored for team %2$1s. **/ - var playerScoredMessage : String = "[&9MCTennis&f] Player %1$1s has scored for team %2$1s." - - /** &aThe game has ended in a draw **/ - var winDrawSubTitle : String = "&aThe game has ended in a draw" - - /** The command sender has to be a player! **/ - var commandSenderHasToBePlayer : String = "The command sender has to be a player!" - - /** &cTeam Red **/ - var winSetRedTitle : String = "&cTeam Red" - - /** &fDraw **/ - var winDrawTitle : String = "&fDraw" -} diff --git a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguageImpl.kt b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguageImpl.kt new file mode 100644 index 0000000..60c6e9d --- /dev/null +++ b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisLanguageImpl.kt @@ -0,0 +1,116 @@ +package com.github.shynixn.mctennis + +import com.github.shynixn.mctennis.contract.Language +import com.github.shynixn.mcutils.common.language.LanguageItem +import com.github.shynixn.mcutils.common.language.LanguageProviderImpl + +class MCTennisLanguageImpl() : Language, LanguageProviderImpl() { + override val names: List + get() = listOf("en_us") + + override var gameStartingMessage: LanguageItem = LanguageItem() + + override var gameStartCancelledMessage: LanguageItem = LanguageItem() + + override var gameDoesNotExistMessage: LanguageItem = LanguageItem() + + override var noPermissionForGameMessage: LanguageItem = LanguageItem() + + override var noPermissionMessage: LanguageItem = LanguageItem() + + override var locationTypeDoesNotExistMessage: LanguageItem = LanguageItem() + + override var spawnPointSetMessage: LanguageItem = LanguageItem() + + override var gameAlreadyExistsMessage: LanguageItem = LanguageItem() + + override var enabledArenaMessage: LanguageItem = LanguageItem() + + override var gameIsFullMessage: LanguageItem = LanguageItem() + + override var gameCreatedMessage: LanguageItem = LanguageItem() + + override var reloadedAllGamesMessage: LanguageItem = LanguageItem() + + override var reloadedGameMessage: LanguageItem = LanguageItem() + + override var joinTeamRedMessage: LanguageItem = LanguageItem() + + override var joinTeamBlueMessage: LanguageItem = LanguageItem() + + override var leftGameMessage: LanguageItem = LanguageItem() + + override var deletedGameMessage: LanguageItem = LanguageItem() + + override var notEnoughPlayersMessage: LanguageItem = LanguageItem() + + override var teamDoesNotExistMessage: LanguageItem = LanguageItem() + + override var updatedInventoryMessage: LanguageItem = LanguageItem() + + override var updatedArmorMessage: LanguageItem = LanguageItem() + + override var secondsRemaining: LanguageItem = LanguageItem() + + override var gameCancelledMessage: LanguageItem = LanguageItem() + + override var scoreRed: LanguageItem = LanguageItem() + + override var scoreBlue: LanguageItem = LanguageItem() + + override var winRed: LanguageItem = LanguageItem() + + override var winSetRed: LanguageItem = LanguageItem() + + override var winBlue: LanguageItem = LanguageItem() + + override var winSetBlue: LanguageItem = LanguageItem() + + override var winDraw: LanguageItem = LanguageItem() + + override var readyMessage: LanguageItem = LanguageItem() + + override var bounceOutHologram: LanguageItem = LanguageItem() + + override var bounceSecondHologram: LanguageItem = LanguageItem() + + override var joinSignLine1: LanguageItem = LanguageItem() + + override var joinSignLine2: LanguageItem = LanguageItem() + + override var joinSignLine3: LanguageItem = LanguageItem() + + override var joinSignLine4: LanguageItem = LanguageItem() + + override var leaveSignLine1: LanguageItem = LanguageItem() + + override var leaveSignLine2: LanguageItem = LanguageItem() + + override var leaveSignLine3: LanguageItem = LanguageItem() + + override var leaveSignLine4: LanguageItem = LanguageItem() + + override var gameStateJoinAble: LanguageItem = LanguageItem() + + override var gameStateDisabled: LanguageItem = LanguageItem() + + override var gameStateRunning: LanguageItem = LanguageItem() + + override var rightClickOnSignMessage: LanguageItem = LanguageItem() + + override var signTypeDoesNotExist: LanguageItem = LanguageItem() + + override var addedSignMessage: LanguageItem = LanguageItem() + + override var commandDescription: LanguageItem = LanguageItem() + + override var commandUsage: LanguageItem = LanguageItem() + + override var maxLength20Characters: LanguageItem = LanguageItem() + + override var commandSenderHasToBePlayer: LanguageItem = LanguageItem() + + override var freeVersionMessage: LanguageItem = LanguageItem() + + override var commandPlaceHolderMessage: LanguageItem = LanguageItem() +} diff --git a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisPlugin.kt b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisPlugin.kt index 603598e..26749f3 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/MCTennisPlugin.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/MCTennisPlugin.kt @@ -1,10 +1,7 @@ package com.github.shynixn.mctennis import com.github.shynixn.mccoroutine.bukkit.launch -import com.github.shynixn.mctennis.contract.BedrockService -import com.github.shynixn.mctennis.contract.GameService -import com.github.shynixn.mctennis.contract.PlaceHolderService -import com.github.shynixn.mctennis.contract.TennisBallFactory +import com.github.shynixn.mctennis.contract.* import com.github.shynixn.mctennis.entity.TennisArena import com.github.shynixn.mctennis.enumeration.PluginDependency import com.github.shynixn.mctennis.impl.commandexecutor.MCTennisCommandExecutor @@ -12,10 +9,9 @@ import com.github.shynixn.mctennis.impl.exception.TennisGameException import com.github.shynixn.mctennis.impl.listener.GameListener import com.github.shynixn.mctennis.impl.listener.PacketListener import com.github.shynixn.mctennis.impl.listener.TennisListener -import com.github.shynixn.mcutils.common.ConfigurationService import com.github.shynixn.mcutils.common.Version +import com.github.shynixn.mcutils.common.language.reloadTranslation import com.github.shynixn.mcutils.common.physic.PhysicObjectService -import com.github.shynixn.mcutils.common.reloadTranslation import com.github.shynixn.mcutils.common.repository.Repository import com.github.shynixn.mcutils.packet.api.PacketInType import com.github.shynixn.mcutils.packet.api.PacketService @@ -27,6 +23,10 @@ import org.bukkit.plugin.java.JavaPlugin import java.util.logging.Level class MCTennisPlugin : JavaPlugin() { + companion object{ + var language : Language? = null + } + private val prefix: String = org.bukkit.ChatColor.BLUE.toString() + "[MCTennis] " + org.bukkit.ChatColor.WHITE private var isLoaded = false private lateinit var module: MCTennisDependencyInjectionModule @@ -86,6 +86,12 @@ class MCTennisPlugin : JavaPlugin() { this.module = MCTennisDependencyInjectionModule(this).build() this.reloadConfig() + // Load Language + val mcTennisLanguage = module.getService() + MCTennisPlugin.language = mcTennisLanguage + reloadTranslation(mcTennisLanguage as MCTennisLanguageImpl, MCTennisLanguageImpl::class.java) + logger.log(Level.INFO, "Loaded language file.") + // Register Packet module.getService().registerPacketListening(PacketInType.USEENTITY) @@ -116,11 +122,6 @@ class MCTennisPlugin : JavaPlugin() { val plugin = this plugin.launch { // Load Language - val configurationService = module.getService() - val language = configurationService.findValue("language") - reloadTranslation(language, MCTennisLanguage::class.java, "en_us", "es_es") - logger.log(Level.INFO, "Loaded language file $language.properties.") - // Load Games val gameService = module.getService() try { diff --git a/src/main/kotlin/com/github/shynixn/mctennis/contract/Language.kt b/src/main/kotlin/com/github/shynixn/mctennis/contract/Language.kt new file mode 100644 index 0000000..1adcef4 --- /dev/null +++ b/src/main/kotlin/com/github/shynixn/mctennis/contract/Language.kt @@ -0,0 +1,112 @@ +package com.github.shynixn.mctennis.contract + +import com.github.shynixn.mcutils.common.language.LanguageItem +import com.github.shynixn.mcutils.common.language.LanguageProvider + +interface Language : LanguageProvider { + var gameStartingMessage: LanguageItem + + var gameStartCancelledMessage: LanguageItem + + var gameDoesNotExistMessage: LanguageItem + + var noPermissionForGameMessage: LanguageItem + + var noPermissionMessage: LanguageItem + + var locationTypeDoesNotExistMessage: LanguageItem + + var spawnPointSetMessage: LanguageItem + + var gameAlreadyExistsMessage: LanguageItem + + var enabledArenaMessage: LanguageItem + + var gameIsFullMessage: LanguageItem + + var gameCreatedMessage: LanguageItem + + var reloadedAllGamesMessage: LanguageItem + + var reloadedGameMessage: LanguageItem + + var joinTeamRedMessage: LanguageItem + + var joinTeamBlueMessage: LanguageItem + + var leftGameMessage: LanguageItem + + var deletedGameMessage: LanguageItem + + var notEnoughPlayersMessage: LanguageItem + + var teamDoesNotExistMessage: LanguageItem + + var updatedInventoryMessage: LanguageItem + + var updatedArmorMessage: LanguageItem + + var secondsRemaining: LanguageItem + + var gameCancelledMessage: LanguageItem + + var scoreRed: LanguageItem + + var scoreBlue: LanguageItem + + var winRed: LanguageItem + + var winSetRed: LanguageItem + + var winBlue: LanguageItem + + var winSetBlue: LanguageItem + + var winDraw: LanguageItem + + var readyMessage: LanguageItem + + var bounceOutHologram: LanguageItem + + var bounceSecondHologram: LanguageItem + + var joinSignLine1: LanguageItem + + var joinSignLine2: LanguageItem + + var joinSignLine3: LanguageItem + + var joinSignLine4: LanguageItem + + var leaveSignLine1: LanguageItem + + var leaveSignLine2: LanguageItem + + var leaveSignLine3: LanguageItem + + var leaveSignLine4: LanguageItem + + var gameStateJoinAble: LanguageItem + + var gameStateDisabled: LanguageItem + + var gameStateRunning: LanguageItem + + var rightClickOnSignMessage: LanguageItem + + var signTypeDoesNotExist: LanguageItem + + var addedSignMessage: LanguageItem + + var commandDescription: LanguageItem + + var commandUsage: LanguageItem + + var maxLength20Characters: LanguageItem + + var commandSenderHasToBePlayer: LanguageItem + + var freeVersionMessage: LanguageItem + + var commandPlaceHolderMessage: LanguageItem +} diff --git a/src/main/kotlin/com/github/shynixn/mctennis/entity/TennisArena.kt b/src/main/kotlin/com/github/shynixn/mctennis/entity/TennisArena.kt index ffc175d..4e51621 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/entity/TennisArena.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/entity/TennisArena.kt @@ -50,6 +50,11 @@ class TennisArena : Element { */ var setsToWin: Int = 3 + /** + * If set to true, the player keeps their inventory on join. + */ + var keepInventory: Boolean = false + /** * Leave spawnpoint. */ diff --git a/src/main/kotlin/com/github/shynixn/mctennis/impl/TennisGameImpl.kt b/src/main/kotlin/com/github/shynixn/mctennis/impl/TennisGameImpl.kt index 9f4bfa9..8cc928e 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/impl/TennisGameImpl.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/impl/TennisGameImpl.kt @@ -4,11 +4,7 @@ import com.github.shynixn.mccoroutine.bukkit.CoroutineTimings import com.github.shynixn.mccoroutine.bukkit.launch import com.github.shynixn.mccoroutine.bukkit.minecraftDispatcher import com.github.shynixn.mccoroutine.bukkit.ticks -import com.github.shynixn.mctennis.MCTennisLanguage -import com.github.shynixn.mctennis.contract.PlaceHolderService -import com.github.shynixn.mctennis.contract.TennisBall -import com.github.shynixn.mctennis.contract.TennisBallFactory -import com.github.shynixn.mctennis.contract.TennisGame +import com.github.shynixn.mctennis.contract.* import com.github.shynixn.mctennis.entity.PlayerData import com.github.shynixn.mctennis.entity.TeamMetadata import com.github.shynixn.mctennis.entity.TennisArena @@ -37,7 +33,8 @@ class TennisGameImpl( private val chatMessageService: ChatMessageService, private val plugin: Plugin, private val commandService: CommandService, - private val placeHolderService: PlaceHolderService + private val placeHolderService: PlaceHolderService, + private val language: Language ) : TennisGame { private var isDisposed = false @@ -226,16 +223,11 @@ class TennisGameImpl( if (team == Team.RED) { teamRedScore++ - sendTitleMessageToPlayers( - MCTennisLanguage.scoreRedTitle.format(getScoreText(), player.name), - MCTennisLanguage.scoreRedSubTitle.format(getScoreText(), player.name) - ) + language.sendMessageToPlayers(language.scoreRed, getPlayers(), player.name) + } else { teamBlueScore++ - sendTitleMessageToPlayers( - MCTennisLanguage.scoreBlueTitle.format(getScoreText(), player.name), - MCTennisLanguage.scoreBlueSubTitle.format(getScoreText(), player.name) - ) + language.sendMessageToPlayers(language.scoreBlue, getPlayers(), player.name) } plugin.launch { @@ -260,17 +252,17 @@ class TennisGameImpl( // Wait in lobby. for (i in 0 until arena.timeToStart) { val remaining = arena.timeToStart - i - sendMessageToPlayers(MCTennisLanguage.gameStartingMessage.format(remaining)) + language.sendMessageToPlayers(language.gameStartingMessage, getPlayers(), remaining) delay(1000L) if (!arena.isEnabled) { dispose() - sendMessageToPlayers(MCTennisLanguage.gameStartCancelledMessage) + language.sendMessageToPlayers(language.gameStartCancelledMessage, getPlayers()) return } if (teamBluePlayers.size < arena.minPlayersPerTeam || teamRedPlayers.size < arena.minPlayersPerTeam) { - sendMessageToPlayers(MCTennisLanguage.notEnoughPlayersMessage) + language.sendMessageToPlayers(language.notEnoughPlayersMessage, getPlayers()) gameState = GameState.LOBBY_IDLE return } @@ -283,35 +275,38 @@ class TennisGameImpl( // Store cache data. delay(250) - for (player in cachedData.keys) { - val playerData = cachedData[player]!! - playerData.armorContents = player.inventory.armorContents.clone() - playerData.inventoryContents = player.inventory.contents.clone() - - val teamMeta = if (teamBluePlayers.contains(player)) { - arena.blueTeamMeta - } else { - arena.redTeamMeta - } - - player.inventory.contents = teamMeta.inventoryContents.map { - if (it != null) { - val configuration = YamlConfiguration() - configuration.loadFromString(it) - configuration.getItemStack("item") - } else { - null - } - }.toTypedArray() - player.inventory.setArmorContents(teamMeta.armorInventoryContents.map { - if (it != null) { - val configuration = YamlConfiguration() - configuration.loadFromString(it) - configuration.getItemStack("item") + if (!arena.keepInventory) { + for (player in cachedData.keys) { + val playerData = cachedData[player]!! + // As long as the armor contents are not set. It is also not restored. + playerData.armorContents = player.inventory.armorContents.clone() + playerData.inventoryContents = player.inventory.contents.clone() + + val teamMeta = if (teamBluePlayers.contains(player)) { + arena.blueTeamMeta } else { - null + arena.redTeamMeta } - }.toTypedArray()) + + player.inventory.contents = teamMeta.inventoryContents.map { + if (it != null) { + val configuration = YamlConfiguration() + configuration.loadFromString(it) + configuration.getItemStack("item") + } else { + null + } + }.toTypedArray() + player.inventory.setArmorContents(teamMeta.armorInventoryContents.map { + if (it != null) { + val configuration = YamlConfiguration() + configuration.loadFromString(it) + configuration.getItemStack("item") + } else { + null + } + }.toTypedArray()) + } } val gameStartEvent = GameStartEvent(this) @@ -330,15 +325,15 @@ class TennisGameImpl( val remaining = arena.gameTime - i if (remaining == 30) { - sendMessageToPlayers(MCTennisLanguage.secondsRemaining.format(30)) + language.sendMessageToPlayers(language.secondsRemaining, getPlayers(), 30) } if (remaining <= 10) { - sendMessageToPlayers(MCTennisLanguage.secondsRemaining.format(remaining)) + language.sendMessageToPlayers(language.secondsRemaining, getPlayers(), remaining) } if (!arena.isEnabled) { - sendMessageToPlayers(MCTennisLanguage.gameCancelledMessage) + language.sendMessageToPlayers(language.gameCancelledMessage, getPlayers()) dispose() return } @@ -432,7 +427,7 @@ class TennisGameImpl( ball = tennisBallFactory.createTennisBall(ballspawnpoint.toLocation(), arena.ballSettings, this) delay(500) - sendTitleMessageToPlayers(MCTennisLanguage.readyTitle, MCTennisLanguage.readySubTitle) + language.sendMessageToPlayers(language.readyMessage, getPlayers()) delay(1500) ball!!.setVelocity(Vector(0.0, 0.2, 0.0)) ball!!.allowActions = true @@ -460,11 +455,12 @@ class TennisGameImpl( when (team) { Team.RED -> { teamRedSetScore++ - sendTitleMessageToPlayers(MCTennisLanguage.winSetRedTitle, MCTennisLanguage.winSetRedSubTitle) + language.sendMessageToPlayers(language.winSetRed, getPlayers()) } + else -> { teamBlueSetScore++ - sendTitleMessageToPlayers(MCTennisLanguage.winSetBlueTitle, MCTennisLanguage.winSetBlueSubTitle) + language.sendMessageToPlayers(language.winSetBlue, getPlayers()) } } @@ -494,17 +490,19 @@ class TennisGameImpl( private suspend fun winGame(team: Team? = null) { when (team) { null -> { - sendTitleMessageToPlayers(MCTennisLanguage.winDrawTitle, MCTennisLanguage.winDrawSubTitle) + language.sendMessageToPlayers(language.winDraw, getPlayers()) executeCommandsWithPlaceHolder(teamRedPlayers, arena.redTeamMeta.drawCommands) executeCommandsWithPlaceHolder(teamBluePlayers, arena.blueTeamMeta.drawCommands) } + Team.RED -> { - sendTitleMessageToPlayers(MCTennisLanguage.winRedTitle, MCTennisLanguage.winRedSubTitle) + language.sendMessageToPlayers(language.winRed, getPlayers()) executeCommandsWithPlaceHolder(teamRedPlayers, arena.redTeamMeta.winCommands) executeCommandsWithPlaceHolder(teamBluePlayers, arena.blueTeamMeta.looseCommands) } + else -> { - sendTitleMessageToPlayers(MCTennisLanguage.winBlueTitle, MCTennisLanguage.winBlueSubTitle) + language.sendMessageToPlayers(language.winBlue, getPlayers()) executeCommandsWithPlaceHolder(teamBluePlayers, arena.blueTeamMeta.winCommands) executeCommandsWithPlaceHolder(teamRedPlayers, arena.redTeamMeta.looseCommands) } @@ -635,15 +633,19 @@ class TennisGameImpl( 0 -> { "0" } + 1 -> { "15" } + 2 -> { "30" } + 3 -> { "40" } + else -> throw RuntimeException("Score $points cannot be converted!") } } @@ -671,21 +673,10 @@ class TennisGameImpl( throw RuntimeException("Team $team not found!") } - private fun sendTitleMessageToPlayers(title: String, subTitle: String) { - for (player in teamRedPlayers) { - chatMessageService.sendTitleMessage(player, title, subTitle, 10, 70, 20) - } - for (player in teamBluePlayers) { - chatMessageService.sendTitleMessage(player, title, subTitle, 10, 70, 20) - } - } - private fun executeCommandsWithPlaceHolder(players: List, commands: List) { commandService.executeCommands(players, commands) { c, p -> placeHolderService.replacePlaceHolders( - c, - p, - this + c, p, this ) } } diff --git a/src/main/kotlin/com/github/shynixn/mctennis/impl/commandexecutor/MCTennisCommandExecutor.kt b/src/main/kotlin/com/github/shynixn/mctennis/impl/commandexecutor/MCTennisCommandExecutor.kt index 24280b9..0555989 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/impl/commandexecutor/MCTennisCommandExecutor.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/impl/commandexecutor/MCTennisCommandExecutor.kt @@ -2,8 +2,10 @@ package com.github.shynixn.mctennis.impl.commandexecutor import com.github.shynixn.mccoroutine.bukkit.launch import com.github.shynixn.mctennis.MCTennisDependencyInjectionModule -import com.github.shynixn.mctennis.MCTennisLanguage +import com.github.shynixn.mctennis.MCTennisLanguageImpl import com.github.shynixn.mctennis.contract.GameService +import com.github.shynixn.mctennis.contract.Language +import com.github.shynixn.mctennis.contract.PlaceHolderService import com.github.shynixn.mctennis.entity.TeamMetadata import com.github.shynixn.mctennis.entity.TennisArena import com.github.shynixn.mctennis.enumeration.JoinResult @@ -17,6 +19,7 @@ import com.github.shynixn.mcutils.common.command.CommandBuilder import com.github.shynixn.mcutils.common.command.CommandMeta import com.github.shynixn.mcutils.common.command.CommandType import com.github.shynixn.mcutils.common.command.Validator +import com.github.shynixn.mcutils.common.language.reloadTranslation import com.github.shynixn.mcutils.common.repository.CacheRepository import com.github.shynixn.mcutils.sign.SignService import com.google.inject.Inject @@ -31,8 +34,9 @@ class MCTennisCommandExecutor @Inject constructor( private val arenaRepository: CacheRepository, private val gameService: GameService, private val plugin: Plugin, - private val configurationService: ConfigurationService, private val signService: SignService, + private val language: Language, + private val placeHolderService: PlaceHolderService, chatMessageService: ChatMessageService ) { private val fallBackPrefix: String = @@ -64,7 +68,7 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.maxLength20Characters + return language.maxLength20Characters.text } } private val gameMustNotExistValidator = object : Validator { @@ -79,7 +83,7 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.gameAlreadyExistsMessage.format(openArgs[0]) + return language.gameAlreadyExistsMessage.text.format(openArgs[0]) } } private val gameMustExistValidator = object : Validator { @@ -91,7 +95,7 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.gameDoesNotExistMessage.format(openArgs[0]) + return language.gameDoesNotExistMessage.text.format(openArgs[0]) } } private val teamValidator = object : Validator { @@ -106,7 +110,7 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.teamDoesNotExistMessage.format(openArgs[0]) + return language.teamDoesNotExistMessage.text.format(openArgs[0]) } } @@ -129,7 +133,7 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.teamDoesNotExistMessage.format(openArgs[0]) + return language.teamDoesNotExistMessage.text.format(openArgs[0]) } } @@ -141,12 +145,12 @@ class MCTennisCommandExecutor @Inject constructor( } override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.locationTypeDoesNotExistMessage + return language.locationTypeDoesNotExistMessage.text } } private val signTypeValidator = object : Validator { override suspend fun message(sender: CommandSender, prevArgs: List, openArgs: List): String { - return MCTennisLanguage.signTypeDoesNotExist + return language.signTypeDoesNotExist.text } override suspend fun validate( @@ -161,11 +165,11 @@ class MCTennisCommandExecutor @Inject constructor( init { val mcCart = CommandBuilder(plugin, coroutineExecutor, "mctennis", chatMessageService) { - usage(MCTennisLanguage.commandUsage.translateChatColors()) - description(MCTennisLanguage.commandDescription) + usage(language.commandUsage.text.translateChatColors()) + description(language.commandDescription.text) aliases(plugin.config.getStringList("commands.mctennis.aliases")) permission(Permission.COMMAND) - permissionMessage(MCTennisLanguage.noPermissionMessage.translateChatColors()) + permissionMessage(language.noPermissionMessage.text.translateChatColors()) subCommand("create") { permission(Permission.EDIT_GAME) builder().argument("name").validator(maxLengthValidator).validator(maxLengthValidator) @@ -190,25 +194,25 @@ class MCTennisCommandExecutor @Inject constructor( subCommand("join") { noPermission() builder().argument("name").validator(gameMustExistValidator).tabs(arenaTabs) - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { sender, arena -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { sender, arena -> joinGame( sender, arena.name ) }.argument("team").validator(teamValidator).tabs { listOf("red", "blue") } - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { sender, arena, team -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { sender, arena, team -> joinGame(sender, arena.name, team) } } subCommand("leave") { noPermission() - builder().executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { sender -> leaveGame(sender) } + builder().executePlayer({ language.commandSenderHasToBePlayer.text }) { sender -> leaveGame(sender) } } helpCommand() subCommand("location") { permission(Permission.EDIT_GAME) builder().argument("name").validator(gameMustExistValidator).tabs(arenaTabs) .argument("type").validator(locationTypeValidator).tabs { LocationType.values().map { e -> e.id } } - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { player, arena, locationType -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { player, arena, locationType -> setLocation(player, arena, locationType) } } @@ -216,7 +220,7 @@ class MCTennisCommandExecutor @Inject constructor( permission(Permission.EDIT_GAME) builder().argument("name").validator(gameMustExistValidator).tabs(arenaTabs) .argument("team").validator(teamMetaValidator).tabs { listOf("red", "blue") } - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { player, arena, meta -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { player, arena, meta -> setInventory(player, arena, meta) } } @@ -224,7 +228,7 @@ class MCTennisCommandExecutor @Inject constructor( permission(Permission.EDIT_GAME) builder().argument("name").validator(gameMustExistValidator).tabs(arenaTabs) .argument("team").validator(teamMetaValidator).tabs { listOf("red", "blue") } - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { player, arena, meta -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { player, arena, meta -> setArmor(player, arena, meta) } } @@ -232,10 +236,20 @@ class MCTennisCommandExecutor @Inject constructor( permission(Permission.EDIT_GAME) builder().argument("name").validator(gameMustExistValidator).tabs(arenaTabs) .argument("type").validator(signTypeValidator).tabs { listOf("join", "leave") } - .executePlayer({ MCTennisLanguage.commandSenderHasToBePlayer }) { player, arena, signType -> + .executePlayer({ language.commandSenderHasToBePlayer.text }) { player, arena, signType -> setSign(player, arena, signType) } } + subCommand("placeholder") { + permission(Permission.EDIT_GAME) + builder().argument("placeholder").tabs { listOf("<>") }.execute { sender, placeHolder -> + val evaluatedValue = placeHolderService.replacePlaceHolders(placeHolder) + sender.sendMessage(language.commandPlaceHolderMessage.text.format(evaluatedValue)) + }.executePlayer({ language.commandSenderHasToBePlayer.text }) { player, placeHolder -> + val evaluatedValue = placeHolderService.replacePlaceHolders(placeHolder, player) + player.sendMessage(language.commandPlaceHolderMessage.text.format(evaluatedValue)) + } + } subCommand("reload") { permission(Permission.EDIT_GAME) builder() @@ -254,7 +268,7 @@ class MCTennisCommandExecutor @Inject constructor( private suspend fun createArena(sender: CommandSender, name: String, displayName: String) { if (arenaRepository.getAll().size > 0 && !MCTennisDependencyInjectionModule.areLegacyVersionsIncluded) { - sender.sendMessage(MCTennisLanguage.freeVersionMessage) + language.sendMessage(language.freeVersionMessage, sender) return } @@ -262,21 +276,21 @@ class MCTennisCommandExecutor @Inject constructor( arena.name = name arena.displayName = displayName arenaRepository.save(arena) - sender.sendMessage(MCTennisLanguage.gameCreatedMessage.format(name)) + language.sendMessage(language.gameCreatedMessage, sender, name) } private suspend fun deleteArena(sender: CommandSender, arena: TennisArena) { val runningGame = gameService.getAll().firstOrNull { e -> e.arena.name.equals(arena.name, true) } runningGame?.dispose(false) arenaRepository.delete(arena) - sender.sendMessage(MCTennisLanguage.deletedGameMessage.format(arena.name)) + sender.sendMessage(language.deletedGameMessage.text.format(arena.name)) } private suspend fun toggleGame(sender: CommandSender, arena: TennisArena) { try { arena.isEnabled = !arena.isEnabled gameService.reload(arena) - sender.sendMessage(MCTennisLanguage.enabledArenaMessage.format(arena.isEnabled.toString())) + sender.sendMessage(language.enabledArenaMessage.text.format(arena.isEnabled.toString())) } catch (e: TennisGameException) { arena.isEnabled = !arena.isEnabled sender.sendMessage(fallBackPrefix + ChatColor.RED.toString() + "Failed to reload arena ${e.arena.name}.") @@ -284,7 +298,7 @@ class MCTennisCommandExecutor @Inject constructor( return } arenaRepository.save(arena) - sender.sendMessage(MCTennisLanguage.reloadedGameMessage.format(arena.name)) + sender.sendMessage(language.reloadedGameMessage.text.format(arena.name)) } private suspend fun setInventory(player: Player, arena: TennisArena, teamMetadata: TeamMetadata) { @@ -294,7 +308,7 @@ class MCTennisCommandExecutor @Inject constructor( yamlConfiguration.saveToString() }.toTypedArray() arenaRepository.save(arena) - player.sendMessage(MCTennisLanguage.updatedInventoryMessage) + player.sendMessage(language.updatedInventoryMessage.text) } private suspend fun setArmor(player: Player, arena: TennisArena, teamMeta: TeamMetadata) { @@ -304,7 +318,7 @@ class MCTennisCommandExecutor @Inject constructor( yamlConfiguration.saveToString() }.toTypedArray() arenaRepository.save(arena) - player.sendMessage(MCTennisLanguage.updatedArmorMessage) + player.sendMessage(language.updatedArmorMessage.text) } private fun CommandBuilder.permission(permission: Permission) { @@ -373,15 +387,15 @@ class MCTennisCommandExecutor @Inject constructor( if (game == null) { if (MCTennisDependencyInjectionModule.areLegacyVersionsIncluded) { - player.sendMessage(MCTennisLanguage.gameDoesNotExistMessage.format(name)) + player.sendMessage(language.gameDoesNotExistMessage.text.format(name)) } else { - player.sendMessage(MCTennisLanguage.freeVersionMessage) + player.sendMessage(language.freeVersionMessage.text) } return } if (!player.hasPermission("mctennis.join.${game.arena.name}") && !player.hasPermission("mctennis.join.*")) { - player.sendMessage(MCTennisLanguage.noPermissionForGameMessage.format(game.arena.name)) + player.sendMessage(language.noPermissionForGameMessage.text.format(game.arena.name)) return } @@ -396,14 +410,14 @@ class MCTennisCommandExecutor @Inject constructor( } if (joinResult == JoinResult.GAME_FULL || joinResult == JoinResult.GAME_ALREADY_RUNNING) { - player.sendMessage(MCTennisLanguage.gameIsFullMessage) + player.sendMessage(language.gameIsFullMessage.text) return } if (joinResult == JoinResult.SUCCESS_BLUE) { - player.sendMessage(MCTennisLanguage.joinTeamBlueMessage) + player.sendMessage(language.joinTeamBlueMessage.text) } else if (joinResult == JoinResult.SUCCESS_RED) { - player.sendMessage(MCTennisLanguage.joinTeamRedMessage) + player.sendMessage(language.joinTeamRedMessage.text) } } @@ -418,7 +432,7 @@ class MCTennisCommandExecutor @Inject constructor( } if (leftGame) { - player.sendMessage(MCTennisLanguage.leftGameMessage) + player.sendMessage(language.leftGameMessage.text) } } @@ -450,17 +464,17 @@ class MCTennisCommandExecutor @Inject constructor( } else if (locationType == LocationType.CORNER_BLUE_2) { arena.blueTeamMeta.rightUpperCorner = player.location.toVector3d() } else { - player.sendMessage(MCTennisLanguage.locationTypeDoesNotExistMessage.format(player.location)) + player.sendMessage(language.locationTypeDoesNotExistMessage.text.format(player.location)) return } arenaRepository.save(arena) - player.sendMessage(MCTennisLanguage.spawnPointSetMessage.format(player.location)) + player.sendMessage(language.spawnPointSetMessage.text.format(player.location)) } private suspend fun setSign(sender: Player, arena: TennisArena, signType: String) { if (signType.equals("join", true)) { - sender.sendMessage(MCTennisLanguage.rightClickOnSignMessage) + sender.sendMessage(language.rightClickOnSignMessage.text) signService.addSignByRightClick(sender) { sign -> sign.let { it.line1 = "%mctennis_lang_joinSignLine1%" @@ -482,11 +496,11 @@ class MCTennisCommandExecutor @Inject constructor( plugin.launch { arenaRepository.save(arena) gameService.reload(arena) - sender.sendMessage(MCTennisLanguage.addedSignMessage) + sender.sendMessage(language.addedSignMessage.text) } } } else if (signType.equals("leave", true)) { - sender.sendMessage(MCTennisLanguage.rightClickOnSignMessage) + sender.sendMessage(language.rightClickOnSignMessage.text) signService.addSignByRightClick(sender) { sign -> sign.let { it.line1 = "%mctennis_lang_leaveSignLine1%" @@ -508,15 +522,14 @@ class MCTennisCommandExecutor @Inject constructor( plugin.launch { arenaRepository.save(arena) gameService.reload(arena) - sender.sendMessage(MCTennisLanguage.addedSignMessage) + sender.sendMessage(language.addedSignMessage.text) } } } else { - sender.sendMessage(MCTennisLanguage.signTypeDoesNotExist) + sender.sendMessage(language.signTypeDoesNotExist.text) } } - private suspend fun reloadArena(sender: CommandSender, arena: TennisArena?) { try { arenaRepository.clearCache() @@ -528,9 +541,8 @@ class MCTennisCommandExecutor @Inject constructor( if (arena == null) { plugin.reloadConfig() - val language = configurationService.findValue("language") - plugin.reloadTranslation(language, MCTennisLanguage::class.java, "en_us", "es_es") - plugin.logger.log(Level.INFO, "Loaded language file $language.properties.") + plugin.reloadTranslation(language as MCTennisLanguageImpl, MCTennisLanguageImpl::class.java) + plugin.logger.log(Level.INFO, "Loaded language file.") try { arenaRepository.clearCache() @@ -541,7 +553,7 @@ class MCTennisCommandExecutor @Inject constructor( return } - sender.sendMessage(MCTennisLanguage.reloadedAllGamesMessage) + sender.sendMessage(language.reloadedAllGamesMessage.text) return } @@ -553,7 +565,7 @@ class MCTennisCommandExecutor @Inject constructor( sender.sendMessage(fallBackPrefix + e.message) return } - sender.sendMessage(MCTennisLanguage.reloadedGameMessage.format(arena.name)) + sender.sendMessage(language.reloadedGameMessage.text.format(arena.name)) return } } diff --git a/src/main/kotlin/com/github/shynixn/mctennis/impl/listener/TennisListener.kt b/src/main/kotlin/com/github/shynixn/mctennis/impl/listener/TennisListener.kt index 0d6e36c..4f55a9c 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/impl/listener/TennisListener.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/impl/listener/TennisListener.kt @@ -1,7 +1,7 @@ package com.github.shynixn.mctennis.impl.listener import com.github.shynixn.mccoroutine.bukkit.launch -import com.github.shynixn.mctennis.MCTennisLanguage +import com.github.shynixn.mctennis.contract.Language import com.github.shynixn.mctennis.contract.TennisBall import com.github.shynixn.mctennis.contract.TennisGame import com.github.shynixn.mctennis.entity.TennisArena @@ -23,7 +23,8 @@ import org.bukkit.plugin.Plugin class TennisListener @Inject constructor( private val packetService: PacketService, - private val plugin: Plugin + private val plugin: Plugin, + private val language : Language ) : Listener { /** * Handles ground bouncing. @@ -59,7 +60,7 @@ class TennisListener @Inject constructor( printMessageAtScorePosition( game, event.tennisBall, - MCTennisLanguage.bounceOutHologram + language.bounceOutHologram.text ) if (game.bounceCounter == 1) { @@ -78,7 +79,7 @@ class TennisListener @Inject constructor( printMessageAtScorePosition( game, event.tennisBall, - MCTennisLanguage.bounceSecondHologram + language.bounceSecondHologram.text ) game.scorePoint(player, opponentTeam) return @@ -92,7 +93,7 @@ class TennisListener @Inject constructor( printMessageAtScorePosition( game, event.tennisBall, - MCTennisLanguage.bounceSecondHologram + language.bounceSecondHologram.text ) game.scorePoint(player, team) } diff --git a/src/main/kotlin/com/github/shynixn/mctennis/impl/service/GameServiceImpl.kt b/src/main/kotlin/com/github/shynixn/mctennis/impl/service/GameServiceImpl.kt index e7646f1..ae74667 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/impl/service/GameServiceImpl.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/impl/service/GameServiceImpl.kt @@ -2,6 +2,7 @@ package com.github.shynixn.mctennis.impl.service import com.github.shynixn.mctennis.MCTennisDependencyInjectionModule import com.github.shynixn.mctennis.contract.GameService +import com.github.shynixn.mctennis.contract.Language import com.github.shynixn.mctennis.contract.PlaceHolderService import com.github.shynixn.mctennis.contract.TennisBallFactory import com.github.shynixn.mctennis.entity.TeamMetadata @@ -26,7 +27,8 @@ class GameServiceImpl @Inject constructor( private val commandService: CommandService, private val signService: SignService, private val chatMessageService: ChatMessageService, - private val placeHolderService: PlaceHolderService + private val placeHolderService: PlaceHolderService, + private val language: Language ) : GameService { private val games = ArrayList() @@ -69,7 +71,7 @@ class GameServiceImpl @Inject constructor( return } - val tennisGameImpl = TennisGameImpl(arena, tennisBallFactory, chatMessageService, plugin, commandService, placeHolderService) + val tennisGameImpl = TennisGameImpl(arena, tennisBallFactory, chatMessageService, plugin, commandService, placeHolderService, language) games.add(tennisGameImpl) plugin.logger.log(Level.INFO, "Game '" + arena.name + "' is ready.") } else { diff --git a/src/main/kotlin/com/github/shynixn/mctennis/impl/service/PlaceHolderServiceImpl.kt b/src/main/kotlin/com/github/shynixn/mctennis/impl/service/PlaceHolderServiceImpl.kt index b0bd0f2..2e829df 100644 --- a/src/main/kotlin/com/github/shynixn/mctennis/impl/service/PlaceHolderServiceImpl.kt +++ b/src/main/kotlin/com/github/shynixn/mctennis/impl/service/PlaceHolderServiceImpl.kt @@ -1,11 +1,13 @@ package com.github.shynixn.mctennis.impl.service -import com.github.shynixn.mctennis.MCTennisLanguage +import com.github.shynixn.mctennis.MCTennisLanguageImpl +import com.github.shynixn.mctennis.MCTennisPlugin import com.github.shynixn.mctennis.contract.GameService import com.github.shynixn.mctennis.contract.PlaceHolderService import com.github.shynixn.mctennis.contract.TennisGame import com.github.shynixn.mctennis.enumeration.GameState import com.github.shynixn.mctennis.enumeration.PlaceHolder +import com.github.shynixn.mcutils.common.language.LanguageItem import com.github.shynixn.mcutils.common.translateChatColors import com.google.inject.Inject import org.bukkit.entity.Player @@ -22,12 +24,14 @@ class PlaceHolderServiceImpl @Inject constructor(private val gameService: GameSe placeHolders[placeHolder.fullPlaceHolder] = placeHolder } - for (field in MCTennisLanguage::class.java.declaredFields) { + for (field in MCTennisLanguageImpl::class.java.declaredFields) { field.isAccessible = true - langPlaceHolderFunctions["%mctennis_lang_${field.name}%"] = { field.get(null) as String } + langPlaceHolderFunctions["%mctennis_lang_${field.name}%"] = { (field.get(null) as LanguageItem).text } } // Player + playerPlaceHolderFunctions[PlaceHolder.PLAYER_NAME] = + { p -> p.name } playerPlaceHolderFunctions[PlaceHolder.PLAYER_ISINGAME] = { p -> (gameService.getByPlayer(p) != null).toString() } @@ -53,11 +57,11 @@ class PlaceHolderServiceImpl @Inject constructor(private val gameService: GameSe } gamePlayerHolderFunctions[PlaceHolder.GAME_STATE_DISPLAYNAME] = { g -> if (!g.arena.isEnabled) { - MCTennisLanguage.gameStateDisabled + MCTennisPlugin.language!!.gameStateDisabled.text } else if (g.gameState == GameState.RUNNING_PLAYING || g.gameState == GameState.RUNNING_SERVING || g.gameState == GameState.ENDING) { - MCTennisLanguage.gameStateRunning + MCTennisPlugin.language!!.gameStateRunning.text } else { - MCTennisLanguage.gameStateJoinAble + MCTennisPlugin.language!!.gameStateJoinAble.text } } gamePlayerHolderFunctions[PlaceHolder.GAME_PLAYER_AMOUNT] = { g -> @@ -125,7 +129,6 @@ class PlaceHolderServiceImpl @Inject constructor(private val gameService: GameSe { g, p -> g.teamRedPlayers.contains(p).toString() } } - /** * Replaces the placeholders. */ diff --git a/src/main/resources/arena_sample.yml b/src/main/resources/arena_sample.yml index a94124d..b993b82 100644 --- a/src/main/resources/arena_sample.yml +++ b/src/main/resources/arena_sample.yml @@ -14,6 +14,8 @@ timeToStart: 5 gameTime: 300 # Amount of Tennis sets to play. setsToWin: 3 +# If set to true, then the player keeps his inventory when joining a game. +keepInventory: false # Spawnpoint of players who leave the game. leaveSpawnpoint: world: "world" @@ -53,16 +55,16 @@ redTeamMeta: name: null # Inventory the player receives when joining this team. # Should be set in game using the inventory sub command. - inventoryContents: [] + inventoryContents: [ ] # Inventory the player receives when joining this team. # Should be set in game using the armor sub command. - armorInventoryContents: [] + armorInventoryContents: [ ] # Commands which are executed on the team who wins the match. - winCommands: [] + winCommands: [ ] # Commands which are executed on the team who looses the match. - looseCommands: [] + looseCommands: [ ] # Commands which are executed if the game ends in a draw. - drawCommands: [] + drawCommands: [ ] # Commands which are executed every MCTennis game tick (1 tick per second, not the minecraft tick which is 20 ticks per second) # Types are: # SERVER (executes a single command with server level permission) @@ -125,16 +127,16 @@ blueTeamMeta: name: null # Inventory the player receives when joining this team. # Should be set in game using the inventory sub command. - inventoryContents: [] + inventoryContents: [ ] # Inventory the player receives when joining this team. # Should be set in game using the armor sub command. - armorInventoryContents: [] + armorInventoryContents: [ ] # Commands which are executed on the team who wins the match. - winCommands: [] + winCommands: [ ] # Commands which are executed on the team who looses the match. - looseCommands: [] + looseCommands: [ ] # Commands which are executed if the game ends in a draw. - drawCommands: [] + drawCommands: [ ] # Commands which are executed every MCTennis game tick (1 tick per second, not the minecraft tick which is 20 ticks per second) # Types are: # SERVER (executes a single command with server level permission) diff --git a/src/main/resources/lang/en_us.properties b/src/main/resources/lang/en_us.properties deleted file mode 100644 index a0f0e5b..0000000 --- a/src/main/resources/lang/en_us.properties +++ /dev/null @@ -1,61 +0,0 @@ -gameStartingMessage=[&9MCTennis&f] Game is starting in %1$1d seconds. -gameStartCancelledMessage=[&9MCTennis&f] Game start has been cancelled. -playerScoredMessage=[&9MCTennis&f] Player %1$1s has scored for team %2$1s. -gameDoesNotExistMessage=[&9MCTennis&f] Game %1$1s does not exist. -noPermissionForGameMessage=[&9MCTennis&f] You do not have permission to join game %1$1s. -noPermissionMessage=[&9MCTennis&f] You do not have permission. -locationTypeDoesNotExistMessage=[&9MCTennis&f] This location type is not known. For more locations, open the arena.yml. -spawnPointSetMessage=[&9MCTennis&f] Location was set on %1$1s. -gameAlreadyExistsMessage=[&9MCTennis&f] Game %1$1s already exists. -enabledArenaMessage=[&9MCTennis&f] Game enable state was set to %1$1s. -gameIsFullMessage=[&9MCTennis&f] Game is already full. -gameCreatedMessage=[&9MCTennis&f] Created game %1$1s. -reloadedAllGamesMessage=[&9MCTennis&f] Reloaded all games. -reloadedGameMessage=[&9MCTennis&f] Reloaded game %1$1s. -joinTeamRedMessage=[&9MCTennis&f] Successfully joined team red. -joinTeamBlueMessage=[&9MCTennis&f] Successfully joined team blue. -leftGameMessage=[&9MCTennis&f] Left the game. -deletedGameMessage=[&9MCTennis&f] Deleted game %1$1s. -notEnoughPlayersMessage=[&9MCTennis&f] Not enough players! Game start was cancelled. -teamDoesNotExistMessage=[&9MCTennis&f] Team %1$1s does not exist. -updatedInventoryMessage=[&9MCTennis&f] Updated inventory of game. -updatedArmorMessage=[&9MCTennis&f] Updated armor of game. -secondsRemaining=[&9MCTennis&f] %1$1s second(s) remaining. -gameCancelledMessage=[&9MCTennis&f] Game has been cancelled. -scoreRedTitle=&c&l%1$1s -scoreRedSubTitle=%2$1s scored for &cTeam Red. -scoreBlueTitle=&9&l%1$1s -scoreBlueSubTitle=%2$1s scored for &9Team Blue. -winRedTitle=&cTeam Red -winRedSubTitle=&cTeam Red &ahas won the match -winSetRedTitle=&cTeam Red -winSetRedSubTitle=&cTeam Red &ahas won this set -winBlueTitle=&9Team Blue -winBlueSubTitle=&9Team Blue &ahas won the match -winSetBlueTitle=&9Team Blue -winSetBlueSubTitle=&9Team Blue &ahas won this set -winDrawTitle=&fDraw -winDrawSubTitle=&aThe game has ended in a draw -readyTitle=&6&lReady? -readySubTitle= -bounceOutHologram=&lOut -bounceSecondHologram=&l2nd Bounce -joinSignLine1=&f[&r&lMCTennis&r&f] -joinSignLine2=%mctennis_game_stateDisplayName% -joinSignLine3=%mctennis_game_players%/%mctennis_game_maxPlayers% -joinSignLine4= -leaveSignLine1=&f[&r&lMCTennis&r&f] -leaveSignLine2=&f&lLeave -leaveSignLine3=%mctennis_game_players%/%mctennis_game_maxPlayers% -leaveSignLine4= -gameStateJoinAble=&aJoin -gameStateDisabled=&4Disabled -gameStateRunning=&1Running -rightClickOnSignMessage=RightClick on a sign to convert it into a game sign. -signTypeDoesNotExist=This sign type does not exist. -addedSignMessage=A sign was added to the game. -commandDescription=All commands for the MCTennis plugin. -commandUsage=[&9MCTennis&f] Use /mctennis help to see more info about the plugin. -maxLength20Characters=The text length has to be less than 20 characters. -commandSenderHasToBePlayer=The command sender has to be a player! -freeVersionMessage=This version of MCTennis does only allow 1 game per server. Go to https://patreon.com/Shynixn for the premium version. diff --git a/src/main/resources/lang/en_us.yml b/src/main/resources/lang/en_us.yml new file mode 100644 index 0000000..875096f --- /dev/null +++ b/src/main/resources/lang/en_us.yml @@ -0,0 +1,202 @@ +# All language key identifiers. +gameStartingMessage: + # Available types: "CHAT", "TITLE", "ACTIONBAR", "HIDDEN" + type: "CHAT" + # The primary text to be sent. + text: "[&9MCTennis&f] Game is starting in %1$1d seconds." + # Only available for type "TITLE". Adds a subtitle. + subtitle: "" + # Only available for type: "TITLE". Adds a fade in effect. + fadeInTicks: 20 + # Only available for type: "TITLE". Adds a stay effect. + stayTicks: 60 + # Only available for type: "TITLE". Adds a fade out effect. + fadeOutTicks: 20 +gameStartCancelledMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game start has been cancelled." +gameDoesNotExistMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game %1$1s does not exist." +noPermissionForGameMessage: + type: "CHAT" + text: "[&9MCTennis&f] You do not have permission to join game %1$1s." +noPermissionMessage: + type: "CHAT" + text: "[&9MCTennis&f] You do not have permission." +locationTypeDoesNotExistMessage: + type: "CHAT" + text: "[&9MCTennis&f] This location type is not known. For more locations, open the arena.yml." +spawnPointSetMessage: + type: "CHAT" + text: "[&9MCTennis&f] Location was set on %1$1s." +gameAlreadyExistsMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game %1$1s already exists." +enabledArenaMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game enable state was set to %1$1s." +gameIsFullMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game is already full." +gameCreatedMessage: + type: "CHAT" + text: "[&9MCTennis&f] Created game %1$1s." +reloadedAllGamesMessage: + type: "CHAT" + text: "[&9MCTennis&f] Reloaded all games." +reloadedGameMessage: + type: "CHAT" + text: "[&9MCTennis&f] Reloaded game %1$1s." +joinTeamRedMessage: + type: "CHAT" + text: "[&9MCTennis&f] Successfully joined team red." +joinTeamBlueMessage: + type: "CHAT" + text: "[&9MCTennis&f] Successfully joined team blue." +leftGameMessage: + type: "CHAT" + text: "[&9MCTennis&f] Left the game." +deletedGameMessage: + type: "CHAT" + text: "[&9MCTennis&f] Deleted game %1$1s." +notEnoughPlayersMessage: + type: "CHAT" + text: "[&9MCTennis&f] Not enough players! Game start was cancelled." +teamDoesNotExistMessage: + type: "CHAT" + text: "[&9MCTennis&f] Team %1$1s does not exist." +updatedInventoryMessage: + type: "CHAT" + text: "[&9MCTennis&f] Updated inventory of game." +updatedArmorMessage: + type: "CHAT" + text: "[&9MCTennis&f] Updated armor of game." +secondsRemaining: + type: "CHAT" + text: "[&9MCTennis&f] %1$1s second(s) remaining." +gameCancelledMessage: + type: "CHAT" + text: "[&9MCTennis&f] Game has been cancelled." +scoreRed: + type: "TITLE" + text: "&c%mctennis_game_score%" + subtitle: "%2$1s scored for &cTeam Red" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +scoreBlue: + type: "TITLE" + text: "&9&l%mctennis_game_score%" + subtitle: "%2$1s scored for &9Team Blue." + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +winRed: + type: "TITLE" + text: "&c&lTeam Red" + subtitle: "&cTeam Red &ahas won the match" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +winSetRed: + type: "TITLE" + text: "&cTeam Red" + subtitle: "&cTeam Red &ahas won this set" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +winBlue: + type: "TITLE" + text: "&9Team Blue" + subtitle: "&9Team Blue &ahas won the match" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +winSetBlue: + type: "TITLE" + text: "&9Team Blue" + subtitle: "&9Team Blue &ahas won this set" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +winDraw: + type: "TITLE" + text: "&fDraw" + subtitle: "&aThe game has ended in a draw" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +readyMessage: + type: "TITLE" + text: "&6&lReady?" + subtitle: "" + fadeInTicks: 10 + stayTicks: 60 + fadeOutTicks: 10 +bounceOutHologram: + type: "CHAT" + text: "&lOut" +bounceSecondHologram: + type: "CHAT" + text: "&l2nd Bounce" +joinSignLine1: + type: "CHAT" + text: "&f[&r&lMCTennis&r&f]" +joinSignLine2: + type: "CHAT" + text: "%mctennis_game_stateDisplayName%" +joinSignLine3: + type: "CHAT" + text: "%mctennis_game_players%/%mctennis_game_maxPlayers%" +joinSignLine4: + type: "CHAT" + text: "" +leaveSignLine1: + type: "CHAT" + text: "&f[&r&lMCTennis&r&f]" +leaveSignLine2: + type: "CHAT" + text: "&f&lLeave" +leaveSignLine3: + type: "CHAT" + text: "%mctennis_game_players%/%mctennis_game_maxPlayers%" +leaveSignLine4: + type: "CHAT" + text: "" +gameStateJoinAble: + type: "CHAT" + text: "&aJoin" +gameStateDisabled: + type: "CHAT" + text: "&4Disabled" +gameStateRunning: + type: "CHAT" + text: "&1Running" +rightClickOnSignMessage: + type: "CHAT" + text: "RightClick on a sign to convert it into a game sign." +signTypeDoesNotExist: + type: "CHAT" + text: "This sign type does not exist." +addedSignMessage: + type: "CHAT" + text: "A sign was added to the game." +commandDescription: + type: "CHAT" + text: "All commands for the MCTennis plugin." +commandUsage: + type: "CHAT" + text: "[&9MCTennis&f] Use /mctennis help to see more info about the plugin." +maxLength20Characters: + type: "CHAT" + text: "The text length has to be less than 20 characters." +commandSenderHasToBePlayer: + type: "CHAT" + text: "The command sender has to be a player!" +freeVersionMessage: + type: "CHAT" + text: "This version of MCTennis does only allow 1 game per server. Go to https://patreon.com/Shynixn for the premium version." +commandPlaceHolderMessage: + type: "CHAT" + text: "Evaluated placeholder: %1$1s" diff --git a/src/main/resources/lang/es_es.properties b/src/main/resources/lang/es_es.properties deleted file mode 100644 index 12a62bc..0000000 --- a/src/main/resources/lang/es_es.properties +++ /dev/null @@ -1,61 +0,0 @@ -gameStartingMessage=[&9MCTennis&f] El juego comienza en %1$1d segundos. -gameStartCancelledMessage=[&9MCTennis&f] El inicio del juego ha sido cancelado. -playerScoredMessage=[&9MCTennis&f] El jugador %1$1s ha anotado para el equipo %2$1s. -gameDoesNotExistMessage=[&9MCTennis&f] El juego %1$1s no existe. -noPermissionForGameMessage=[&9MCTennis&f] No tienes permiso para unirte al juego %1$1s. -noPermissionMessage=[&9MCTennis&f] No tienes permiso. -locationTypeDoesNotExistMessage=[&9MCTennis&f] Este tipo de ubicación no es conocido. Para más ubicaciones, abre el arena.yml. -spawnPointSetMessage=[&9MCTennis&f] La ubicación fue establecida en %1$1s. -gameAlreadyExistsMessage=[&9MCTennis&f] El juego %1$1s ya existe. -enabledArenaMessage=[&9MCTennis&f] El estado del juego se estableció en %1$1s. -gameIsFullMessage=[&9MCTennis&f] El juego ya está lleno. -gameCreatedMessage=[&9MCTennis&f] Juego %1$1s creado. -reloadedAllGamesMessage=[&9MCTennis&f] Todos los juegos han sido recargados. -reloadedGameMessage=[&9MCTennis&f] El juego %1$1s ha sido recargado. -joinTeamRedMessage=[&9MCTennis&f] Te has unido exitosamente al equipo rojo. -joinTeamBlueMessage=[&9MCTennis&f] Te has unido exitosamente al equipo azul. -leftGameMessage=[&9MCTennis&f] Has salido del juego. -deletedGameMessage=[&9MCTennis&f] Juego %1$1s eliminado. -notEnoughPlayersMessage=[&9MCTennis&f] ¡No hay suficientes jugadores! El inicio del juego fue cancelado. -teamDoesNotExistMessage=[&9MCTennis&f] El equipo %1$1s no existe. -updatedInventoryMessage=[&9MCTennis&f] Inventario del juego actualizado. -updatedArmorMessage=[&9MCTennis&f] Armadura del juego actualizada. -secondsRemaining=[&9MCTennis&f] Quedan %1$1s segundo(s). -gameCancelledMessage=[&9MCTennis&f] El juego ha sido cancelado. -scoreRedTitle=&c&l%1$1s -scoreRedSubTitle=%2$1s anotó para el &cEquipo Rojo. -scoreBlueTitle=&9&l%1$1s -scoreBlueSubTitle=%2$1s anotó para el &9Equipo Azul. -winRedTitle=&cEquipo Rojo -winRedSubTitle=&cEl Equipo Rojo &aha ganado el partido -winSetRedTitle=&cEquipo Rojo -winSetRedSubTitle=&cEl Equipo Rojo &aha ganado este set -winBlueTitle=&9Equipo Azul -winBlueSubTitle=&9El Equipo Azul &aha ganado el partido -winSetBlueTitle=&9Equipo Azul -winSetBlueSubTitle=&9El Equipo Azul &aha ganado este set -winDrawTitle=&fEmpate -winDrawSubTitle=&aEl juego ha terminado en empate -readyTitle=&6&l¿Listo? -readySubTitle= -bounceOutHologram=&lFuera -bounceSecondHologram=&l2do Rebote -joinSignLine1=&f[&r&lMCTennis&r&f] -joinSignLine2=%mctennis_game_stateDisplayName% -joinSignLine3=%mctennis_game_players%/%mctennis_game_maxPlayers% -joinSignLine4= -leaveSignLine1=&f[&r&lMCTennis&r&f] -leaveSignLine2=&f&lSalir -leaveSignLine3=%mctennis_game_players%/%mctennis_game_maxPlayers% -leaveSignLine4= -gameStateJoinAble=&aUnirse -gameStateDisabled=&4Desactivado -gameStateRunning=&1En Curso -rightClickOnSignMessage=Haz clic derecho en un cartel para convertirlo en un cartel de juego. -signTypeDoesNotExist=Este tipo de cartel no existe. -addedSignMessage=Se ha añadido un cartel al juego. -commandDescription=Todos los comandos para el plugin MCTennis. -commandUsage=[&9MCTennis&f] Usa /mctennis help para ver más información sobre el plugin. -maxLength20Characters=La longitud del texto debe ser menor a 20 caracteres. -commandSenderHasToBePlayer=¡El remitente del comando debe ser un jugador! -freeVersionMessage=Esta versión de MCTennis solo permite 1 juego por servidor. Ve a https://patreon.com/Shynixn para la versión premium. diff --git a/storage/v1.21/world/data/raids.dat b/storage/v1.21/world/data/raids.dat index 36245e5..ef75133 100644 Binary files a/storage/v1.21/world/data/raids.dat and b/storage/v1.21/world/data/raids.dat differ diff --git a/storage/v1.21/world/data/random_sequences.dat b/storage/v1.21/world/data/random_sequences.dat new file mode 100644 index 0000000..fb7c90d Binary files /dev/null and b/storage/v1.21/world/data/random_sequences.dat differ diff --git a/storage/v1.21/world/data/villages.dat b/storage/v1.21/world/data/villages.dat index 37f2553..57db7b2 100644 Binary files a/storage/v1.21/world/data/villages.dat and b/storage/v1.21/world/data/villages.dat differ diff --git a/storage/v1.21/world/data/villages_end.dat b/storage/v1.21/world/data/villages_end.dat new file mode 100644 index 0000000..57db7b2 Binary files /dev/null and b/storage/v1.21/world/data/villages_end.dat differ diff --git a/storage/v1.21/world/data/villages_nether.dat b/storage/v1.21/world/data/villages_nether.dat new file mode 100644 index 0000000..57db7b2 Binary files /dev/null and b/storage/v1.21/world/data/villages_nether.dat differ diff --git a/storage/v1.21/world/datapacks/bukkit/pack.mcmeta b/storage/v1.21/world/datapacks/bukkit/pack.mcmeta deleted file mode 100644 index ec1d06c..0000000 --- a/storage/v1.21/world/datapacks/bukkit/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "Data pack for resources provided by Bukkit plugins", - "pack_format": 48 - } -} diff --git a/storage/v1.21/world/forcedchunks.dat b/storage/v1.21/world/forcedchunks.dat deleted file mode 100644 index e434547..0000000 Binary files a/storage/v1.21/world/forcedchunks.dat and /dev/null differ diff --git a/storage/v1.21/world/level.dat b/storage/v1.21/world/level.dat deleted file mode 100644 index 51150e0..0000000 Binary files a/storage/v1.21/world/level.dat and /dev/null differ diff --git a/storage/v1.21/world/level.dat_mcr b/storage/v1.21/world/level.dat_mcr deleted file mode 100644 index 30201dc..0000000 Binary files a/storage/v1.21/world/level.dat_mcr and /dev/null differ diff --git a/storage/v1.21/world/level.dat_old b/storage/v1.21/world/level.dat_old deleted file mode 100644 index ff6e217..0000000 Binary files a/storage/v1.21/world/level.dat_old and /dev/null differ diff --git a/storage/v1.21/world/entities/r.-1.-1.mca b/storage/v1.21/world/poi/r.0.0.mca similarity index 66% rename from storage/v1.21/world/entities/r.-1.-1.mca rename to storage/v1.21/world/poi/r.0.0.mca index 6083008..6d17cf9 100644 Binary files a/storage/v1.21/world/entities/r.-1.-1.mca and b/storage/v1.21/world/poi/r.0.0.mca differ diff --git a/storage/v1.21/world/poi/r.2.-3.mca b/storage/v1.21/world/poi/r.2.-3.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/storage/v1.21/world/poi/r.2.-3.mca differ diff --git a/storage/v1.21/world/poi/r.2.-4.mca b/storage/v1.21/world/poi/r.2.-4.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/storage/v1.21/world/poi/r.2.-4.mca differ diff --git a/storage/v1.21/world/poi/r.3.-3.mca b/storage/v1.21/world/poi/r.3.-3.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/storage/v1.21/world/poi/r.3.-3.mca differ diff --git a/storage/v1.21/world/poi/r.3.-4.mca b/storage/v1.21/world/poi/r.3.-4.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/storage/v1.21/world/poi/r.3.-4.mca differ diff --git a/storage/v1.21/world/region/r.-1.-1.mca b/storage/v1.21/world/region/r.-1.-1.mca deleted file mode 100644 index ef3ecef..0000000 Binary files a/storage/v1.21/world/region/r.-1.-1.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.-1.-2.mca b/storage/v1.21/world/region/r.-1.-2.mca deleted file mode 100644 index 612f739..0000000 Binary files a/storage/v1.21/world/region/r.-1.-2.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.-1.0.mca b/storage/v1.21/world/region/r.-1.0.mca deleted file mode 100644 index 1e3b464..0000000 Binary files a/storage/v1.21/world/region/r.-1.0.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.0.-1.mca b/storage/v1.21/world/region/r.0.-1.mca deleted file mode 100644 index 45b35d9..0000000 Binary files a/storage/v1.21/world/region/r.0.-1.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.0.-2.mca b/storage/v1.21/world/region/r.0.-2.mca deleted file mode 100644 index 2f3ed32..0000000 Binary files a/storage/v1.21/world/region/r.0.-2.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.0.0.mca b/storage/v1.21/world/region/r.0.0.mca deleted file mode 100644 index 30ab871..0000000 Binary files a/storage/v1.21/world/region/r.0.0.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.0.1.mca b/storage/v1.21/world/region/r.0.1.mca deleted file mode 100644 index 1de7d3f..0000000 Binary files a/storage/v1.21/world/region/r.0.1.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.1.-1.mca b/storage/v1.21/world/region/r.1.-1.mca deleted file mode 100644 index 9eea647..0000000 Binary files a/storage/v1.21/world/region/r.1.-1.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.1.0.mca b/storage/v1.21/world/region/r.1.0.mca deleted file mode 100644 index b8fa84b..0000000 Binary files a/storage/v1.21/world/region/r.1.0.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.1.1.mca b/storage/v1.21/world/region/r.1.1.mca deleted file mode 100644 index 5a25915..0000000 Binary files a/storage/v1.21/world/region/r.1.1.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.2.0.mca b/storage/v1.21/world/region/r.2.0.mca deleted file mode 100644 index f39c22e..0000000 Binary files a/storage/v1.21/world/region/r.2.0.mca and /dev/null differ diff --git a/storage/v1.21/world/region/r.2.1.mca b/storage/v1.21/world/region/r.2.1.mca deleted file mode 100644 index 33a05e2..0000000 Binary files a/storage/v1.21/world/region/r.2.1.mca and /dev/null differ diff --git a/storage/v1.21/world/stats/039d36ea-d4b1-3d64-a0e6-450eaa2aa79b.json b/storage/v1.21/world/stats/039d36ea-d4b1-3d64-a0e6-450eaa2aa79b.json new file mode 100644 index 0000000..ed47d84 --- /dev/null +++ b/storage/v1.21/world/stats/039d36ea-d4b1-3d64-a0e6-450eaa2aa79b.json @@ -0,0 +1 @@ +{"stats":{"minecraft:custom":{"minecraft:jump":38,"minecraft:time_since_rest":8573,"minecraft:leave_game":2,"minecraft:play_time":8573,"minecraft:sprint_one_cm":2861,"minecraft:time_since_death":8573,"minecraft:walk_one_cm":2733,"minecraft:sneak_time":21,"minecraft:total_world_time":6451,"minecraft:fly_one_cm":91696},"minecraft:used":{"minecraft:blue_wool":43,"minecraft:white_wool":1,"minecraft:red_wool":57,"minecraft:cobweb":17,"minecraft:grass_block":3}},"DataVersion":4080} \ No newline at end of file diff --git a/storage/v1.21/world/stats/_HeppyLP_.json b/storage/v1.21/world/stats/_HeppyLP_.json deleted file mode 100644 index 82c2a02..0000000 --- a/storage/v1.21/world/stats/_HeppyLP_.json +++ /dev/null @@ -1 +0,0 @@ -{"stat.jump":1,"achievement.exploreAllBiomes":{"value":0,"progress":["Plains"]},"stat.playOneMinute":70} \ No newline at end of file diff --git a/storage/v1.21/world/uid.dat b/storage/v1.21/world/uid.dat deleted file mode 100644 index 2d947a7..0000000 --- a/storage/v1.21/world/uid.dat +++ /dev/null @@ -1 +0,0 @@ -GDI}~ \ No newline at end of file