Skip to content

Commit

Permalink
Merge pull request #14
Browse files Browse the repository at this point in the history
Add ProCosmetics support
  • Loading branch information
Syrent authored Oct 31, 2022
2 parents bf95670 + cc9bc48 commit 659e182
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=3.1.0
version=3.2.0
plugin-name=VelocityVanish
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ object DependencyManager {

var protocolLibHook: ProtocolLibHook
private set
var proCosmeticsHook: ProCosmeticsHook
private set

init {
ProtocolLibHook("ProtocolLib").apply {
Expand All @@ -20,6 +22,10 @@ object DependencyManager {
this.register()
}
}
ProCosmeticsHook("ProCosmetics").apply {
this.register()
proCosmeticsHook = this
}
}

}
Original file line number Diff line number Diff line change
@@ -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<String> {
return mutableListOf(
"Unequip player cosmetics when player is vanished",
"Equip player cosmetics when player is unvanished"
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}
3 changes: 3 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ description: Vanish plugin for velocity servers
website: syrent.ir
softdepend:
- 'ProtocolLib'
- 'ProCosmetics'
- 'SayanChat'
- 'VelocityReport'
commands:
vanish:
aliases:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/velocity-plugin.json
Original file line number Diff line number Diff line change
@@ -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"}
{"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"}

0 comments on commit 659e182

Please sign in to comment.