Don't launch VoiceClient unless VoiceServerEnabled is set to true

This commit is contained in:
Aidan C. Brady 2013-10-28 07:16:22 -04:00
parent 2fb13e1f3d
commit d8a4ecb986

View file

@ -32,28 +32,37 @@ public class ClientConnectionHandler implements IConnectionHandler
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
try {
voiceClient = new VoiceClient(server, 36123);
voiceClient.run();
} catch(Exception e) {}
if(Mekanism.voiceServerEnabled)
{
try {
voiceClient = new VoiceClient(server, 36123);
voiceClient.run();
} catch(Exception e) {}
}
}
@Override
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
{
try {
voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress(), 36123);
voiceClient.run();
} catch(Exception e) {}
if(Mekanism.voiceServerEnabled)
{
try {
voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress(), 36123);
voiceClient.run();
} catch(Exception e) {}
}
}
@Override
public void connectionClosed(INetworkManager manager)
{
if(voiceClient != null)
if(Mekanism.voiceServerEnabled)
{
voiceClient.disconnect();
voiceClient = null;
if(voiceClient != null)
{
voiceClient.disconnect();
voiceClient = null;
}
}
Mekanism.proxy.unloadSoundHandler();