-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump deps * update ido
- Loading branch information
Showing
15 changed files
with
93 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group=com.mineinabyss | ||
version=1.7 | ||
kotlinVersion=1.6.10 | ||
kotlinVersion=1.7.10 | ||
serverVersion=1.19.2-R0.1-SNAPSHOT | ||
idofrontVersion=0.12.112 | ||
idofrontVersion=0.14.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 15 additions & 20 deletions
35
src/main/kotlin/com/mineinabyss/bonfire/config/BonfireConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
@file:UseSerializers(DurationSerializer::class) | ||
|
||
package com.mineinabyss.bonfire.config | ||
|
||
import com.mineinabyss.bonfire.bonfirePlugin | ||
import com.mineinabyss.bonfire.ecs.components.SoundEffect | ||
import com.mineinabyss.idofront.config.IdofrontConfig | ||
import com.mineinabyss.idofront.serialization.DurationSerializer | ||
import com.mineinabyss.idofront.serialization.SerializableItemStack | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.UseSerializers | ||
import kotlin.time.Duration | ||
|
||
object BonfireConfig : IdofrontConfig<BonfireConfig.Data>(bonfirePlugin, Data.serializer()) { | ||
@Serializable | ||
data class Data( | ||
var bonfireItem: SerializableItemStack, | ||
var modelItem: SerializableItemStack, | ||
var maxPlayerCount: Int, | ||
var bonfireExpirationTime: Duration, | ||
var bonfireInteractCooldown: Duration, | ||
var respawnSetSound: SoundEffect, | ||
var respawnUnsetSound: SoundEffect, | ||
var minFallDist: Int, | ||
var effectRadius: Double, | ||
var effectStrength: Float, | ||
var effectRegenRate: Int | ||
) | ||
} | ||
val bonfireConfig get() = bonfirePlugin.config.data | ||
@Serializable | ||
data class BonfireConfig( | ||
var bonfireItem: SerializableItemStack, | ||
var modelItem: SerializableItemStack, | ||
var maxPlayerCount: Int, | ||
var bonfireExpirationTime: @Serializable(with = DurationSerializer::class) Duration, | ||
var bonfireInteractCooldown: @Serializable(with = DurationSerializer::class) Duration, | ||
var respawnSetSound: SoundEffect, | ||
var respawnUnsetSound: SoundEffect, | ||
var minFallDist: Int, | ||
var effectRadius: Double, | ||
var effectStrength: Float, | ||
var effectRegenRate: Int | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
src/main/kotlin/com/mineinabyss/bonfire/ecs/systems/BonfireEffectSystem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
package com.mineinabyss.bonfire.ecs.systems | ||
|
||
import com.mineinabyss.bonfire.config.BonfireConfig | ||
import com.mineinabyss.bonfire.config.bonfireConfig | ||
import com.mineinabyss.bonfire.ecs.components.BonfireEffectArea | ||
import com.mineinabyss.bonfire.extensions.isBonfireModel | ||
import com.mineinabyss.geary.annotations.AutoScan | ||
import com.mineinabyss.geary.systems.RepeatingSystem | ||
import com.mineinabyss.geary.systems.accessors.TargetScope | ||
import com.mineinabyss.idofront.time.ticks | ||
import org.bukkit.Particle | ||
import org.bukkit.entity.ArmorStand | ||
import org.bukkit.entity.Player | ||
|
||
@AutoScan | ||
class BonfireEffectSystem : RepeatingSystem(1.ticks) { | ||
private val TargetScope.player by get<Player>() | ||
private val TargetScope.effect by get<BonfireEffectArea>() | ||
|
||
override fun TargetScope.tick() { | ||
// Check if still near a bonfire | ||
player.location.getNearbyLivingEntities(BonfireConfig.data.effectRadius).firstOrNull { | ||
player.location.getNearbyLivingEntities(bonfireConfig.effectRadius).firstOrNull { | ||
it is ArmorStand && it.isBonfireModel() && it.uniqueId == effect.uuid | ||
}?.let { | ||
player.location.world.spawnParticle( | ||
listOf(Particle.SOUL, Particle.SOUL_FIRE_FLAME).random(), | ||
player.location, 1, 0.5, 1.0, 0.5, 0.0 | ||
) | ||
|
||
player.saturation = BonfireConfig.data.effectStrength | ||
player.saturatedRegenRate = BonfireConfig.data.effectRegenRate | ||
player.saturation = bonfireConfig.effectStrength | ||
player.saturatedRegenRate = bonfireConfig.effectRegenRate | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.