mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Support copying url to clipboard when hosting
This commit is contained in:
@@ -65,6 +65,7 @@ public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
|
||||
if (CHomeUI.SINGLETON_INSTANCE.getCurrentDocID() == EDocID.HOME_NETWORK) {
|
||||
VSubmenuOnlineLobby.SINGLETON_INSTANCE.populate();
|
||||
}
|
||||
NetConnectUtil.copyHostedServerUrl();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,6 +60,14 @@ public class OnlineLobbyScreen extends LobbyScreen implements IOnlineLobby {
|
||||
result = NetConnectUtil.host(OnlineLobbyScreen.this, chatInterface);
|
||||
}
|
||||
chatInterface.addMessage(result);
|
||||
if (!joinServer) {
|
||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NetConnectUtil.copyHostedServerUrl();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +97,14 @@ public class NetConnectUtil {
|
||||
|
||||
view.update(true);
|
||||
|
||||
return String.format("Hosting on port %d", port);
|
||||
return String.format("Hosting on port %d.", port);
|
||||
}
|
||||
|
||||
public static void copyHostedServerUrl() {
|
||||
String hostname = "localhost";
|
||||
String url = hostname + ":" + ForgeProfileProperties.getServerPort();
|
||||
GuiBase.getInterface().copyToClipboard(url);
|
||||
SOptionPane.showMessageDialog("Share the following URL with anyone who wishes to join your server. It has been copied to your clipboard for convenience.\n\n" + url, "Server URL", SOptionPane.INFORMATION_ICON);
|
||||
}
|
||||
|
||||
public static String join(final String url, final IOnlineLobby onlineLobby, final IOnlineChatInterface chatInterface) {
|
||||
|
||||
Reference in New Issue
Block a user