Skip to content

Commit

Permalink
#512 Fixed placeholder resolving.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Jun 19, 2024
1 parent 07c24b5 commit aa7d38d
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 537 deletions.
2 changes: 1 addition & 1 deletion docs/source/customizing/placeholders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The following placeholders are available in BlockBall and can also be used via P

.. note:: PlaceHolders can be used in Messages, Signs, Scoreboards, BossBars and Holograms.

.. note:: In order to use BlockBall placeholders in external plugins, the player has to be in a BlockBall game or append the id of the arena to the placeholder e.g. "%blockball_game_blueScore_1%".
.. note:: In order to use BlockBall placeholders in external plugins, the player has to be in a BlockBall game or append the id of the arena to the placeholder e.g. "%blockball_game_blueScore_arena_1%".

Placeholderlist
~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import com.github.shynixn.blockball.entity.Arena
import com.github.shynixn.blockball.entity.PlayerInformation
import com.github.shynixn.blockball.enumeration.PluginDependency
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_8_R3.Particle18R3ServiceImpl
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.repository.CacheRepository
Expand Down Expand Up @@ -101,11 +98,6 @@ class BlockBallDependencyInjectionModule(
addService<DependencyBossBarApiService, DependencyBossBarApiServiceImpl>()
addService<RayTracingService, RayTracingServiceImpl>()

when {
Version.serverVersion.isVersionSameOrGreaterThan(Version.VERSION_1_13_R2) -> addService<ParticleService, Particle113R2ServiceImpl>()
else -> addService<ParticleService, Particle18R3ServiceImpl>()
}

if (Bukkit.getPluginManager().getPlugin(PluginDependency.PLACEHOLDERAPI.pluginName) != null) {
addService<PlaceHolderService, DependencyPlaceHolderServiceImpl>()
plugin.logger.log(Level.INFO, "Loaded dependency ${PluginDependency.PLACEHOLDERAPI.pluginName}.")
Expand Down

This file was deleted.

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

import com.github.shynixn.blockball.enumeration.BallActionType
import com.github.shynixn.blockball.enumeration.ParticleType
import com.github.shynixn.mcutils.common.sound.SoundMeta

class ArenaMeta {
Expand Down Expand Up @@ -72,46 +71,6 @@ class ArenaMeta {
private val internalHologramMetas: ArrayList<HologramMeta> = ArrayList()

init {
val partMetaSpawn = Particle()
partMetaSpawn.typeName = ParticleType.EXPLOSION_NORMAL.name
partMetaSpawn.amount = 10
partMetaSpawn.speed = 0.1
partMetaSpawn.offset.x = 2.0
partMetaSpawn.offset.y = 2.0
partMetaSpawn.offset.z = 2.0

ballMeta.particleEffects[BallActionType.ONSPAWN] = partMetaSpawn

val partMetaInteraction = Particle()
partMetaInteraction.typeName = ParticleType.CRIT.name
partMetaInteraction.amount = 5
partMetaInteraction.speed = 0.1
partMetaInteraction.offset.x = 2.0
partMetaInteraction.offset.y = 2.0
partMetaInteraction.offset.z = 2.0

ballMeta.particleEffects[BallActionType.ONINTERACTION] = partMetaInteraction

val partMetaKick = Particle()
partMetaKick.typeName = ParticleType.EXPLOSION_LARGE.name
partMetaKick.amount = 5
partMetaKick.speed = 0.1
partMetaKick.offset.x = 0.2
partMetaKick.offset.y = 0.2
partMetaKick.offset.z = 0.2

ballMeta.particleEffects[BallActionType.ONKICK] = partMetaKick

val partMetaShoot = Particle()
partMetaShoot.typeName = ParticleType.EXPLOSION_NORMAL.name
partMetaShoot.amount = 5
partMetaShoot.speed = 0.1
partMetaShoot.offset.x = 0.1
partMetaShoot.offset.y = 0.1
partMetaShoot.offset.z = 0.1

ballMeta.particleEffects[BallActionType.ONPASS] = partMetaShoot

val soundMetaKick = SoundMeta()
soundMetaKick.name = "ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR,ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,ZOMBIE_WOOD"
soundMetaKick.volume = 10.0
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/github/shynixn/blockball/entity/BallMeta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ class BallMeta {
*/
val movementModifier: MovementConfiguration = MovementConfiguration()

/**
* Particle effects.
*/
val particleEffects: MutableMap<BallActionType, Particle> = HashMap()

/**
* Particle effects.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.github.shynixn.blockball.entity

import com.github.shynixn.blockball.enumeration.ParticleType
import com.github.shynixn.mcutils.common.sound.SoundMeta


class DoubleJumpMeta {
/** Is the effect enabled or disabled?*/
var enabled: Boolean = true
Expand All @@ -14,19 +12,10 @@ class DoubleJumpMeta {
/** Horizontal strength modifier.*/
var horizontalStrength: Double = 2.0
/** ParticleEffect being played when activating this.*/
val particleEffect: Particle = Particle(ParticleType.EXPLOSION_NORMAL.name)
/** SoundEffect being played when activating this.*/
val soundEffect: SoundMeta = SoundMeta().also {
it.name = "ENTITY_GHAST_SHOOT,GHAST_FIREBALL"
it.pitch = 1.0
it.volume = 10.0
}

init {
particleEffect.amount = 4
particleEffect.speed = 0.0002
particleEffect.offset.x = 2.0
particleEffect.offset.y = 2.0
particleEffect.offset.z = 2.0
}
}
59 changes: 0 additions & 59 deletions src/main/java/com/github/shynixn/blockball/entity/Particle.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class ArenaCommandExecutor @Inject constructor(
bossbarPage: BossbarPage,
signSettingsPage: SignSettingsPage,
rewardsPage: RewardsPage,
particlesPage: ParticleEffectPage,
soundsPage: SoundEffectPage,
abilitiesPage: AbilitiesSettingsPage,
doubleJumpPage: DoubleJumpPage,
Expand Down Expand Up @@ -71,7 +70,6 @@ class ArenaCommandExecutor @Inject constructor(
bossbarPage,
signSettingsPage,
rewardsPage,
particlesPage,
soundsPage,
abilitiesPage,
doubleJumpPage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.github.shynixn.blockball.impl.commandmenu

import com.github.shynixn.blockball.entity.Arena
import com.github.shynixn.blockball.entity.ChatBuilder
import com.github.shynixn.blockball.entity.Particle
import com.github.shynixn.blockball.enumeration.*
import com.github.shynixn.mcutils.common.sound.SoundMeta

Expand Down Expand Up @@ -54,8 +53,6 @@ class BallSettingsPage : Page(BallSettingsPage.ID, MainSettingsPage.ID) {
ballMeta.alwaysBounce = !ballMeta.alwaysBounce
} else if (command == MenuCommand.BALL_TOGGLE_ROTATING) {
ballMeta.rotating = !ballMeta.rotating
} else if (command == MenuCommand.BALL_PARTICLEACTION_CALLBACK && args.size == 3) {
cache[5] = ballMeta.particleEffects[BallActionType.values()[args[2].toInt()]]
} else if (command == MenuCommand.BALL_SOUNDACTION_CALLBACK && args.size == 3) {
cache[5] = ballMeta.soundEffects[BallActionType.values()[args[2].toInt()]]
}
Expand Down Expand Up @@ -128,23 +125,12 @@ class BallSettingsPage : Page(BallSettingsPage.ID, MainSettingsPage.ID) {
.setClickAction(ChatClickAction.RUN_COMMAND, MenuCommand.LIST_BALL_SOUNDEFFECTS.command)
.setHoverText("Opens the selection page for action binders.")
.builder().nextLine()
.component("- Particle Effect: ").builder()
.component(MenuClickableItem.SELECT.text).setColor(MenuClickableItem.SELECT.color)
.setClickAction(ChatClickAction.RUN_COMMAND, MenuCommand.LIST_BALL_PARTICLEFFECTS.command)
.setHoverText("Opens the selection page for action binders.")
.builder().nextLine()
if (cache[5] != null && cache[5] is SoundMeta) {
builder.component("- Selected Sound-effect: ").builder().component(MenuClickableItem.PAGE.text)
.setColor(MenuClickableItem.PAGE.color)
.setClickAction(ChatClickAction.RUN_COMMAND, MenuCommand.SOUND_BALL.command)
.setHoverText("Opens the page for editing sound effects.")
.builder().nextLine()
} else if (cache[5] != null && cache[5] is Particle) {
builder.component("- Selected Particle-effect: ").builder().component(MenuClickableItem.PAGE.text)
.setColor(MenuClickableItem.PAGE.color)
.setClickAction(ChatClickAction.RUN_COMMAND, MenuCommand.PARTICLE_BALL.command)
.setHoverText("Opens the page for editing particle effects.")
.builder().nextLine()
}
return builder
}
Expand Down

This file was deleted.

Loading

0 comments on commit aa7d38d

Please sign in to comment.