diff --git a/build.gradle b/build.gradle index 2a972601..4761564e 100644 --- a/build.gradle +++ b/build.gradle @@ -62,6 +62,7 @@ dependencies { compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0' compileOnly files("libs/SayanChat-2.8.3.jar") + compileOnly files('libs/ProCosmetics-13.7.jar') implementation 'io.papermc:paperlib:1.0.7' implementation 'org.bstats:bstats-bukkit:3.0.0' diff --git a/gradle.properties b/gradle.properties index 47d48368..43dce450 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=3.1.0 +version=3.2.0 plugin-name=VelocityVanish \ No newline at end of file diff --git a/src/main/java/ir/syrent/velocityvanish/spigot/hook/DependencyManager.kt b/src/main/java/ir/syrent/velocityvanish/spigot/hook/DependencyManager.kt index a414b00a..4a332255 100644 --- a/src/main/java/ir/syrent/velocityvanish/spigot/hook/DependencyManager.kt +++ b/src/main/java/ir/syrent/velocityvanish/spigot/hook/DependencyManager.kt @@ -6,6 +6,8 @@ object DependencyManager { var protocolLibHook: ProtocolLibHook private set + var proCosmeticsHook: ProCosmeticsHook + private set init { ProtocolLibHook("ProtocolLib").apply { @@ -20,6 +22,10 @@ object DependencyManager { this.register() } } + ProCosmeticsHook("ProCosmetics").apply { + this.register() + proCosmeticsHook = this + } } } \ No newline at end of file diff --git a/src/main/java/ir/syrent/velocityvanish/spigot/hook/ProCosmeticsHook.kt b/src/main/java/ir/syrent/velocityvanish/spigot/hook/ProCosmeticsHook.kt new file mode 100644 index 00000000..ae2b77db --- /dev/null +++ b/src/main/java/ir/syrent/velocityvanish/spigot/hook/ProCosmeticsHook.kt @@ -0,0 +1,24 @@ +package ir.syrent.velocityvanish.spigot.hook + +import se.file14.procosmetics.ProCosmetics +import se.file14.procosmetics.api.ProCosmeticsProvider + +class ProCosmeticsHook constructor(name: String) : Dependency(name) { + + lateinit var proCosmetics: ProCosmetics + private set + + init { + if (exists) { + proCosmetics = ProCosmeticsProvider.get() + } + } + + override fun features(): List { + return mutableListOf( + "Unequip player cosmetics when player is vanished", + "Equip player cosmetics when player is unvanished" + ) + } + +} \ No newline at end of file diff --git a/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostUnVanishListener.kt b/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostUnVanishListener.kt index 5dac5043..bab27366 100644 --- a/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostUnVanishListener.kt +++ b/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostUnVanishListener.kt @@ -2,6 +2,7 @@ package ir.syrent.velocityvanish.spigot.listener import ir.syrent.velocityvanish.spigot.VelocityVanishSpigot import ir.syrent.velocityvanish.spigot.event.PostUnVanishEvent +import ir.syrent.velocityvanish.spigot.hook.DependencyManager import ir.syrent.velocityvanish.spigot.ruom.Ruom import ir.syrent.velocityvanish.spigot.storage.Message import ir.syrent.velocityvanish.spigot.storage.Settings @@ -30,5 +31,9 @@ class PostUnVanishListener( if (joinMessage.isNotBlank() && joinMessage.isNotEmpty() && event.sendJoinMessage) { Ruom.broadcast(joinMessage.component()) } + + if (DependencyManager.proCosmeticsHook.exists) { + DependencyManager.proCosmeticsHook.proCosmetics.userManager.getUser(player.uniqueId).equipLastCosmetics(true) + } } } \ No newline at end of file diff --git a/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostVanishListener.kt b/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostVanishListener.kt index 63d12715..bd34163d 100644 --- a/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostVanishListener.kt +++ b/src/main/java/ir/syrent/velocityvanish/spigot/listener/PostVanishListener.kt @@ -2,6 +2,7 @@ package ir.syrent.velocityvanish.spigot.listener import ir.syrent.velocityvanish.spigot.VelocityVanishSpigot import ir.syrent.velocityvanish.spigot.event.PostVanishEvent +import ir.syrent.velocityvanish.spigot.hook.DependencyManager import ir.syrent.velocityvanish.spigot.ruom.Ruom import ir.syrent.velocityvanish.spigot.storage.Message import ir.syrent.velocityvanish.spigot.storage.Settings @@ -30,5 +31,9 @@ class PostVanishListener( if (quitMessage.isNotBlank() && quitMessage.isNotEmpty() && event.sendQuitMessage) { Ruom.broadcast(quitMessage.component()) } + + if (DependencyManager.proCosmeticsHook.exists) { + DependencyManager.proCosmeticsHook.proCosmetics.userManager.getUser(player.uniqueId).unequipCosmetics(true) + } } } \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 24acf5d7..1c36714f 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -8,6 +8,9 @@ description: Vanish plugin for velocity servers website: syrent.ir softdepend: - 'ProtocolLib' + - 'ProCosmetics' + - 'SayanChat' + - 'VelocityReport' commands: vanish: aliases: diff --git a/src/main/resources/velocity-plugin.json b/src/main/resources/velocity-plugin.json index 32463252..ea12cf8f 100644 --- a/src/main/resources/velocity-plugin.json +++ b/src/main/resources/velocity-plugin.json @@ -1 +1 @@ -{"id":"velocityvanish","name":"VelocityVanish","version":"3.1.0","description":"Vanish plugin for velocity servers","url":"syrent.ir","authors":["Syrent"],"dependencies":[],"main":"ir.syrent.velocityvanish.velocity.VelocityVanish"} \ No newline at end of file +{"id":"velocityvanish","name":"VelocityVanish","version":"3.2.0","description":"Vanish plugin for velocity servers","url":"syrent.ir","authors":["Syrent"],"dependencies":[],"main":"ir.syrent.velocityvanish.velocity.VelocityVanish"} \ No newline at end of file