Skip to content

Commit

Permalink
v2.0.8
Browse files Browse the repository at this point in the history
v2.0.8
  • Loading branch information
Apehum committed Jan 13, 2024
2 parents 2f42a93 + 2c93513 commit 330e401
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 14 deletions.
1 change: 1 addition & 0 deletions client/1.20.3-1.20.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
net.minecraft.network.chat.contents.PlainTextContents$LiteralContents net.minecraft.network.chat.contents.LiteralContents
Empty file added client/1.20.3-fabric/.gitkeep
Empty file.
3 changes: 2 additions & 1 deletion client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ val universalCraft by configurations.creating {

fun uStatsVersion() = rootProject.libs.versions.ustats.map {
val minecraftVersion = when (platform.mcVersion) {
12001, 12002 -> "1.20"
12001, 12002, 12003 -> "1.20"
else -> platform.mcVersionStr
}

Expand All @@ -76,6 +76,7 @@ dependencies {
11904 -> "0.76.0+1.19.4"
12001 -> "0.84.0+1.20.1"
12002 -> "0.89.1+1.20.2"
12003 -> "0.91.1+1.20.3"
else -> throw GradleException("Unsupported platform $platform")
}

Expand Down
7 changes: 1 addition & 6 deletions client/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
- Fixed server bug when player can't hear/speak to others players after respawn
- Fixed crash on Mac OS versions lower than 11
- Fixed crash on source buffer overflow
- Fixed crash when opus was trying to decode bad frames
- guice is now bundled with JIJ in forge to fix compatibility with other mods
- Fixed crash with EssentialAddons using "reloadFakePlayers"
- 1.20.3 and 1.20.4 support
4 changes: 4 additions & 0 deletions client/root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ group = "$mavenGroup.client-root"

preprocess {

val fabric12003 = createNode("1.20.3-fabric", 12003, "official")

// val forge12002 = createNode("1.20.2-forge", 12002, "official")
val fabric12002 = createNode("1.20.2-fabric", 12002, "official")
val forge12001 = createNode("1.20.1-forge", 12001, "official")
Expand All @@ -19,6 +21,8 @@ preprocess {
val forge11902 = createNode("1.19.2-forge", 11902, "official")
val fabric11902 = createNode("1.19.2-fabric", 11902, "official")

fabric12003.link(fabric12002)

fabric12002.link(fabric12001, file("1.20.2-1.20.1.txt"))
// forge12002.link(fabric12002)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
import net.minecraft.client.Minecraft;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.contents.LiteralContents;
import net.minecraft.network.chat.contents.TranslatableContents;
import org.jetbrains.annotations.NotNull;
import su.plo.lib.api.chat.MinecraftTextComponent;
import su.plo.voice.api.client.config.keybind.KeyBinding;

//#if MC>=12003
//$$ import net.minecraft.network.chat.contents.PlainTextContents;
//#else
import net.minecraft.network.chat.contents.LiteralContents;
//#endif

@UtilityClass
public class LanguageUtil {

Expand Down Expand Up @@ -48,7 +53,11 @@ public static String getSelectedLanguage() {
Component displayName = inputKey.getDisplayName();
if (displayName.getContents() instanceof TranslatableContents translatable) {
return MinecraftTextComponent.translatable(translatable.getKey(), translatable.getArgs());
//#if MC>=12003
//$$ } else if (displayName.getContents() instanceof PlainTextContents.LiteralContents literal) {
//#else
} else if (displayName.getContents() instanceof LiteralContents literal) {
//#endif
return MinecraftTextComponent.translatable(literal.text());
} else {
return MinecraftTextComponent.translatable("gui.none");
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Version
targetJavaVersion=8
mavenGroup=su.plo.voice
buildVersion=2.0.7
buildVersion=2.0.8

# Gradle args
org.gradle.jvmargs=-Xmx2048M
Expand Down
6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
junit5 = "5.8.2"
crowdin = "1.0.1"
ustats = "1.0.2"
universalcraft = "312"
universalcraft = "320"
bstats = "3.0.2"

supervanish = "6.2.18-3"

[libraries]
lombok = { module = "org.projectlombok:lombok", version = "1.18.24" }
annotations = { module = "org.jetbrains:annotations", version = "23.0.0" }
Expand All @@ -30,6 +32,8 @@ kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-j

crowdin-lib = { module = "su.plo.crowdin:lib", version.ref = "crowdin" }

supervanish = { module = "com.github.LeonMangler:SuperVanish", version.ref = "supervanish" }

[plugins]
architectury-plugin = { id = "architectury-plugin", version = "3.4-SNAPSHOT" }
architectury-loom = { id = "dev.architectury.loom", version = "0.12.0-SNAPSHOT" }
Expand Down
10 changes: 10 additions & 0 deletions proxy/bungee/src/main/kotlin/su/plo/lib/bungee/BungeeProxyLib.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import net.md_5.bungee.api.config.ServerInfo
import net.md_5.bungee.api.connection.ProxiedPlayer
import net.md_5.bungee.api.event.PlayerDisconnectEvent
import net.md_5.bungee.api.event.PostLoginEvent
import net.md_5.bungee.api.event.ServerSwitchEvent
import net.md_5.bungee.api.plugin.Listener
import net.md_5.bungee.api.plugin.Plugin
import net.md_5.bungee.event.EventHandler
Expand All @@ -19,6 +20,7 @@ import su.plo.lib.bungee.command.BungeeCommandManager
import su.plo.lib.bungee.player.BungeeProxyPlayer
import su.plo.lib.bungee.server.BungeeProxyServerInfo
import su.plo.voice.api.server.config.ServerLanguages
import su.plo.voice.proxy.event.player.McProxyServerConnectedEvent
import su.plo.voice.server.player.PermissionSupplier
import java.util.*
import java.util.concurrent.ConcurrentHashMap
Expand Down Expand Up @@ -132,4 +134,12 @@ class BungeeProxyLib(
)
playerById.remove(event.player.uniqueId)
}

@EventHandler
fun onServerSwitch(event: ServerSwitchEvent) {
val player = getPlayerByInstance(event.player)
val previousServer = event.from?.let { getServerInfoByServerInstance(it) }

McProxyServerConnectedEvent.invoker.onServerConnected(player, previousServer)
}
}
3 changes: 1 addition & 2 deletions proxy/changelog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- Fixed error when player was disconnected from the voice server if someone with the same name is trying to join the server
- Fixed error when player was not cleared properly on disconnect and on the next join voice will not work for that player
- Fixed a bug where an AES key was not reset properly after a backend restart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import su.plo.voice.api.proxy.server.RemoteServer;
import su.plo.voice.api.proxy.server.RemoteServerManager;
import su.plo.voice.proxy.BaseVoiceProxy;
import su.plo.voice.proxy.event.player.McProxyServerConnectedEvent;
import su.plo.voice.proxy.util.AddressUtil;

import java.net.InetSocketAddress;
Expand All @@ -36,6 +37,11 @@ public VoiceRemoteServerManager(@NotNull BaseVoiceProxy voiceProxy) {

voiceProxy.getMinecraftServer().getServers().forEach(this::resetServerAesState);
});

McProxyServerConnectedEvent.INSTANCE.registerListener((player, previousServer) -> {
if (previousServer == null) return;
resetServerAesState(previousServer);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package su.plo.voice.proxy.event.player

import su.plo.lib.api.event.MinecraftGlobalEvent
import su.plo.lib.api.proxy.player.MinecraftProxyPlayer
import su.plo.lib.api.proxy.server.MinecraftProxyServerInfo
import su.plo.voice.proxy.event.player.McProxyServerConnectedEvent.Callback


/**
* An event fired after the player was successfully connected to the server.
*/
object McProxyServerConnectedEvent
: MinecraftGlobalEvent<Callback>(
{ callbacks ->
Callback { player, previousServer ->
callbacks.forEach { callback -> callback.onServerConnected(player, previousServer) }
}
}
) {
fun interface Callback {

fun onServerConnected(player: MinecraftProxyPlayer, previousServer: MinecraftProxyServerInfo?)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.connection.PostLoginEvent;
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.server.RegisteredServer;
Expand All @@ -23,6 +24,7 @@
import su.plo.lib.velocity.server.VelocityProxyServerInfo;
import su.plo.voice.api.event.EventBus;
import su.plo.voice.api.server.config.ServerLanguages;
import su.plo.voice.proxy.event.player.McProxyServerConnectedEvent;
import su.plo.voice.server.player.PermissionSupplier;

import java.util.Collection;
Expand Down Expand Up @@ -170,4 +172,16 @@ public void onPlayerQuit(@NotNull DisconnectEvent event) {
);
playerById.remove(event.getPlayer().getUniqueId());
}

@Subscribe
public void onServerPostConnect(@NotNull ServerPostConnectEvent event) {
MinecraftProxyPlayer player = getPlayerByInstance(event.getPlayer());

MinecraftProxyServerInfo previousServer = null;
if (event.getPreviousServer() != null) {
previousServer = getServerInfoByServerInstance(event.getPreviousServer());
}

McProxyServerConnectedEvent.INSTANCE.getInvoker().onServerConnected(player, previousServer);
}
}
3 changes: 1 addition & 2 deletions server/changelog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- Fix vanish support [#358](https://github.com/plasmoapp/plasmo-voice/issues/358)
- Fix memory leak when unloading worlds
- [Paper] SuperVanish/PremiumVanish integration with show and hide events
2 changes: 2 additions & 0 deletions server/paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies {

compileOnly(project(":server:common"))

compileOnly(libs.supervanish)

// shadow projects
listOf(
project(":api:common"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import su.plo.ustats.UStats
import su.plo.ustats.paper.PaperUStatsPlatform
import su.plo.voice.paper.connection.PaperServerChannelHandler
import su.plo.voice.paper.connection.PaperServerServiceChannelHandler
import su.plo.voice.paper.integration.SuperVanishIntegration
import su.plo.voice.paper.integration.VoicePlaceholder
import su.plo.voice.server.BaseVoiceServer
import su.plo.voice.server.player.PermissionSupplier
Expand Down Expand Up @@ -67,6 +68,13 @@ class PaperVoiceServer(
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
VoicePlaceholder(this).register()
}

if (Bukkit.getPluginManager().getPlugin("SuperVanish") != null ||
Bukkit.getPluginManager().getPlugin("PremiumVanish") != null
) {
plugin.server.pluginManager.registerEvents(SuperVanishIntegration(this), plugin)
LOGGER.info("SuperVanish event listener attached")
}
}

public override fun onShutdown() {
Expand Down
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)
}
}
2 changes: 2 additions & 0 deletions server/paper/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ authors: [ Apehum ]
softdepend:
- LuckPerms
- PlaceholderAPI
- SuperVanish
- PremiumVanish
#depend:
# - kotlin-stdlib

Expand Down

0 comments on commit 330e401

Please sign in to comment.