Skip to content

Commit

Permalink
#485 Simplified arena loading using mcutils.
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Apr 5, 2024
1 parent 038cd4f commit 1b3d7fe
Show file tree
Hide file tree
Showing 50 changed files with 664 additions and 1,905 deletions.
18 changes: 12 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down Expand Up @@ -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/**")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ 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
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
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand All @@ -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
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/java/com/github/shynixn/blockball/entity/Arena.kt
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
package com.github.shynixn.blockball.entity

import com.fasterxml.jackson.annotation.JsonPropertyOrder
import com.github.shynixn.blockball.deprecated.YamlSerialize
import com.github.shynixn.blockball.enumeration.GameType

@JsonPropertyOrder("name", "displayName", "enabled", "gameType", "corner1", "corner2", "meta")
class Arena : Selection(){
/** Unique [name] of the arena. */
@YamlSerialize(orderNumber = 1, value = "name")
var name: String = ""

/** [displayName] of the arena on signs or messages. */
@YamlSerialize(orderNumber = 2, value = "displayname")
var displayName: String = ""

/** Is the arena ready to be placed. */
@YamlSerialize(orderNumber = 3, value = "enabled")
var enabled: Boolean = true

/** [gameType] of the arena */
@YamlSerialize(orderNumber = 4, value = "gamemode")
var gameType: GameType = GameType.HUBGAME

/** Collection of the arena meta data. */
@YamlSerialize(orderNumber = 7, value = "meta")
val meta: ArenaMeta = ArenaMeta()
}
16 changes: 0 additions & 16 deletions src/main/java/com/github/shynixn/blockball/entity/ArenaMeta.kt
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@
package com.github.shynixn.blockball.entity

import com.github.shynixn.blockball.deprecated.YamlSerialize
import com.github.shynixn.blockball.enumeration.BallActionType
import com.github.shynixn.blockball.enumeration.ParticleType

class ArenaMeta {
/** Meta data for spectating setting. */
@YamlSerialize(orderNumber = 12, value = "spectator-meta")
val spectatorMeta: SpectatorMeta = SpectatorMeta()

/** Meta data of the customizing Properties. */
@YamlSerialize(orderNumber = 13, value = "customizing-meta")
val customizingMeta: CustomizationMeta = CustomizationMeta()

/** Meta data for rewards */
@YamlSerialize(orderNumber = 10, value = "reward-meta")
val rewardMeta: Reward = Reward()

/** Meta data of all holograms. */
val hologramMetas: ArrayList<HologramMeta>
get() = this.internalHologramMetas as ArrayList<HologramMeta>

/** Meta data of a generic lobby. */
@YamlSerialize(orderNumber = 1, value = "meta")
val lobbyMeta: LobbyMeta = LobbyMeta()

/** Meta data of the hub lobby. */
@YamlSerialize(orderNumber = 2, value = "hubgame-meta")
var hubLobbyMeta: HubLobbyMeta = HubLobbyMeta()

/** Meta data of the minigame lobby. */
@YamlSerialize(orderNumber = 3, value = "minigame-meta")
val minigameMeta: MinigameLobbyMeta = MinigameLobbyMeta()

/** Meta data of the bungeecord lobby. */
@YamlSerialize(orderNumber = 4, value = "bungeecord-meta")
val bungeeCordMeta: BungeeCordMeta = BungeeCordMeta()

/** Meta data of the doubleJump. */
@YamlSerialize(orderNumber = 8, value = "double-jump")
val doubleJumpMeta: DoubleJumpMeta = DoubleJumpMeta()

/** Meta data of the bossbar. */
@YamlSerialize(orderNumber = 7, value = "bossbar")
val bossBarMeta: BossBarMeta = BossBarMeta()

/** Meta data of the scoreboard. */
@YamlSerialize(orderNumber = 6, value = "scoreboard")
val scoreboardMeta: ScoreboardMeta = ScoreboardMeta()

/** Meta data of proection. */
@YamlSerialize(orderNumber = 5, value = "protection")
val protectionMeta: ArenaProtectionMeta = ArenaProtectionMeta()

/** Meta data of the ball. */
@YamlSerialize(orderNumber = 4, value = "ball")
val ballMeta: BallMeta = BallMeta()

/** Meta data of the blueTeam. */
@YamlSerialize(orderNumber = 3, value = "team-blue")
val blueTeamMeta: TeamMeta = TeamMeta(
"%blockball_lang_teamBlueDisplayName%",
"%blockball_lang_teamBlueColor%",
Expand All @@ -71,7 +57,6 @@ class ArenaMeta {
)

/** Meta data of the redTeam. */
@YamlSerialize(orderNumber = 2, value = "team-red")
val redTeamMeta: TeamMeta = TeamMeta(
"%blockball_lang_teamRedDisplayName%",
"%blockball_lang_teamRedColor%",
Expand All @@ -83,7 +68,6 @@ class ArenaMeta {
"%blockball_lang_teamRedDrawSubTitle%"
)

@YamlSerialize(orderNumber = 9, value = "holograms")
private val internalHologramMetas: ArrayList<HologramMeta> = ArrayList()

init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package com.github.shynixn.blockball.entity

import com.github.shynixn.blockball.deprecated.YamlSerialize

class ArenaProtectionMeta {
/** Velocity being applied when an entity enters the arena which is not an player or armorstand. */
@YamlSerialize(value = "entity-protection", orderNumber = 2, implementation = Position::class)
var entityProtection: Position = Position(5.0, 2.0, 5.0)
/** Should a velocity be applied to entities which are not an player or armorstand. */
@YamlSerialize(value = "entity-protection-enabled", orderNumber = 1)
var entityProtectionEnabled: Boolean = true
/** Velocity being applied when a player rejoins the server into a field of an arena. */
@YamlSerialize(value = "rejoin-protection", orderNumber = 4, implementation = Position::class)
var rejoinProtection: Position = Position(0.0, 2.0, 0.0)
/** Should a velocity be applied to players which rejoin on the field of the arena. */
@YamlSerialize(value = "rejoin-protection-enabled", orderNumber = 3)
var rejoinProtectionEnabled: Boolean = true
}
Loading

0 comments on commit 1b3d7fe

Please sign in to comment.