Don't launch VoiceClient unless VoiceServerEnabled is set to true
This commit is contained in:
parent
2fb13e1f3d
commit
d8a4ecb986
1 changed files with 20 additions and 11 deletions
|
@ -31,30 +31,39 @@ public class ClientConnectionHandler implements IConnectionHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||||
|
{
|
||||||
|
if(Mekanism.voiceServerEnabled)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
voiceClient = new VoiceClient(server, 36123);
|
voiceClient = new VoiceClient(server, 36123);
|
||||||
voiceClient.run();
|
voiceClient.run();
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||||
|
{
|
||||||
|
if(Mekanism.voiceServerEnabled)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress(), 36123);
|
voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress(), 36123);
|
||||||
voiceClient.run();
|
voiceClient.run();
|
||||||
} catch(Exception e) {}
|
} catch(Exception e) {}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionClosed(INetworkManager manager)
|
public void connectionClosed(INetworkManager manager)
|
||||||
|
{
|
||||||
|
if(Mekanism.voiceServerEnabled)
|
||||||
{
|
{
|
||||||
if(voiceClient != null)
|
if(voiceClient != null)
|
||||||
{
|
{
|
||||||
voiceClient.disconnect();
|
voiceClient.disconnect();
|
||||||
voiceClient = null;
|
voiceClient = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Mekanism.proxy.unloadSoundHandler();
|
Mekanism.proxy.unloadSoundHandler();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue