![]() |
|
#7
|
||||
|
||||
|
Hi Pfeil,
I tried both, and it seems I can't find any difference in either output. ![]() I haven't tried running the server from a Windows machine and it's quite possible that this is the culprit. However, I would still want to solve the issue as it's my main platform for running the server personally. Server interaction: Code:
public class Command {
@Inject
Connection connection;
@Inject
public void sendCommand(String line) {
connection.getOutput().println(line);
connection.getOutput().flush();
if (connection.getOutput().checkError()) {
System.out.println("Not sent.");
}
}
public void loadMission(String mission) {
sendCommand("mission LOAD " + mission);
}
public void endMission() {
sendCommand("mission DESTROY");
}
public void askMission() {
sendCommand("mission");
}
}
Code:
public void connect() {
try {
socket = new Socket(Config.getIpAddress(), Integer.decode(Config.getPort()));
output = new PrintWriter(socket.getOutputStream(), true);
input = new BufferedReader(new InputStreamReader(socket.getInputStream(), Charset.forName("UTF-8")));
setConnected(true);
if (socket.isConnected()) {
System.out.println("Connected to server " + Config.getIpAddress() + " on port " + Config.getPort());
}
} catch (IOException e) {
setConnected(false);
System.out.println("Failed to connect to socket.");
e.printStackTrace();
}
}
Code:
public void serverPathButtonAction() {
String serverPath;
File file = serverChooser.showOpenDialog(new Stage());
if (file != null) {
serverPath = file.toString();
Config.setServerPath(serverPath);
serverPathLabel.setText(serverPath);
missionPathButton.setDisable(false);
} else {
serverPathLabel.setText("<no server .exe selected>");
missionPathButton.setDisable(true);
}
}
public void missionPathButtonAction() {
String missionPath;
File file = missionChooser.showOpenDialog(new Stage());
if (file != null) {
missionPath = file.toString();
Config.setMissionPath(missionPath);
missionPathLabel.setText(missionPath);
} else {
missionPathLabel.setText("<no .mis file selected>");
}
}
Code:
public String resolveMissionPath() {
Path serverPath;
Path missionPath;
Path missionsRoot;
Path missionLoadPath;
String missionLoadString;
serverPath = Paths.get(Config.getServerPath());
missionPath = Paths.get(Config.getMissionPath());
missionsRoot = serverPath.getParent().resolve("Missions");
missionLoadPath = missionsRoot.relativize(missionPath).normalize();
missionLoadString = missionLoadPath.toString().replace("\\", "/");
return missionLoadString;
}
Code:
public void startStopButtonAction() {
if (Mission.getMissionRunning()) {
command.endMission();
command.askMission();
} else {
if (Config.getRemoteMode()) {
command.loadMission(Config.getRemotePath());
} else {
command.loadMission(mainConfigPresenter.resolveMissionPath());
}
}
}
Just tried using all of these with no luck. |
|
|