Skip to content

Commit

Permalink
#521 Replaced chat menu with commands and removed tons of obsolete code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Aug 2, 2024
1 parent 79c551a commit 1f4bb19
Show file tree
Hide file tree
Showing 119 changed files with 1,546 additions and 6,174 deletions.
44 changes: 37 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation("com.github.shynixn.mcutils:common:2024.19")
implementation("com.github.shynixn.mcutils:packet:2024.32")
implementation("com.github.shynixn.mcutils:database:2024.2")
implementation("com.github.shynixn.mcutils:sign:2024.2")
implementation("com.github.shynixn.mcutils:sign:2024.3")
implementation("com.github.shynixn.mcutils:guice:2024.2")
}

Expand Down Expand Up @@ -207,20 +207,50 @@ tasks.register("pluginJarLegacy", ShadowJar::class.java) {

tasks.register("languageFile") {
val kotlinSrcFolder = project.sourceSets.toList()[0].allJava.srcDirs.first { e -> e.endsWith("java") }
val languageKotlinFile = kotlinSrcFolder.resolve("com/github/shynixn/blockball/BlockBallLanguage.kt")
val resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.properties")
val bundle = FileInputStream(resourceFile).use { stream ->

// Contract file
var languageKotlinFile = kotlinSrcFolder.resolve("com/github/shynixn/blockball/contract/BlockBallLanguage.kt")
var resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.properties")
var bundle = FileInputStream(resourceFile).use { stream ->
PropertyResourceBundle(stream)
}

var contents = ArrayList<String>()
contents.add("package com.github.shynixn.blockball.contract")
contents.add("")
contents.add("interface BlockBallLanguage {")
for (key in bundle.keys) {
val value = bundle.getString(key)
contents.add(" /** $value **/")
contents.add(" var ${key} : String")
contents.add("")
}
contents.removeLast()
contents.add("}")

languageKotlinFile.printWriter().use { out ->
for (line in contents) {
out.println(line)
}
}

// Impl File
languageKotlinFile = kotlinSrcFolder.resolve("com/github/shynixn/blockball/BlockBallLanguageImpl.kt")
resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.properties")
bundle = FileInputStream(resourceFile).use { stream ->
PropertyResourceBundle(stream)
}

val contents = ArrayList<String>()
contents = ArrayList<String>()
contents.add("package com.github.shynixn.blockball")
contents.add("")
contents.add("object BlockBallLanguage {")
contents.add("import com.github.shynixn.blockball.contract.BlockBallLanguage")
contents.add("")
contents.add("object BlockBallLanguageImpl : BlockBallLanguage {")
for (key in bundle.keys) {
val value = bundle.getString(key)
contents.add(" /** $value **/")
contents.add(" var ${key} : String = \"$value\"")
contents.add(" override var ${key} : String = \"$value\"")
contents.add("")
}
contents.removeLast()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.github.shynixn.blockball

import com.fasterxml.jackson.core.type.TypeReference
import com.github.shynixn.blockball.contract.*
import com.github.shynixn.blockball.entity.Arena
import com.github.shynixn.blockball.entity.SoccerArena
import com.github.shynixn.blockball.entity.PlayerInformation
import com.github.shynixn.blockball.impl.service.*
import com.github.shynixn.mccoroutine.bukkit.launch
Expand Down Expand Up @@ -54,14 +54,14 @@ class BlockBallDependencyInjectionModule(
addService<Plugin>(plugin)

// Repositories
val arenaRepository = YamlFileRepositoryImpl<Arena>(plugin, "arena",
val arenaRepository = YamlFileRepositoryImpl<SoccerArena>(plugin, "soccerArena",
listOf(Pair("arena_sample.yml", "arena_sample.yml")),
listOf("arena_sample.yml"),
object : TypeReference<Arena>() {}
object : TypeReference<SoccerArena>() {}
)
val cacheArenaRepository = CachedRepositoryImpl(arenaRepository)
addService<Repository<Arena>>(cacheArenaRepository)
addService<CacheRepository<Arena>>(cacheArenaRepository)
addService<Repository<SoccerArena>>(cacheArenaRepository)
addService<CacheRepository<SoccerArena>>(cacheArenaRepository)
val configSelectedPlayerDataRepository = ConfigSelectedRepositoryImpl<PlayerInformation>(
plugin,
"BlockBall",
Expand All @@ -75,9 +75,9 @@ class BlockBallDependencyInjectionModule(
)
addService<PlayerDataRepository<PlayerInformation>>(playerDataRepository)
addService<CachePlayerRepository<PlayerInformation>>(playerDataRepository)
addService<BlockBallLanguage>(BlockBallLanguageImpl)

// Services
addService<CommandService, CommandServiceImpl>()
addService<com.github.shynixn.mcutils.common.command.CommandService>(
com.github.shynixn.mcutils.common.command.CommandServiceImpl(
object : CoroutineExecutor {
Expand All @@ -94,9 +94,8 @@ class BlockBallDependencyInjectionModule(
addService<GameService, GameServiceImpl>()
addService<ItemService>(ItemServiceImpl())
addService<ChatMessageService>(ChatMessageServiceImpl(plugin))
addService<RightclickManageService, RightclickManageServiceImpl>()
addService<HubGameForcefieldService, HubGameForcefieldServiceImpl>()
addService<BallEntityService, BallEntityServiceImpl>()
addService<SoccerBallFactory, SoccerBallFactoryImpl>()
addService<BlockSelectionService, BlockSelectionServiceImpl>()
addService<RayTracingService, RayTracingServiceImpl>()

Expand Down
162 changes: 0 additions & 162 deletions src/main/java/com/github/shynixn/blockball/BlockBallLanguage.kt

This file was deleted.

Loading

0 comments on commit 1f4bb19

Please sign in to comment.