Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Random;
- import java.awt.Desktop;
- import java.io.IOException;
- import java.net.URI;
- import java.net.URISyntaxException;
- @Override
- public void onGameLink(GameLinkEvent gameLinkEvent) {
- LOGGER.info("The game can be viewed at: {}", gameLinkEvent.getUrl());
- String url = gameLinkEvent.getUrl();
- if(Desktop.isDesktopSupported()){
- Desktop desktop = Desktop.getDesktop();
- try {
- desktop.browse(new URI(url));
- } catch (IOException | URISyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }else{
- Runtime runtime = Runtime.getRuntime();
- try {
- runtime.exec("xdg-open " + url);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement