Fixed Walkie Talkies

This commit is contained in:
Aidan C. Brady 2014-06-04 02:38:39 +02:00
parent f0d3848f8a
commit bda4f8cfe5
2 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,6 @@
package mekanism.client;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import mekanism.client.voice.VoiceClient;
import mekanism.common.Mekanism;
@ -19,21 +19,23 @@ public class ClientConnectionHandler
{
if(event.isLocal)
{
//If the client is connecting to its own corresponding integrated server.
try {
MekanismClient.voiceClient = new VoiceClient(InetAddress.getLocalHost().getHostAddress());
MekanismClient.voiceClient = new VoiceClient("127.0.0.1");
//Will probably not work when multiple integrateds are running on one computer
} catch(Exception e) {
Mekanism.logger.error("Unable to establish VoiceClient on local connection.");
e.printStackTrace();
}
}
else {
//If the client is connecting to a foreign integrated or dedicated server.
try {
MekanismClient.voiceClient = new VoiceClient(event.manager.getSocketAddress().toString());
MekanismClient.voiceClient = new VoiceClient(((InetSocketAddress)event.manager.getSocketAddress()).getHostString());
} catch(Exception e) {
Mekanism.logger.error("Unable to establish VoiceClient on remote connection.");
e.printStackTrace();
}
//TODO this is probably wrong
}
}
}

View file

@ -57,7 +57,7 @@ public class VoiceConnection extends Thread
EntityPlayerMP playerMP = (EntityPlayerMP)obj;
String playerIP = playerMP.getPlayerIP();
if(!server.isDedicatedServer() && playerIP.equals("127.0.0.1") && !Mekanism.voiceManager.foundLocal)
if(!server.isDedicatedServer() && playerIP.equals("local") && !Mekanism.voiceManager.foundLocal)
{
Mekanism.voiceManager.foundLocal = true;
username = playerMP.getCommandSenderName();