Fixed Walkie Talkies
This commit is contained in:
parent
f0d3848f8a
commit
bda4f8cfe5
2 changed files with 7 additions and 5 deletions
src/main/java/mekanism
|
@ -1,6 +1,6 @@
|
||||||
package mekanism.client;
|
package mekanism.client;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
import mekanism.client.voice.VoiceClient;
|
import mekanism.client.voice.VoiceClient;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
@ -19,21 +19,23 @@ public class ClientConnectionHandler
|
||||||
{
|
{
|
||||||
if(event.isLocal)
|
if(event.isLocal)
|
||||||
{
|
{
|
||||||
|
//If the client is connecting to its own corresponding integrated server.
|
||||||
try {
|
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) {
|
} catch(Exception e) {
|
||||||
Mekanism.logger.error("Unable to establish VoiceClient on local connection.");
|
Mekanism.logger.error("Unable to establish VoiceClient on local connection.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//If the client is connecting to a foreign integrated or dedicated server.
|
||||||
try {
|
try {
|
||||||
MekanismClient.voiceClient = new VoiceClient(event.manager.getSocketAddress().toString());
|
MekanismClient.voiceClient = new VoiceClient(((InetSocketAddress)event.manager.getSocketAddress()).getHostString());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
Mekanism.logger.error("Unable to establish VoiceClient on remote connection.");
|
Mekanism.logger.error("Unable to establish VoiceClient on remote connection.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//TODO this is probably wrong
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class VoiceConnection extends Thread
|
||||||
EntityPlayerMP playerMP = (EntityPlayerMP)obj;
|
EntityPlayerMP playerMP = (EntityPlayerMP)obj;
|
||||||
String playerIP = playerMP.getPlayerIP();
|
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;
|
Mekanism.voiceManager.foundLocal = true;
|
||||||
username = playerMP.getCommandSenderName();
|
username = playerMP.getCommandSenderName();
|
||||||
|
|
Loading…
Add table
Reference in a new issue