mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
39 lines
1.0 KiB
Java
39 lines
1.0 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package minetweaker.mc18.network;
|
|
|
|
import java.awt.Desktop;
|
|
import java.io.IOException;
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
|
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
|
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
|
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
|
|
|
/**
|
|
*
|
|
* @author Stan
|
|
*/
|
|
public class MineTweakerOpenBrowserHandler implements IMessageHandler<MineTweakerOpenBrowserPacket, IMessage> {
|
|
@Override
|
|
public IMessage onMessage(MineTweakerOpenBrowserPacket message, MessageContext ctx) {
|
|
if (Desktop.isDesktopSupported()) {
|
|
Desktop desktop = Desktop.getDesktop();
|
|
try {
|
|
desktop.browse(new URI(message.getUrl()));
|
|
} catch (IOException e) {
|
|
} catch (URISyntaxException e) {
|
|
}
|
|
} else {
|
|
System.out.println("Desktop not supported");
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|