Skip to content

Commit

Permalink
Merge pull request #359 from adabugra/feature/pl3xmap-support
Browse files Browse the repository at this point in the history
Feature: Add Pl3xMap Support
  • Loading branch information
Syrent authored Jan 2, 2025
2 parents ac4b5b4 + 17fc372 commit 344dc84
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ allprojects {
name = "scarsz"
url = uri("https://nexus.scarsz.me/content/groups/public/")
}

maven {
name = "modrinth-repo"
url = uri("https://api.modrinth.com/maven/")
}
}

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ placeholderapi = "2.11.6"
essentialsx = "2.20.1"
citizens-api = "2.0.28-SNAPSHOT"
squaremap-api = "1.2.3"
pl3xmap-api = "1.21.4-512"

# proxy
# proxy - velocity
Expand All @@ -37,6 +38,7 @@ placeholderapi = { group = "me.clip", name="placeholderapi", version.ref="placeh
essentialsx = { group = "net.essentialsx", name="EssentialsX", version.ref="essentialsx" }
citizens-api = { group = "net.citizensnpcs", name="citizensapi", version.ref="citizens-api" }
squaremap-api = { group = "xyz.jpenilla", name="squaremap-api", version.ref="squaremap-api" }
pl3xmap-api = { group = "maven.modrinth", name="pl3xmap", version.ref="pl3xmap-api" }

# proxy
# proxy - velocity
Expand Down
1 change: 1 addition & 0 deletions sayanvanish-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
compileOnly(libs.essentialsx)
compileOnly(libs.citizens.api)
compileOnly(libs.squaremap.api)
compileOnly(libs.pl3xmap.api)

// compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
// paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.sayandev.sayanvanish.bukkit.feature.features.hook

import net.pl3x.map.core.Pl3xMap
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.sayandev.sayanvanish.api.feature.RegisteredFeature
import org.sayandev.sayanvanish.bukkit.api.event.BukkitUserUnVanishEvent
import org.sayandev.sayanvanish.bukkit.api.event.BukkitUserVanishEvent
import org.sayandev.sayanvanish.bukkit.feature.HookFeature
import org.sayandev.stickynote.bukkit.registerListener
import org.spongepowered.configurate.objectmapping.ConfigSerializable

@RegisteredFeature
@ConfigSerializable
class FeatureHookPl3xMap: HookFeature("hook_pl3xmap", "Pl3xMap") {

override fun enable() {
if (hasPlugin()) {
Pl3xMapHookImpl(this)
}
super.enable()
}
}

private class Pl3xMapHookImpl(val feature: FeatureHookPl3xMap): Listener {

init {
registerListener(this)
}

@EventHandler
private fun onVanish(event: BukkitUserVanishEvent) {
val user = event.user
if (!feature.isActive(user)) return
user.player()?.uniqueId?.let { Pl3xMap.api().playerRegistry.get(it)?.setHidden(true, false) }
}

@EventHandler
private fun onUnVanish(event: BukkitUserUnVanishEvent) {
val user = event.user
if (!feature.isActive(user)) return
user.player()?.uniqueId?.let { Pl3xMap.api().playerRegistry.get(it)?.setHidden(false, false) }
}
}

0 comments on commit 344dc84

Please sign in to comment.