From 1b3d7fe3af4d04459c18625f98d9110cb7790d13 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 5 Apr 2024 11:22:40 +0200 Subject: [PATCH] #485 Simplified arena loading using mcutils. --- build.gradle.kts | 18 +- .../BlockBallDependencyInjectionBinder.kt | 18 +- .../contract/ScreenMessageService.kt | 16 - .../blockball/contract/TemplateService.kt | 24 - .../deprecated/YamlSerializationService.kt | 15 - .../blockball/deprecated/YamlSerialize.kt | 26 - .../blockball/deprecated/YamlSerializer.kt | 14 - .../blockball/deprecated/YamlService.kt | 16 - .../github/shynixn/blockball/entity/Arena.kt | 6 - .../shynixn/blockball/entity/ArenaMeta.kt | 16 - .../blockball/entity/ArenaProtectionMeta.kt | 5 - .../shynixn/blockball/entity/BallMeta.kt | 22 - .../shynixn/blockball/entity/BossBarMeta.kt | 7 - .../blockball/entity/BungeeCordMeta.kt | 2 - .../shynixn/blockball/entity/CommandMeta.kt | 3 - .../blockball/entity/CustomizationMeta.kt | 7 - .../blockball/entity/DoubleJumpMeta.kt | 7 - .../shynixn/blockball/entity/HologramMeta.kt | 4 - .../shynixn/blockball/entity/HubLobbyMeta.kt | 6 - .../shynixn/blockball/entity/LobbyMeta.kt | 14 +- .../shynixn/blockball/entity/MatchTimeMeta.kt | 11 - .../blockball/entity/MinigameLobbyMeta.kt | 5 - .../blockball/entity/MovementConfiguration.kt | 12 - .../github/shynixn/blockball/entity/Offset.kt | 4 - .../shynixn/blockball/entity/Particle.kt | 7 - .../shynixn/blockball/entity/Position.kt | 7 - .../github/shynixn/blockball/entity/Reward.kt | 3 - .../blockball/entity/ScoreboardMeta.kt | 6 - .../shynixn/blockball/entity/Selection.kt | 3 - .../blockball/entity/SignCollection.kt | 3 - .../github/shynixn/blockball/entity/Sound.kt | 5 - .../shynixn/blockball/entity/SpectatorMeta.kt | 7 - .../shynixn/blockball/entity/TeamMeta.kt | 43 -- .../shynixn/blockball/entity/Template.kt | 15 - .../commandexecutor/ArenaCommandExecutor.kt | 3 +- .../impl/commandmenu/ListablePage.kt | 33 - .../impl/commandmenu/TemplateSettingsPage.kt | 120 ---- .../impl/repository/ArenaFileRepository.kt | 97 --- .../impl/serializer/ItemStackSerializer.kt | 32 - .../service/GameMiniGameActionServiceImpl.kt | 16 +- .../impl/service/GameSoccerServiceImpl.kt | 7 +- .../impl/service/TemplateServiceImpl.kt | 120 ---- .../service/YamlSerializationServiceImpl.kt | 443 ------------ .../blockball/impl/service/YamlServiceImpl.kt | 43 -- .../v1_13_R2/ScreenMessage113R1ServiceImpl.kt | 25 - .../v1_8_R3/ScreenMessage18R3ServiceImpl.kt | 136 ---- src/main/resources/META-INF/MANIFEST.MF | 2 - src/main/resources/arena_sample.yml | 629 ++++++++++++++++++ src/main/resources/plugin.yml | 16 +- src/main/resources/template/arena.yml | 470 ------------- 50 files changed, 664 insertions(+), 1905 deletions(-) delete mode 100644 src/main/java/com/github/shynixn/blockball/contract/ScreenMessageService.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/contract/TemplateService.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/deprecated/YamlSerializationService.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/deprecated/YamlSerialize.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/deprecated/YamlSerializer.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/deprecated/YamlService.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/entity/Template.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/commandmenu/TemplateSettingsPage.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/serializer/ItemStackSerializer.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/service/TemplateServiceImpl.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/service/YamlSerializationServiceImpl.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/service/YamlServiceImpl.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/service/nms/v1_13_R2/ScreenMessage113R1ServiceImpl.kt delete mode 100644 src/main/java/com/github/shynixn/blockball/impl/service/nms/v1_8_R3/ScreenMessage18R3ServiceImpl.kt delete mode 100644 src/main/resources/META-INF/MANIFEST.MF create mode 100644 src/main/resources/arena_sample.yml delete mode 100644 src/main/resources/template/arena.yml diff --git a/build.gradle.kts b/build.gradle.kts index aae4e55a8..313286bdd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -32,19 +32,17 @@ dependencies { // Library dependencies with legacy compatibility, we can use more up-to-date version in the plugin.yml implementation("com.github.shynixn.org.bstats:bstats-bukkit:1.7") - implementation("org.slf4j:slf4j-jdk14:1.7.25") - implementation("com.google.inject:guice:5.0.1") - implementation("commons-io:commons-io:2.6") - implementation("com.google.code.gson:gson:2.8.6") implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.13.0") implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.13.0") implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.3.0") implementation("com.fasterxml.jackson.core:jackson-databind:2.2.3") + implementation("com.google.inject:guice:5.0.1") + implementation("com.google.code.gson:gson:2.8.6") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2") // Custom dependencies - implementation("com.github.shynixn.mcutils:common:1.0.61") - implementation("com.github.shynixn.mcutils:packet:1.0.82") + implementation("com.github.shynixn.mcutils:common:1.0.65") + implementation("com.github.shynixn.mcutils:packet:1.0.86") implementation("com.github.shynixn.mcutils:sign:1.0.17") } @@ -158,6 +156,14 @@ tasks.register("pluginJarLatest", ShadowJar::class.java) { archiveName = "${baseName}-${version}-latest.${extension}" // destinationDir = File("C:\\temp\\plugins") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_8_R3/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_9_R2/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_18_R1/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_18_R2/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_19_R1/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_19_R2/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_19_R3/**") + exclude("com/github/shynixn/blockball/lib/com/github/shynixn/mcutils/packet/nms/v1_20_R1/**") exclude("com/github/shynixn/mcutils/**") exclude("com/github/shynixn/mccoroutine/**") exclude("org/**") diff --git a/src/main/java/com/github/shynixn/blockball/BlockBallDependencyInjectionBinder.kt b/src/main/java/com/github/shynixn/blockball/BlockBallDependencyInjectionBinder.kt index ef49073ff..4f7bb5e44 100644 --- a/src/main/java/com/github/shynixn/blockball/BlockBallDependencyInjectionBinder.kt +++ b/src/main/java/com/github/shynixn/blockball/BlockBallDependencyInjectionBinder.kt @@ -3,19 +3,16 @@ package com.github.shynixn.blockball import com.github.shynixn.blockball.contract.DependencyVaultService import com.github.shynixn.blockball.contract.HubGameForcefieldService import com.github.shynixn.blockball.contract.* -import com.github.shynixn.blockball.deprecated.YamlSerializationService -import com.github.shynixn.blockball.deprecated.YamlService import com.github.shynixn.blockball.enumeration.* import com.github.shynixn.blockball.impl.repository.ArenaFileRepository import com.github.shynixn.blockball.impl.service.DependencyServiceImpl import com.github.shynixn.blockball.impl.service.* import com.github.shynixn.blockball.impl.service.nms.v1_13_R2.Particle113R2ServiceImpl -import com.github.shynixn.blockball.impl.service.nms.v1_13_R2.ScreenMessage113R1ServiceImpl import com.github.shynixn.blockball.impl.service.nms.v1_8_R3.Particle18R3ServiceImpl -import com.github.shynixn.blockball.impl.service.nms.v1_8_R3.ScreenMessage18R3ServiceImpl import com.github.shynixn.mcutils.common.ConfigurationService import com.github.shynixn.mcutils.common.ConfigurationServiceImpl import com.github.shynixn.mcutils.common.Version +import com.github.shynixn.mcutils.common.chat.ChatMessageService import com.github.shynixn.mcutils.common.item.ItemService import com.github.shynixn.mcutils.common.item.ItemServiceImpl import com.github.shynixn.mcutils.common.sound.SoundService @@ -23,6 +20,7 @@ import com.github.shynixn.mcutils.common.sound.SoundServiceImpl import com.github.shynixn.mcutils.packet.api.EntityService import com.github.shynixn.mcutils.packet.api.PacketService import com.github.shynixn.mcutils.packet.api.RayTracingService +import com.github.shynixn.mcutils.packet.impl.service.ChatMessageServiceImpl import com.github.shynixn.mcutils.packet.impl.service.EntityServiceImpl import com.github.shynixn.mcutils.packet.impl.service.RayTracingServiceImpl import com.google.inject.AbstractModule @@ -56,7 +54,6 @@ class BlockBallDependencyInjectionBinder( bind(CommandService::class.java).to(CommandServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(PacketService::class.java).toInstance(packetService) bind(EntityService::class.java).toInstance(EntityServiceImpl()) - bind(TemplateService::class.java).to(TemplateServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(ScoreboardService::class.java).to(ScoreboardServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(ConfigurationService::class.java).toInstance(ConfigurationServiceImpl(plugin)) bind(SoundService::class.java).toInstance(SoundServiceImpl(plugin)) @@ -69,13 +66,12 @@ class BlockBallDependencyInjectionBinder( .`in`(Scopes.SINGLETON) bind(ItemService::class.java).to(ItemServiceImpl::class.java) .`in`(Scopes.SINGLETON) + bind(ChatMessageService::class.java).toInstance(ChatMessageServiceImpl()) bind(GameSoccerService::class.java).to(GameSoccerServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(RightclickManageService::class.java).to(RightclickManageServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(HubGameForcefieldService::class.java).to(HubGameForcefieldServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(BallEntityService::class.java).to(BallEntityServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(BlockSelectionService::class.java).to(BlockSelectionServiceImpl::class.java).`in`(Scopes.SINGLETON) - bind(YamlSerializationService::class.java).to(YamlSerializationServiceImpl::class.java).`in`(Scopes.SINGLETON) - bind(YamlService::class.java).to(YamlServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(ItemTypeService::class.java).to(ItemTypeServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(ProxyService::class.java).to(ProxyServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(GameExecutionService::class.java).to(GameExecutionServiceImpl::class.java).`in`(Scopes.SINGLETON) @@ -85,14 +81,6 @@ class BlockBallDependencyInjectionBinder( bind(DependencyService::class.java).to(DependencyServiceImpl::class.java).`in`(Scopes.SINGLETON) bind(RayTracingService::class.java).toInstance(RayTracingServiceImpl()) - when { - Version.serverVersion.isVersionSameOrGreaterThan(Version.VERSION_1_17_R1) - -> bind(ScreenMessageService::class.java).to(ScreenMessage113R1ServiceImpl::class.java) - .`in`(Scopes.SINGLETON) - else -> bind(ScreenMessageService::class.java).to(ScreenMessage18R3ServiceImpl::class.java) - .`in`(Scopes.SINGLETON) - } - when { Version.serverVersion.isVersionSameOrGreaterThan(Version.VERSION_1_13_R2) -> bind(ParticleService::class.java).to( Particle113R2ServiceImpl::class.java diff --git a/src/main/java/com/github/shynixn/blockball/contract/ScreenMessageService.kt b/src/main/java/com/github/shynixn/blockball/contract/ScreenMessageService.kt deleted file mode 100644 index 078a461d0..000000000 --- a/src/main/java/com/github/shynixn/blockball/contract/ScreenMessageService.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.github.shynixn.blockball.contract - -import org.bukkit.entity.Player - -interface ScreenMessageService { - /** - * Sets the [title] of the given [player] [P] for the amount of [stay] ticks. Optionally shows a [subTitle] and displays - * a [fadeIn] and [fadeOut] effect in ticks. - */ - fun setTitle(player: Player, title: String, subTitle: String = "", fadeIn: Int, stay: Int, fadeOut: Int) - - /** - * Sets the [message] for the given [player] at the actionbar. - */ - fun setActionBar(player: Player, message: String) -} diff --git a/src/main/java/com/github/shynixn/blockball/contract/TemplateService.kt b/src/main/java/com/github/shynixn/blockball/contract/TemplateService.kt deleted file mode 100644 index 27b6fe954..000000000 --- a/src/main/java/com/github/shynixn/blockball/contract/TemplateService.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.github.shynixn.blockball.contract - -import com.github.shynixn.blockball.entity.Arena -import com.github.shynixn.blockball.entity.Template - - -interface TemplateService { - - /** - * Copies the stored templates file to the template folder if they - * do not already exist. - */ - fun copyTemplateFilesFromResources() - - /** - * Returns a [List] of available - */ - fun getAvailableTemplates(): List