From bda4f8cfe59b15f8eb662f588a15c380032aad4c Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Wed, 4 Jun 2014 02:38:39 +0200 Subject: [PATCH] Fixed Walkie Talkies --- .../java/mekanism/client/ClientConnectionHandler.java | 10 ++++++---- .../java/mekanism/common/voice/VoiceConnection.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/mekanism/client/ClientConnectionHandler.java b/src/main/java/mekanism/client/ClientConnectionHandler.java index 91eacc650..c79c50e2a 100644 --- a/src/main/java/mekanism/client/ClientConnectionHandler.java +++ b/src/main/java/mekanism/client/ClientConnectionHandler.java @@ -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 } } } diff --git a/src/main/java/mekanism/common/voice/VoiceConnection.java b/src/main/java/mekanism/common/voice/VoiceConnection.java index 6f1a741f2..4e16f9d0a 100644 --- a/src/main/java/mekanism/common/voice/VoiceConnection.java +++ b/src/main/java/mekanism/common/voice/VoiceConnection.java @@ -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();