mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Forge constant for close command message
This commit is contained in:
@@ -11,6 +11,7 @@ import forge.net.IOnlineLobby;
|
||||
import forge.net.NetConnectUtil;
|
||||
import forge.net.OfflineLobby;
|
||||
import forge.net.client.FGameClient;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.screens.LoadingOverlay;
|
||||
import forge.screens.constructed.LobbyScreen;
|
||||
import forge.screens.online.OnlineMenu.OnlineScreen;
|
||||
@@ -96,7 +97,7 @@ public class OnlineLobbyScreen extends LobbyScreen implements IOnlineLobby {
|
||||
final IOnlineChatInterface chatInterface = (IOnlineChatInterface)OnlineScreen.Chat.getScreen();
|
||||
if (joinServer) {
|
||||
result = NetConnectUtil.join(url, OnlineLobbyScreen.this, chatInterface);
|
||||
if (result.getMessage() == "<<_EM_ESOLC_<<") { //this message is returned via netconnectutil on exception
|
||||
if (result.getMessage() == ForgeConstants.CLOSE_CONN_COMMAND) { //this message is returned via netconnectutil on exception
|
||||
closeConn("Invalid host address (" + url + ") was detected.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.net;
|
||||
|
||||
import forge.match.LobbySlotType;
|
||||
import forge.properties.ForgeConstants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.GuiBase;
|
||||
@@ -179,7 +180,7 @@ public class NetConnectUtil {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
//return a message to close the connection so we will not crash...
|
||||
return new ChatMessage(null, "<<_EM_ESOLC_<<");
|
||||
return new ChatMessage(null, ForgeConstants.CLOSE_CONN_COMMAND);
|
||||
}
|
||||
|
||||
return new ChatMessage(null, String.format("Connected to %s:%d", hostname, port));
|
||||
|
||||
@@ -237,6 +237,7 @@ public final class ForgeConstants {
|
||||
public static final String QUEST_PREFS_FILE = USER_PREFS_DIR + "quest.preferences";
|
||||
public static final String CONQUEST_PREFS_FILE = USER_PREFS_DIR + "conquest.preferences";
|
||||
public static final String ITEM_VIEW_PREFS_FILE = USER_PREFS_DIR + "item_view.preferences";
|
||||
public static final String CLOSE_CONN_COMMAND = "<<_EM_ESOLC_<<";
|
||||
|
||||
// data that has defaults in the program dir but overrides/additions in the user dir
|
||||
private static final String _DEFAULTS_DIR = RES_DIR + "defaults" + PATH_SEPARATOR;
|
||||
|
||||
Reference in New Issue
Block a user