Skip to content

Commit

Permalink
fix: the plugin now sends an update message to velocity after 20 tick…
Browse files Browse the repository at this point in the history
…s to make sure velocity receive the vanish update message
  • Loading branch information
Syrent committed Apr 27, 2024
1 parent 2a5bd1d commit 069f0e4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ class VanishManager(

if (preVanishEvent.isCancelled) return

plugin.bridgeManager?.updateVanishedPlayersRequest(player, true)
// Because plugin messaging is the most reliable thing in the world i have to send the vanish update after 20 ticks to make sure the message is received on the Velocity side
Ruom.runSync({
plugin.bridgeManager?.updateVanishedPlayersRequest(player, true)
}, 20)
setMeta(player, true)

updateTabState(player, GameMode.SPECTATOR)
Expand Down Expand Up @@ -261,7 +266,6 @@ class VanishManager(

Utils.sendVanishActionbar(player)
plugin.vanishedNames.add(player.name)
plugin.bridgeManager?.updateVanishedPlayersRequest(player, true)

val quitMessage = Utils.getSerializedMessage(Settings.formatMessage(player, Message.QUIT_MESSAGE, player, TextReplacement("player", player.name), TextReplacement("play_displayname", player.displayName)))
if (quitMessage.isNotBlank() && quitMessage.isNotEmpty() && sendQuitMessage && Settings.fakeJoinLeaveMessage) {
Expand Down Expand Up @@ -290,6 +294,7 @@ class VanishManager(
VelocityVanishSpigot.instance.server.pluginManager.callEvent(preUnVanishEvent)

if (preUnVanishEvent.isCancelled) return
plugin.bridgeManager?.updateVanishedPlayersRequest(player, false)

setMeta(player, false)

Expand Down Expand Up @@ -367,7 +372,6 @@ class VanishManager(

Utils.sendVanishActionbar(player)
plugin.vanishedNames.remove(player.name)
plugin.bridgeManager?.updateVanishedPlayersRequest(player, false)

val joinMessage = Utils.getSerializedMessage(Settings.formatMessage(player, Message.JOIN_MESSAGE, player, TextReplacement("player_displayname", player.displayName), TextReplacement("player", player.name)))
if (joinMessage.isNotBlank() && joinMessage.isNotEmpty() && sendJoinMessage && Settings.fakeJoinLeaveMessage) {
Expand Down

0 comments on commit 069f0e4

Please sign in to comment.