From d823c63b453495f45f5a7999c8b78d4efcebc6f0 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:10:21 +0900 Subject: [PATCH 01/23] Update gradle-wrapper.properties --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a25..41dfb879 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 8595d01d46805011c7ad662c85bddaaa2cd7e869 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:17:49 +0900 Subject: [PATCH 02/23] Update build.gradle.kts --- build.gradle.kts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1a94f81a..701aaf05 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,10 @@ plugins { - kotlin("jvm") version "1.5.21" + kotlin("jvm") version "1.7.10" } java { toolchain { - languageVersion.set(JavaLanguageVersion.of(16)) + languageVersion.set(JavaLanguageVersion.of(17)) } } @@ -16,7 +16,7 @@ allprojects { tasks { withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) { kotlinOptions { - jvmTarget = "16" + jvmTarget = "17" } } } @@ -30,12 +30,12 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.1.9") + implementation("io.github.monun:tap-api:4.6.0") testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.2") testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.2") From 98e069b2a5c256bb449c5cac21ab6594d5239ee0 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:19:18 +0900 Subject: [PATCH 03/23] Update build.gradle.kts --- psychics-core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index 271aebd0..83864dad 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -1,10 +1,10 @@ plugins { - id("org.jetbrains.dokka") version "1.5.0" + id("org.jetbrains.dokka") version "1.7.10" } dependencies { - implementation("io.github.monun:kommand-api:2.6.6") - implementation("io.github.monun:invfx-api:3.0.1") + implementation("io.github.monun:kommand-api:2.12.0") + implementation("io.github.monun:invfx-api:3.1.0") } tasks { From ff4b91eb0747636dbce8702e8900cf940c5450be Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 21:28:09 +0900 Subject: [PATCH 04/23] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa860b7b..7e2e06aa 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Psychics (paper 기반의 능력자 플러그인) -[![Kotlin](https://img.shields.io/badge/java-16.0.2-ED8B00.svg?logo=java)](https://www.azul.com/) -[![Kotlin](https://img.shields.io/badge/kotlin-1.5.21-585DEF.svg?logo=kotlin)](http://kotlinlang.org) -[![Gradle](https://img.shields.io/badge/gradle-7.2-02303A.svg?logo=gradle)](https://gradle.org) -[![Maven Central](https://img.shields.io/maven-central/v/io.github.monun/psychics)](https://search.maven.org/artifact/io.github.monun/psychics) +[![Kotlin](https://img.shields.io/badge/java-17-ED8B00.svg?logo=java)](https://www.azul.com/) +[![Kotlin](https://img.shields.io/badge/kotlin-1.7.10-585DEF.svg?logo=kotlin)](http://kotlinlang.org) +[![Gradle](https://img.shields.io/badge/gradle-7.4-02303A.svg?logo=gradle)](https://gradle.org) [![GitHub](https://img.shields.io/github/license/monun/psychics)](https://www.gnu.org/licenses/gpl-3.0.html) [![Kotlin](https://img.shields.io/badge/youtube-각별-red.svg?logo=youtube)](https://www.youtube.com/channel/UCDrAR1OWC2MD4s0JLetN0MA) From 823f879f5f74b69555ea1abf0f5186d7e4bcf2f3 Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 21:36:31 +0900 Subject: [PATCH 05/23] resolve libs and optimize task --- build.gradle.kts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 701aaf05..9d526034 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,14 +12,6 @@ allprojects { repositories { mavenCentral() } - - tasks { - withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) { - kotlinOptions { - jvmTarget = "17" - } - } - } } subprojects { @@ -36,9 +28,5 @@ subprojects { implementation(kotlin("reflect")) implementation("io.github.monun:tap-api:4.6.0") - - testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.2") - testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.2") - testImplementation("org.mockito:mockito-core:3.6.28") } } From 094ebee7871340b8c4ad0d93c1aa86749fb5bf1e Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 21:37:27 +0900 Subject: [PATCH 06/23] solve FakeEntity generic problem --- .../kotlin/io/github/monun/psychics/Psychic.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/Psychic.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/Psychic.kt index 0f5bc059..47e10727 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/Psychic.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/Psychic.kt @@ -38,6 +38,8 @@ import org.bukkit.boss.BossBar import org.bukkit.configuration.ConfigurationSection import org.bukkit.entity.ArmorStand import org.bukkit.entity.Entity +import org.bukkit.entity.FallingBlock +import org.bukkit.entity.Item import org.bukkit.event.Listener import org.bukkit.event.player.PlayerEvent import org.bukkit.inventory.ItemStack @@ -132,7 +134,7 @@ class Psychic internal constructor( private lateinit var listeners: ArrayList - private lateinit var fakeEntities: MutableSet + private lateinit var fakeEntities: MutableSet> private var prevUpdateTime = 0L @@ -166,7 +168,7 @@ class Psychic internal constructor( ticker = Ticker.precision() projectiles = FakeProjectileManager() listeners = arrayListOf() - fakeEntities = Collections.newSetFromMap(WeakHashMap()) + fakeEntities = Collections.newSetFromMap(WeakHashMap()) if (concept.mana > 0.0) { manaBar = Bukkit.createBossBar(null, concept.manaColor, BarStyle.SEGMENTED_10).apply { @@ -360,7 +362,7 @@ class Psychic internal constructor( * @exception IllegalArgumentException 유효하지 않은 객체일때 발생 * @exception IllegalArgumentException 활성화되지 않은 객체일때 발생 */ - fun spawnFakeEntity(location: Location, entityClass: Class): FakeEntity { + fun spawnFakeEntity(location: Location, entityClass: Class): FakeEntity { checkState() checkEnabled() @@ -378,7 +380,7 @@ class Psychic internal constructor( * @exception IllegalArgumentException 유효하지 않은 객체일때 발생 * @exception IllegalArgumentException 활성화되지 않은 객체일때 발생 */ - fun spawnFakeFallingBlock(location: Location, blockData: BlockData): FakeEntity { + fun spawnFakeFallingBlock(location: Location, blockData: BlockData): FakeEntity { checkState() checkEnabled() @@ -396,7 +398,7 @@ class Psychic internal constructor( * @exception IllegalArgumentException 유효하지 않은 객체일때 발생 * @exception IllegalArgumentException 활성화되지 않은 객체일때 발생 */ - fun spawnItem(location: Location, itemStack: ItemStack): FakeEntity { + fun spawnItem(location: Location, itemStack: ItemStack): FakeEntity { checkState() checkEnabled() @@ -414,9 +416,9 @@ class Psychic internal constructor( * @exception IllegalArgumentException 유효하지 않은 객체일때 발생 * @exception IllegalArgumentException 활성화되지 않은 객체일때 발생 */ - fun spawnMarker(location: Location): FakeEntity { + fun spawnMarker(location: Location): FakeEntity { return spawnFakeEntity(location, ArmorStand::class.java).apply { - updateMetadata { + updateMetadata { isMarker = true isInvisible = true } @@ -431,7 +433,7 @@ class Psychic internal constructor( * @exception IllegalArgumentException 유효하지 않은 객체일때 발생 * @exception IllegalArgumentException 활성화되지 않은 객체일때 발생 */ - fun marker(passenger: FakeEntity): FakeEntity { + fun marker(passenger: FakeEntity): FakeEntity { return spawnMarker(passenger.location).apply { addPassenger(passenger) } } From 1aa551c736d942fd7bc2bbea04adaddf33a9178d Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 22:13:48 +0900 Subject: [PATCH 07/23] update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e2e06aa..68293304 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,9 @@ 현재 개발 진행중으로 배포버전이 없습니다. -* [docs](https://monun.github.io/psychics/) \ No newline at end of file +* [docs](https://monun.github.io/psychics/) + +--- +## TODO + +* [ ] Show Firework without Tap Effect Util \ No newline at end of file From f3c82d3d6e4f386657a52fd4a26dfc9213fb8ccf Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 22:14:35 +0900 Subject: [PATCH 08/23] Complete Migration to paper 1.19 --- .../monun/psychics/ability/berserker/AbilityBerserker.kt | 4 ++-- .../github/monun/psychics/ability/bomber/AbilityBomber.kt | 8 ++++---- .../github/monun/psychics/ability/fangs/AbilityFangs.kt | 2 +- .../psychics/ability/magicarchery/AbilityMagicArchery.kt | 4 ++-- .../github/monun/psychics/ability/sample/AbilitySample.kt | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt index 70768d34..1ecccffc 100644 --- a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt +++ b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt @@ -4,7 +4,7 @@ import io.github.monun.psychics.AbilityConcept import io.github.monun.psychics.ActiveAbility import io.github.monun.tap.config.Config import io.github.monun.tap.config.Name -import io.github.monun.tap.effect.playFirework +//import io.github.monun.tap.effect.playFirework import org.bukkit.* import org.bukkit.event.EventHandler import org.bukkit.event.Listener @@ -64,7 +64,7 @@ class AbilityBerserker : ActiveAbility(), Listener { val location = player.location.apply { y += 2.0 } val world = location.world val firework = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.RED).withFlicker().build() - world.playFirework(location, firework) + //world.playFirework(location, firework) //TODO: Show Firework without Tap Effect Util } @EventHandler(ignoreCancelled = true) diff --git a/psychics-abilities/ability-bomber/src/main/kotlin/io/github/monun/psychics/ability/bomber/AbilityBomber.kt b/psychics-abilities/ability-bomber/src/main/kotlin/io/github/monun/psychics/ability/bomber/AbilityBomber.kt index fe800d60..01d84d10 100644 --- a/psychics-abilities/ability-bomber/src/main/kotlin/io/github/monun/psychics/ability/bomber/AbilityBomber.kt +++ b/psychics-abilities/ability-bomber/src/main/kotlin/io/github/monun/psychics/ability/bomber/AbilityBomber.kt @@ -170,19 +170,19 @@ class AbilityBomber : ActiveAbility(), Listener { * 가짜 TNT 효과 */ inner class TNT(location: Location) { - private val stand: FakeEntity - private val tnt: FakeEntity + private val stand: FakeEntity + private val tnt: FakeEntity init { val psychic = psychic stand = psychic.spawnFakeEntity(location, ArmorStand::class.java).apply { - updateMetadata { + updateMetadata { isMarker = true isInvisible = true } } tnt = psychic.spawnFakeEntity(location, TNTPrimed::class.java).apply { - updateMetadata { + updateMetadata { fuseTicks = (durationTime / 50L).toInt() } } diff --git a/psychics-abilities/ability-fangs/src/main/kotlin/io/github/monun/psychics/ability/fangs/AbilityFangs.kt b/psychics-abilities/ability-fangs/src/main/kotlin/io/github/monun/psychics/ability/fangs/AbilityFangs.kt index aa9c0a50..f0944362 100644 --- a/psychics-abilities/ability-fangs/src/main/kotlin/io/github/monun/psychics/ability/fangs/AbilityFangs.kt +++ b/psychics-abilities/ability-fangs/src/main/kotlin/io/github/monun/psychics/ability/fangs/AbilityFangs.kt @@ -134,7 +134,7 @@ class AbilityFangs : ActiveAbility(), Listener { private class Fang( val location: Location, - val fakeEntity: FakeEntity, + val fakeEntity: FakeEntity, var nextRunTime: Long, val damaged: MutableSet ) : Comparable { diff --git a/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt b/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt index 2c2f5b7d..98ae3017 100644 --- a/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt +++ b/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt @@ -9,7 +9,7 @@ import io.github.monun.psychics.damage.DamageType import io.github.monun.psychics.damage.psychicDamage import io.github.monun.psychics.util.TargetFilter import io.github.monun.tap.config.Name -import io.github.monun.tap.effect.playFirework +//import io.github.monun.tap.effect.playFirework import io.github.monun.tap.trail.TrailSupport import net.kyori.adventure.text.Component.text import net.kyori.adventure.text.format.NamedTextColor @@ -132,7 +132,7 @@ class AbilityMagicArchery : Ability(), Listener { val box = target.boundingBox val effect = FireworkEffect.builder().with(FireworkEffect.Type.BURST) .withColor(if (force == 1.0F) Color.RED else Color.ORANGE).build() - world.playFirework(box.centerX, box.maxY + 0.5, box.centerZ, effect) + //world.playFirework(box.centerX, box.maxY + 0.5, box.centerZ, effect) //TODO: Show Firework without Tap Effect Util } } diff --git a/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt b/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt index 9ad83d7a..ec6a974b 100644 --- a/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt +++ b/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt @@ -8,7 +8,7 @@ import io.github.monun.psychics.damage.Damage import io.github.monun.psychics.damage.DamageType import io.github.monun.psychics.util.hostileFilter import io.github.monun.tap.config.Name -import io.github.monun.tap.effect.playFirework +//import io.github.monun.tap.effect.playFirework import net.kyori.adventure.text.Component.text import org.bukkit.* import org.bukkit.entity.LivingEntity @@ -37,7 +37,7 @@ class AbilitySample : ActiveAbility(), Listener { private val effect = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.RED).build() private fun LivingEntity.playPsychicEffect() { - world.playFirework(location, effect) + //orld.playFirework(location, effect) //TODO: Show Firework without Tap Effect Util } } From 931b5ec2d230d5f192a93ba904a4ff3f7b9fb207 Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 22:18:02 +0900 Subject: [PATCH 09/23] solve last FakeEntity generic problem --- .../psychics/ability/slingshot/AbilitySlingShot.kt | 4 ++-- .../ability/stormbreaker/AbilityStormBreaker.kt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/psychics-abilities/ability-sling-shot/src/main/kotlin/io/github/monun/psychics/ability/slingshot/AbilitySlingShot.kt b/psychics-abilities/ability-sling-shot/src/main/kotlin/io/github/monun/psychics/ability/slingshot/AbilitySlingShot.kt index baab00fa..f70e2bca 100644 --- a/psychics-abilities/ability-sling-shot/src/main/kotlin/io/github/monun/psychics/ability/slingshot/AbilitySlingShot.kt +++ b/psychics-abilities/ability-sling-shot/src/main/kotlin/io/github/monun/psychics/ability/slingshot/AbilitySlingShot.kt @@ -76,7 +76,7 @@ class AbilitySlingShot : Ability(), Listener { val projectile = CobblestoneProjectile().apply { cobblestone = this@AbilitySlingShot.psychic.spawnFakeEntity(location, ArmorStand::class.java).apply { - updateMetadata { + updateMetadata { isVisible = false isMarker = true } @@ -97,7 +97,7 @@ class AbilitySlingShot : Ability(), Listener { } inner class CobblestoneProjectile : PsychicProjectile(1200, concept.range) { - lateinit var cobblestone: FakeEntity + lateinit var cobblestone: FakeEntity override fun onPreUpdate() { velocity = velocity.apply { y -= concept.stoneGravity } diff --git a/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt b/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt index 50f5f188..03d57753 100644 --- a/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt +++ b/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt @@ -109,7 +109,7 @@ class AbilityConceptStormBreaker : AbilityConcept() { } class AbilityStormBreaker : Ability() { - private var hittedAxe: FakeEntity? = null + private var hittedAxe: FakeEntity? = null override fun onEnable() { psychic.registerEvents(AxeListener()) @@ -207,7 +207,7 @@ class AbilityStormBreaker : Ability() { ).apply { velocity = location.direction.multiply(concept.axeSpeed) - updateMetadata { + updateMetadata { isMarker = true invisible = true } @@ -229,7 +229,7 @@ class AbilityStormBreaker : Ability() { inner class AxeProjectile( private val damage: Damage, private val item: ItemStack ) : PsychicProjectile(1200, concept.range) { - var axe: FakeEntity? = null + var axe: FakeEntity? = null override fun onPreUpdate() { velocity = velocity.apply { y -= concept.axeGravity } @@ -239,7 +239,7 @@ class AbilityStormBreaker : Ability() { val to = movement.to axe?.let { axe -> axe.moveTo(to.clone().apply { y -= 1.62; yaw -= 90.0F }) - axe.updateMetadata { + axe.updateMetadata { headPose = EulerAngle(0.0, 0.0, ticks * -0.5) } } @@ -273,7 +273,7 @@ class AbilityStormBreaker : Ability() { axe?.let { axe -> this.axe = null axe.moveTo(hitLocation.clone().apply { y -= 0.5; yaw = from.yaw - 90.0F }) - axe.updateMetadata { + axe.updateMetadata { headPose = EulerAngle(0.0, 0.0, (-180.0).toRadians()) } hittedAxe = axe From 65a4bd5b0e90c6e32b01a6508e611d3c848e9f68 Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 22:23:21 +0900 Subject: [PATCH 10/23] update plugin.yml --- psychics-core/src/main/resources/plugin.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 571e4270..87da252a 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -1,9 +1,9 @@ name: Psychics main: io.github.monun.psychics.plugin.PsychicsPlugin -api-version: '1.17' +api-version: '1.19' version: $version author: Monun libraries: - - io.github.monun:tap:4.1.9 - - io.github.monun:invfx:3.0.1 - - io.github.monun:kommand:2.6.6 + - io.github.monun:tap-core:4.6.0 + - io.github.monun:invfx:3.1.0 + - io.github.monun:kommand:2.12.0 From 44debb3c9a81c0bbbe515374803757b3482d858a Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 22:38:03 +0900 Subject: [PATCH 11/23] update plugin.yml --- psychics-core/src/main/resources/plugin.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 87da252a..50ab629d 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -5,5 +5,5 @@ version: $version author: Monun libraries: - io.github.monun:tap-core:4.6.0 - - io.github.monun:invfx:3.1.0 - - io.github.monun:kommand:2.12.0 + - io.github.monun:invfx-core:3.1.0 + - io.github.monun:kommand-core:2.12.0 From 84134372c7609ff8cd49217216871795d5121a7f Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 23:31:47 +0900 Subject: [PATCH 12/23] fix plugin.yml --- psychics-core/src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 50ab629d..863f7401 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -5,5 +5,5 @@ version: $version author: Monun libraries: - io.github.monun:tap-core:4.6.0 - - io.github.monun:invfx-core:3.1.0 + - io.github.monun:invfx:3.1.0 - io.github.monun:kommand-core:2.12.0 From d30d0f45bfd2d1b8a268a2ab608e731c078a3bd4 Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 29 Jul 2022 23:33:56 +0900 Subject: [PATCH 13/23] auto generate abilities.zip --- psychics-abilities/build.gradle.kts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/psychics-abilities/build.gradle.kts b/psychics-abilities/build.gradle.kts index 84acff18..305d706b 100644 --- a/psychics-abilities/build.gradle.kts +++ b/psychics-abilities/build.gradle.kts @@ -49,8 +49,19 @@ subprojects { } gradle.buildFinished { - val libs = File(buildDir, "libs") + val libs = subprojects + .map { File(it.buildDir, "libs") } + .filter { it.exists() } + .mapNotNull { it.listFiles()!!.singleOrNull() } - if (libs.exists()) - zipTo(File(buildDir, "abilities.zip"), libs) + val abilitiesDir = File(buildDir,"abilities") + + abilitiesDir.mkdir() + + libs.forEach { + val newFile = File(abilitiesDir,it.name) + it.copyTo(newFile,true) + } + + zipTo(File(buildDir, "abilities.zip"), abilitiesDir) } \ No newline at end of file From cdda65b35e3ebffb5d9f05a470d5b4d86cf2387f Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Thu, 4 Aug 2022 09:55:50 +0900 Subject: [PATCH 14/23] support Paper 1.19.1 --- build.gradle.kts | 4 ++-- psychics-core/build.gradle.kts | 2 +- psychics-core/src/main/resources/plugin.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9d526034..11304d0f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,11 +22,11 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19.1-R0.1-SNAPSHOT") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.6.0") + implementation("io.github.monun:tap-api:4.6.2") } } diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index 83864dad..b4f8e314 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } dependencies { - implementation("io.github.monun:kommand-api:2.12.0") + implementation("io.github.monun:kommand-api:2.13.0") implementation("io.github.monun:invfx-api:3.1.0") } diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 863f7401..61f6832f 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -4,6 +4,6 @@ api-version: '1.19' version: $version author: Monun libraries: - - io.github.monun:tap-core:4.6.0 + - io.github.monun:tap-core:4.6.2 - io.github.monun:invfx:3.1.0 - - io.github.monun:kommand-core:2.12.0 + - io.github.monun:kommand-core:2.13.0 From c7afaeddfbf6814d65127ae2e96265395dcf8e69 Mon Sep 17 00:00:00 2001 From: muqhc Date: Sun, 7 Aug 2022 21:28:23 +0900 Subject: [PATCH 15/23] cleanup abilities.zip process code --- psychics-abilities/build.gradle.kts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/psychics-abilities/build.gradle.kts b/psychics-abilities/build.gradle.kts index 305d706b..72775ef0 100644 --- a/psychics-abilities/build.gradle.kts +++ b/psychics-abilities/build.gradle.kts @@ -49,19 +49,17 @@ subprojects { } gradle.buildFinished { - val libs = subprojects - .map { File(it.buildDir, "libs") } - .filter { it.exists() } - .mapNotNull { it.listFiles()!!.singleOrNull() } - val abilitiesDir = File(buildDir,"abilities") - abilitiesDir.mkdir() - libs.forEach { - val newFile = File(abilitiesDir,it.name) - it.copyTo(newFile,true) - } + subprojects + .map { File(it.buildDir, "libs") } + .filter { it.exists() } + .mapNotNull { it.listFiles()!!.singleOrNull() } + .forEach { + val newFile = File(abilitiesDir,it.name) + it.copyTo(newFile,true) + } zipTo(File(buildDir, "abilities.zip"), abilitiesDir) } \ No newline at end of file From f46dd5fa628213619011780a8e9209a023676273 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Mon, 20 Feb 2023 07:29:13 +0000 Subject: [PATCH 16/23] make dependcies and tool version up-to-date --- README.md | 4 ++-- build.gradle.kts | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- psychics-core/build.gradle.kts | 6 +++--- psychics-core/src/main/resources/plugin.yml | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 68293304..b0af5175 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Psychics (paper 기반의 능력자 플러그인) [![Kotlin](https://img.shields.io/badge/java-17-ED8B00.svg?logo=java)](https://www.azul.com/) -[![Kotlin](https://img.shields.io/badge/kotlin-1.7.10-585DEF.svg?logo=kotlin)](http://kotlinlang.org) -[![Gradle](https://img.shields.io/badge/gradle-7.4-02303A.svg?logo=gradle)](https://gradle.org) +[![Kotlin](https://img.shields.io/badge/kotlin-1.7.21-585DEF.svg?logo=kotlin)](http://kotlinlang.org) +[![Gradle](https://img.shields.io/badge/gradle-7.6-02303A.svg?logo=gradle)](https://gradle.org) [![GitHub](https://img.shields.io/github/license/monun/psychics)](https://www.gnu.org/licenses/gpl-3.0.html) [![Kotlin](https://img.shields.io/badge/youtube-각별-red.svg?logo=youtube)](https://www.youtube.com/channel/UCDrAR1OWC2MD4s0JLetN0MA) diff --git a/build.gradle.kts b/build.gradle.kts index 11304d0f..5d368071 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.7.10" + kotlin("jvm") version "1.7.21" } java { @@ -22,11 +22,11 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.19.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.6.2") + implementation("io.github.monun:tap-api:4.9.1") } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb879..070cb702 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index b4f8e314..6c5965bc 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -1,10 +1,10 @@ plugins { - id("org.jetbrains.dokka") version "1.7.10" + id("org.jetbrains.dokka") version "1.7.20" } dependencies { - implementation("io.github.monun:kommand-api:2.13.0") - implementation("io.github.monun:invfx-api:3.1.0") + implementation("io.github.monun:kommand-api:3.1.2") + implementation("io.github.monun:invfx-api:3.3.0") } tasks { diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 61f6832f..c304fc5d 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -4,6 +4,6 @@ api-version: '1.19' version: $version author: Monun libraries: - - io.github.monun:tap-core:4.6.2 - - io.github.monun:invfx:3.1.0 - - io.github.monun:kommand-core:2.13.0 + - io.github.monun:tap-core:4.9.1 + - io.github.monun:invfx-core:3.3.0 + - io.github.monun:kommand-core:3.1.2 From 90a96c021a83eec1f6550bca2c7564db34e6576b Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Thu, 13 Apr 2023 19:40:09 +0900 Subject: [PATCH 17/23] support paper 1.19.4 --- build.gradle.kts | 4 ++-- psychics-core/build.gradle.kts | 2 +- psychics-core/src/main/resources/plugin.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5d368071..90e89318 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,11 +22,11 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.9.1") + implementation("io.github.monun:tap-api:4.9.4") } } diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index 6c5965bc..5cb39206 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } dependencies { - implementation("io.github.monun:kommand-api:3.1.2") + implementation("io.github.monun:kommand-api:3.1.3") implementation("io.github.monun:invfx-api:3.3.0") } diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index c304fc5d..438af49d 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -4,6 +4,6 @@ api-version: '1.19' version: $version author: Monun libraries: - - io.github.monun:tap-core:4.9.1 + - io.github.monun:tap-core:4.9.4 - io.github.monun:invfx-core:3.3.0 - - io.github.monun:kommand-core:3.1.2 + - io.github.monun:kommand-core:3.1.3 From 2c5513e8af03f5284702f4d0518f1c89f48eca9f Mon Sep 17 00:00:00 2001 From: muqhc Date: Fri, 5 May 2023 00:04:53 +0900 Subject: [PATCH 18/23] fix bugs - fix permission require caused by kommand-api version up - fix abilities.zip generating --- psychics-abilities/build.gradle.kts | 10 +++++++--- .../github/monun/psychics/command/KommandPsychics.kt | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/psychics-abilities/build.gradle.kts b/psychics-abilities/build.gradle.kts index 72775ef0..d80b4224 100644 --- a/psychics-abilities/build.gradle.kts +++ b/psychics-abilities/build.gradle.kts @@ -49,13 +49,17 @@ subprojects { } gradle.buildFinished { + if (!buildDir.exists()) buildDir.mkdir() + val abilitiesDir = File(buildDir,"abilities") abilitiesDir.mkdir() subprojects - .map { File(it.buildDir, "libs") } - .filter { it.exists() } - .mapNotNull { it.listFiles()!!.singleOrNull() } + .map { File(it.buildDir, "libs") to it } + .filter { (it,_) -> it.exists() } + .mapNotNull { (it,project) -> it.listFiles()!!.find { + it.nameWithoutExtension == "${project.group}.${project.name.removePrefix("ability-")}" + } } .forEach { val newFile = File(abilitiesDir,it.name) it.copyTo(newFile,true) diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/command/KommandPsychics.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/command/KommandPsychics.kt index 6b636270..88f1b1e9 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/command/KommandPsychics.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/command/KommandPsychics.kt @@ -43,7 +43,9 @@ internal object KommandPsychics { this.manager = manager kommand.register("psychics", "psy") { - permission("psychics.commands") + requires { + hasPermission("psychics.commands") + } val psychicConceptArgument = dynamic { _, input -> manager.getPsychicConcept(input) From 925a7197dc222113a325fe876e4f19e678e4491e Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:28:29 +0900 Subject: [PATCH 19/23] 1.20.1 Paper 1.19.4 -> 1.20.1 Tap 4.9.4 -> 4.9.6 Kommand 3.1.3 -> 3.1.6 --- build.gradle.kts | 4 ++-- psychics-core/build.gradle.kts | 2 +- psychics-core/src/main/resources/plugin.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 90e89318..b066c889 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,11 +22,11 @@ subprojects { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.9.4") + implementation("io.github.monun:tap-api:4.9.6") } } diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index 5cb39206..fe6ce35d 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } dependencies { - implementation("io.github.monun:kommand-api:3.1.3") + implementation("io.github.monun:kommand-api:3.1.6") implementation("io.github.monun:invfx-api:3.3.0") } diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index 438af49d..bc2bd1f7 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -1,9 +1,9 @@ name: Psychics main: io.github.monun.psychics.plugin.PsychicsPlugin -api-version: '1.19' +api-version: '1.20' version: $version author: Monun libraries: - - io.github.monun:tap-core:4.9.4 + - io.github.monun:tap-core:4.9.6 - io.github.monun:invfx-core:3.3.0 - - io.github.monun:kommand-core:3.1.3 + - io.github.monun:kommand-core:3.1.6 From 50cf69a0fd4f5e0e728c25125c502c8a3f8a2c97 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Sat, 2 Sep 2023 09:06:31 +0900 Subject: [PATCH 20/23] update dependencies tap 4.9.6 -> 4.9.8 kommand 3.1.6 -> 3.1.7 invfx 3.3.0 -> 3.3.2 --- build.gradle.kts | 2 +- psychics-core/build.gradle.kts | 4 ++-- psychics-core/src/main/resources/plugin.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b066c889..0f7de69f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,6 +27,6 @@ subprojects { implementation(kotlin("stdlib")) implementation(kotlin("reflect")) - implementation("io.github.monun:tap-api:4.9.6") + implementation("io.github.monun:tap-api:4.9.8") } } diff --git a/psychics-core/build.gradle.kts b/psychics-core/build.gradle.kts index fe6ce35d..530e5dae 100644 --- a/psychics-core/build.gradle.kts +++ b/psychics-core/build.gradle.kts @@ -3,8 +3,8 @@ plugins { } dependencies { - implementation("io.github.monun:kommand-api:3.1.6") - implementation("io.github.monun:invfx-api:3.3.0") + implementation("io.github.monun:kommand-api:3.1.7") + implementation("io.github.monun:invfx-api:3.3.2") } tasks { diff --git a/psychics-core/src/main/resources/plugin.yml b/psychics-core/src/main/resources/plugin.yml index bc2bd1f7..a911c731 100644 --- a/psychics-core/src/main/resources/plugin.yml +++ b/psychics-core/src/main/resources/plugin.yml @@ -4,6 +4,6 @@ api-version: '1.20' version: $version author: Monun libraries: - - io.github.monun:tap-core:4.9.6 - - io.github.monun:invfx-core:3.3.0 - - io.github.monun:kommand-core:3.1.6 + - io.github.monun:tap-core:4.9.8 + - io.github.monun:invfx-core:3.3.2 + - io.github.monun:kommand-core:3.1.7 From 945d7874a1e427b346b7be39dac47fb7bc867d0a Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Mon, 19 Feb 2024 13:22:30 +0900 Subject: [PATCH 21/23] support firework effect --- README.md | 2 +- .../ability/berserker/AbilityBerserker.kt | 3 +- .../magicarchery/AbilityMagicArchery.kt | 3 +- .../psychics/ability/sample/AbilitySample.kt | 9 +++-- .../monun/psychics/effect/FireworkSupport.kt | 40 +++++++++++++++++++ .../monun/psychics/plugin/EventListener.kt | 16 ++++++++ 6 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt diff --git a/README.md b/README.md index b0af5175..40dd4a15 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,4 @@ --- ## TODO -* [ ] Show Firework without Tap Effect Util \ No newline at end of file +* [x] Show Firework without Tap Effect Util \ No newline at end of file diff --git a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt index 1ecccffc..2c4d31a1 100644 --- a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt +++ b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt @@ -2,6 +2,7 @@ package io.github.monun.psychics.ability.berserker import io.github.monun.psychics.AbilityConcept import io.github.monun.psychics.ActiveAbility +import io.github.monun.psychics.effect.spawnFirework import io.github.monun.tap.config.Config import io.github.monun.tap.config.Name //import io.github.monun.tap.effect.playFirework @@ -64,7 +65,7 @@ class AbilityBerserker : ActiveAbility(), Listener { val location = player.location.apply { y += 2.0 } val world = location.world val firework = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.RED).withFlicker().build() - //world.playFirework(location, firework) //TODO: Show Firework without Tap Effect Util + world.spawnFirework(location, firework, psychics.plugin) } @EventHandler(ignoreCancelled = true) diff --git a/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt b/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt index 98ae3017..cd94a44a 100644 --- a/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt +++ b/psychics-abilities/ability-magic-archery/src/main/kotlin/io/github/monun/psychics/ability/magicarchery/AbilityMagicArchery.kt @@ -7,6 +7,7 @@ import io.github.monun.psychics.attribute.EsperAttribute import io.github.monun.psychics.damage.Damage import io.github.monun.psychics.damage.DamageType import io.github.monun.psychics.damage.psychicDamage +import io.github.monun.psychics.effect.spawnFirework import io.github.monun.psychics.util.TargetFilter import io.github.monun.tap.config.Name //import io.github.monun.tap.effect.playFirework @@ -132,7 +133,7 @@ class AbilityMagicArchery : Ability(), Listener { val box = target.boundingBox val effect = FireworkEffect.builder().with(FireworkEffect.Type.BURST) .withColor(if (force == 1.0F) Color.RED else Color.ORANGE).build() - //world.playFirework(box.centerX, box.maxY + 0.5, box.centerZ, effect) //TODO: Show Firework without Tap Effect Util + world.spawnFirework(box.centerX, box.maxY + 0.5, box.centerZ, effect, psychic.plugin) } } diff --git a/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt b/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt index ec6a974b..d170a4ba 100644 --- a/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt +++ b/psychics-abilities/ability-sample/src/main/kotlin/io/github/monun/psychics/ability/sample/AbilitySample.kt @@ -6,6 +6,7 @@ import io.github.monun.psychics.Channel import io.github.monun.psychics.attribute.EsperAttribute import io.github.monun.psychics.damage.Damage import io.github.monun.psychics.damage.DamageType +import io.github.monun.psychics.effect.spawnFirework import io.github.monun.psychics.util.hostileFilter import io.github.monun.tap.config.Name //import io.github.monun.tap.effect.playFirework @@ -35,10 +36,6 @@ class AbilityConceptSample : AbilityConcept() { class AbilitySample : ActiveAbility(), Listener { companion object { private val effect = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.RED).build() - - private fun LivingEntity.playPsychicEffect() { - //orld.playFirework(location, effect) //TODO: Show Firework without Tap Effect Util - } } override fun onInitialize() { @@ -85,4 +82,8 @@ class AbilitySample : ActiveAbility(), Listener { target.psychicDamage() target.playPsychicEffect() } + + private fun LivingEntity.playPsychicEffect() { + world.spawnFirework(location, effect, psychic.plugin) + } } \ No newline at end of file diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt new file mode 100644 index 00000000..4319c879 --- /dev/null +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt @@ -0,0 +1,40 @@ +package io.github.monun.psychics.effect + +import org.bukkit.FireworkEffect +import org.bukkit.Location +import org.bukkit.World +import org.bukkit.plugin.Plugin +import org.bukkit.entity.Firework +import org.bukkit.inventory.meta.FireworkMeta + +fun World.spawnFirework( + x: Double, y: Double, z: Double, + world: World, effect: FireworkEffect, plugin: Plugin + hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 +): Firework { + val location = Location(world, x, y, z) + val firework: Firework = location.world.spawn(location, Firework::class.java) + val fireworkMeta: FireworkMeta = firework.fireworkMeta + fireworkMeta.addEffect(effect) + fireworkMeta.power = power + firework.fireworkMeta = fireworkMeta + firework.ticksToDetonate = ticksToDetonate + if (!hasDamage) { + firework.disableDamage(plugin) + } + return firework +} +fun World.spawnFirework( + loc: Location, + effect: FireworkEffect, plugin: Plugin + hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 +) = + spawnFirework(loc.x, loc.y, loc.z, loc.world, effect, hasDamage, power, ticksToDetonate) + +val NO_DAMAGE_FIREWORK_FLAG = "NoDamageFirework" + +fun Firework.disableDamage(plugin: Plugin) { + setMetadata(NO_DAMAGE_FIREWORK_FLAG, new FixedMetadataValue(plugin, true)) +} + + diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt index 97a0a76c..56563268 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt @@ -20,6 +20,7 @@ package io.github.monun.psychics.plugin import com.destroystokyo.paper.event.inventory.PrepareResultEvent import com.destroystokyo.paper.event.player.PlayerPostRespawnEvent import io.github.monun.psychics.* +import io.github.monun.psychics.effect.NO_DAMAGE_FIREWORK_FLAG import io.github.monun.psychics.item.enchantability import io.github.monun.psychics.item.isPsychicbound import io.github.monun.psychics.item.psionicsLevel @@ -198,6 +199,21 @@ class EventListener( } } + + @EventHandler + fun onEntityDamageByEntity(event: EntityDamageByEntityEvent) { + val damager = event.damager + val cause = event.cause + if ( + damager is Firework && + cause == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION && + damager.hasMetadata(NO_DAMAGE_FIREWORK_FLAG) + ) { + event.isCancelled = true + } + } + + private val Player.esper: Esper get() = requireNotNull(psychicManager.getEsper(this)) } From d430161aab2479ef8d4d9b5533a5978b90312d74 Mon Sep 17 00:00:00 2001 From: muqhc <88622655+muqhc@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:09:43 +0900 Subject: [PATCH 22/23] fix syntax error FireworkSupport.kt --- .../kotlin/io/github/monun/psychics/effect/FireworkSupport.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt index 4319c879..29016275 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt @@ -9,7 +9,7 @@ import org.bukkit.inventory.meta.FireworkMeta fun World.spawnFirework( x: Double, y: Double, z: Double, - world: World, effect: FireworkEffect, plugin: Plugin + world: World, effect: FireworkEffect, plugin: Plugin, hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 ): Firework { val location = Location(world, x, y, z) @@ -26,7 +26,7 @@ fun World.spawnFirework( } fun World.spawnFirework( loc: Location, - effect: FireworkEffect, plugin: Plugin + effect: FireworkEffect, plugin: Plugin, hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 ) = spawnFirework(loc.x, loc.y, loc.z, loc.world, effect, hasDamage, power, ticksToDetonate) From 03c933ac834de3923b376a051f0ce5a4ee7642cc Mon Sep 17 00:00:00 2001 From: muqhc Date: Mon, 19 Feb 2024 16:16:08 +0900 Subject: [PATCH 23/23] fix reference error --- .../psychics/ability/berserker/AbilityBerserker.kt | 2 +- .../ability/stormbreaker/AbilityStormBreaker.kt | 3 +-- .../io/github/monun/psychics/effect/FireworkSupport.kt | 10 +++++----- .../io/github/monun/psychics/plugin/EventListener.kt | 3 +++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt index 2c4d31a1..04f00abc 100644 --- a/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt +++ b/psychics-abilities/ability-berserker/src/main/kotlin/io/github/monun/psychics/ability/berserker/AbilityBerserker.kt @@ -65,7 +65,7 @@ class AbilityBerserker : ActiveAbility(), Listener { val location = player.location.apply { y += 2.0 } val world = location.world val firework = FireworkEffect.builder().with(FireworkEffect.Type.BURST).withColor(Color.RED).withFlicker().build() - world.spawnFirework(location, firework, psychics.plugin) + world.spawnFirework(location, firework, psychic.plugin) } @EventHandler(ignoreCancelled = true) diff --git a/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt b/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt index 03d57753..313c25ee 100644 --- a/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt +++ b/psychics-abilities/ability-storm-breaker/src/main/kotlin/io/github/monun/psychics/ability/stormbreaker/AbilityStormBreaker.kt @@ -14,7 +14,6 @@ import io.github.monun.tap.config.Name import io.github.monun.tap.fake.FakeEntity import io.github.monun.tap.fake.Movement import io.github.monun.tap.fake.Trail -import io.github.monun.tap.fake.invisible import io.github.monun.tap.math.normalizeAndLength import io.github.monun.tap.math.toRadians import io.github.monun.tap.trail.TrailSupport @@ -209,7 +208,7 @@ class AbilityStormBreaker : Ability() { updateMetadata { isMarker = true - invisible = true + isVisible = false } updateEquipment { helmet = item.clone() diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt index 29016275..63f02d00 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/effect/FireworkSupport.kt @@ -6,13 +6,13 @@ import org.bukkit.World import org.bukkit.plugin.Plugin import org.bukkit.entity.Firework import org.bukkit.inventory.meta.FireworkMeta +import org.bukkit.metadata.FixedMetadataValue fun World.spawnFirework( - x: Double, y: Double, z: Double, - world: World, effect: FireworkEffect, plugin: Plugin, + x: Double, y: Double, z: Double, effect: FireworkEffect, plugin: Plugin, hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 ): Firework { - val location = Location(world, x, y, z) + val location = Location(this, x, y, z) val firework: Firework = location.world.spawn(location, Firework::class.java) val fireworkMeta: FireworkMeta = firework.fireworkMeta fireworkMeta.addEffect(effect) @@ -29,12 +29,12 @@ fun World.spawnFirework( effect: FireworkEffect, plugin: Plugin, hasDamage: Boolean = false, power: Int = 0, ticksToDetonate: Int = 0 ) = - spawnFirework(loc.x, loc.y, loc.z, loc.world, effect, hasDamage, power, ticksToDetonate) + spawnFirework(loc.x, loc.y, loc.z, effect, plugin, hasDamage, power, ticksToDetonate) val NO_DAMAGE_FIREWORK_FLAG = "NoDamageFirework" fun Firework.disableDamage(plugin: Plugin) { - setMetadata(NO_DAMAGE_FIREWORK_FLAG, new FixedMetadataValue(plugin, true)) + setMetadata(NO_DAMAGE_FIREWORK_FLAG, FixedMetadataValue(plugin, true)) } diff --git a/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt b/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt index 56563268..0988e758 100644 --- a/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt +++ b/psychics-core/src/main/kotlin/io/github/monun/psychics/plugin/EventListener.kt @@ -28,11 +28,14 @@ import io.github.monun.psychics.item.removeAllPsychicbounds import io.github.monun.tap.fake.FakeEntityServer import org.bukkit.GameMode import org.bukkit.Material +import org.bukkit.entity.Firework import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.block.Action import org.bukkit.event.enchantment.EnchantItemEvent +import org.bukkit.event.entity.EntityDamageByEntityEvent +import org.bukkit.event.entity.EntityDamageEvent import org.bukkit.event.entity.EntityRegainHealthEvent import org.bukkit.event.entity.ItemSpawnEvent import org.bukkit.event.inventory.InventoryClickEvent