Skip to content

Commit

Permalink
Fix portal create (#64)
Browse files Browse the repository at this point in the history
* fix toml dependencies

* #60 fix portal create event
  • Loading branch information
makeevrserg committed Aug 9, 2024
1 parent 397f490 commit b1f7b91
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ makeevrserg.java.ktarget=21
# Project
makeevrserg.project.name=AspeKt
makeevrserg.project.group=ru.astrainteractive.aspekt
makeevrserg.project.version.string=2.22.0
makeevrserg.project.version.string=2.22.1
makeevrserg.project.description=Essentials plugin for EmpireProjekt
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected]
makeevrserg.project.url=https://empireprojekt.ru
Expand Down
7 changes: 7 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ minecraft-vault = "1.7.1" # https://github.com/MilkBowl/VaultAPI
minecraft-astralibs = "3.12.0" # https://github.com/Astra-Interactive/AstraLibs
minecraft-bstats = "3.0.2" # https://github.com/Bastian/bStats
minecraft-mockbukkit = "3.96.1" #https://github.com/MockBukkit/MockBukkit
minecraft-luckperms = "5.4" # https://github.com/LuckPerms/LuckPerms
minecraft-essentialsx = "2.20.1" # https://github.com/EssentialsX/Essentials
minecraft-towny = "0.100.3.11" # https://github.com/TownyAdvanced/Towny

# Shadow
gradle-shadow = "8.0.0" # https://github.com/johnrengelman/shadow
Expand Down Expand Up @@ -84,6 +87,10 @@ minecraft-mockbukkit = { module = "com.github.MockBukkit:MockBukkit", version.re

minecraft-discordsrv = { module = "com.discordsrv:discordsrv", version.ref = "discordsrv" }

minecraft-luckperms = { module = "net.luckperms:api", version.ref = "minecraft-luckperms" }
minecraft-essentialsx = { module = "net.essentialsx:EssentialsX", version.ref = "minecraft-essentialsx" }
minecraft-towny = { module = "com.palmergames.bukkit.towny:towny", version.ref = "minecraft-towny" }

# klibs
klibs-mikro-core = { module = "ru.astrainteractive.klibs:mikro-core", version.ref = "klibs-mikro" }
klibs-kdi = { module = "ru.astrainteractive.klibs:kdi", version.ref = "klibs-kdi" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package ru.astrainteractive.aspekt.module.adminprivate.event

import io.papermc.paper.event.player.PlayerItemFrameChangeEvent
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.block.BlockState
import org.bukkit.entity.ArmorStand
import org.bukkit.entity.Enemy
import org.bukkit.entity.Monster
Expand All @@ -24,6 +26,7 @@ import org.bukkit.event.hanging.HangingBreakByEntityEvent
import org.bukkit.event.player.PlayerArmorStandManipulateEvent
import org.bukkit.event.player.PlayerBucketEmptyEvent
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.world.PortalCreateEvent
import ru.astrainteractive.aspekt.module.adminprivate.debounce.EventDebounce
import ru.astrainteractive.aspekt.module.adminprivate.debounce.RetractKey
import ru.astrainteractive.aspekt.module.adminprivate.event.di.AdminPrivateDependencies
Expand All @@ -46,8 +49,9 @@ internal class AdminPrivateEvent(
flag: ChunkFlag
) where T : Event, T : Cancellable {
if (!adminPrivateController.isEnabled) return

if (player?.toPermissible()?.hasPermission(PluginPermission.AdminClaim) == true) return
if (e.isCancelled) return

debounce.debounceEvent(retractKey, e) {
val isAble = adminPrivateController.isAble(adminChunk, flag)
val isCancelled = !isAble
Expand Down Expand Up @@ -241,4 +245,22 @@ internal class AdminPrivateEvent(
flag = ChunkFlag.HOSTILE_MOB_SPAWN
)
}
val portalCreateEvent = DSLEvent<PortalCreateEvent>(eventListener, plugin) { e ->
val chunks = e.blocks
.map(BlockState::getLocation)
.distinctBy(Location::getChunk)
.map(Location::getChunk)
chunks.forEach { chunk ->
handleDefault(
retractKey = RetractKey.Vararg(
chunks,
"portalCreateEvent"
),
e = e,
adminChunk = chunk.adminChunk,
player = null,
flag = ChunkFlag.PLACE
)
}
}
}
4 changes: 2 additions & 2 deletions modules/discordlink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dependencies {
implementation(libs.minecraft.astralibs.core.bukkit)
implementation(libs.minecraft.vaultapi)
// Spigot
compileOnly("net.luckperms:api:5.4")
compileOnly(libs.minecraft.discordsrv)
compileOnly("net.essentialsx:EssentialsX:2.20.1")
compileOnly(libs.minecraft.luckperms)
compileOnly(libs.minecraft.essentialsx)
// Test
testImplementation(libs.bundles.testing.kotlin)
testImplementation(libs.tests.kotlin.test)
Expand Down
2 changes: 1 addition & 1 deletion modules/moneydrop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {
implementation(libs.minecraft.astralibs.core.bukkit)
implementation(libs.minecraft.vaultapi)
// Spigot
compileOnly("net.essentialsx:EssentialsX:2.20.1")
compileOnly(libs.minecraft.essentialsx)
// Test
testImplementation(libs.bundles.testing.kotlin)
testImplementation(libs.tests.kotlin.test)
Expand Down
6 changes: 3 additions & 3 deletions modules/towny-discord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ dependencies {
implementation(libs.minecraft.astralibs.core.bukkit)
implementation(libs.minecraft.vaultapi)
// Spigot
compileOnly("net.luckperms:api:5.4")
compileOnly(libs.minecraft.luckperms)
compileOnly(libs.minecraft.discordsrv)
compileOnly("net.essentialsx:EssentialsX:2.20.1")
compileOnly("com.palmergames.bukkit.towny:towny:0.100.3.11")
compileOnly(libs.minecraft.essentialsx)
compileOnly(libs.minecraft.towny)
// Test
testImplementation(libs.bundles.testing.kotlin)
testImplementation(libs.tests.kotlin.test)
Expand Down
4 changes: 2 additions & 2 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ dependencies {
implementation(libs.minecraft.astralibs.core.bukkit)
implementation(libs.minecraft.vaultapi)
// Spigot
compileOnly("net.luckperms:api:5.4")
compileOnly(libs.minecraft.luckperms)
compileOnly(libs.minecraft.discordsrv)
compileOnly("net.essentialsx:EssentialsX:2.20.1")
compileOnly(libs.minecraft.essentialsx)
// Test
testImplementation(libs.bundles.testing.kotlin)
testImplementation(libs.tests.kotlin.test)
Expand Down

0 comments on commit b1f7b91

Please sign in to comment.