-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(paper): SuperVanish show and hide events integration
- Loading branch information
Showing
5 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
server/paper/src/main/kotlin/su/plo/voice/paper/integration/SuperVanishIntegration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package su.plo.voice.paper.integration | ||
|
||
import de.myzelyam.api.vanish.PlayerHideEvent | ||
import de.myzelyam.api.vanish.PostPlayerShowEvent | ||
import org.bukkit.event.EventHandler | ||
import org.bukkit.event.Listener | ||
import su.plo.voice.api.server.PlasmoVoiceServer | ||
|
||
class SuperVanishIntegration( | ||
private val voiceServer: PlasmoVoiceServer | ||
) : Listener { | ||
|
||
@EventHandler | ||
fun onPlayerHide(event: PlayerHideEvent) { | ||
val player = voiceServer.playerManager.wrap(event.player) | ||
if (!player.hasVoiceChat()) return | ||
|
||
voiceServer.tcpConnectionManager.broadcastPlayerDisconnect(player) | ||
} | ||
|
||
@EventHandler | ||
fun onPlayerShow(event: PostPlayerShowEvent) { | ||
val player = voiceServer.playerManager.wrap(event.player) | ||
if (!player.hasVoiceChat()) return | ||
|
||
voiceServer.tcpConnectionManager.broadcastPlayerInfoUpdate(player) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters