Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.Random;
  4. import java.awt.Desktop;
  5. import java.io.IOException;
  6. import java.net.URI;
  7. import java.net.URISyntaxException;
  8.  
  9. @Override
  10. public void onGameLink(GameLinkEvent gameLinkEvent) {
  11. LOGGER.info("The game can be viewed at: {}", gameLinkEvent.getUrl());
  12. String url = gameLinkEvent.getUrl();
  13. if(Desktop.isDesktopSupported()){
  14. Desktop desktop = Desktop.getDesktop();
  15. try {
  16. desktop.browse(new URI(url));
  17. } catch (IOException | URISyntaxException e) {
  18. // TODO Auto-generated catch block
  19. e.printStackTrace();
  20. }
  21. }else{
  22. Runtime runtime = Runtime.getRuntime();
  23. try {
  24. runtime.exec("xdg-open " + url);
  25. } catch (IOException e) {
  26. // TODO Auto-generated catch block
  27. e.printStackTrace();
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement