Files
CraftTweaker/src/main/java/minetweaker/mc1710/network/MineTweakerOpenBrowserHandler.java
T
Glease 38c46d61d9 migrate to new buildscript
Class Registries are merged together into one. All subprojects are also merged into one. It's probably possible to split stuff into multiple source sets and not merging the registries, but I'm just too lazy for that.
2022-03-05 03:02:05 +08:00

38 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.mc1710.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.mc1710.MineTweakerConfig;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
*
* @author Stan
*/
public class MineTweakerOpenBrowserHandler implements IMessageHandler<MineTweakerOpenBrowserPacket, IMessage> {
@Override
public IMessage onMessage(MineTweakerOpenBrowserPacket message, MessageContext ctx) {
if (Desktop.isDesktopSupported() && MineTweakerConfig.handleDesktopPackets) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(message.getUrl()));
} catch (IOException e) {
} catch (URISyntaxException e) {
}
}
return null;
}
}