Search in sources :

Example 16 with NettyClient

use of cc.hyperium.netty.NettyClient in project Hyperium by HyperiumClient.

the class CapesGui method pack.

@Override
protected void pack() {
    reg("RESET", new GuiButton(nextId(), 1, 1, "Disable Hyperium Cape"), guiButton -> {
        NettyClient client = NettyClient.getClient();
        if (client != null) {
            client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("set_cape", true).put("value", "default")));
        }
        HyperiumPurchase self = PurchaseApi.getInstance().getSelf();
        if (self == null) {
            GeneralChatHandler.instance().sendMessage("Unable to reset your cape: Your profile is not loaded");
            return;
        }
        JsonHolder purchaseSettings = self.getPurchaseSettings();
        if (!purchaseSettings.has("cape")) {
            purchaseSettings.put("cape", new JsonHolder());
        }
        purchaseSettings.optJSONObject("cape").put("type", "default");
        Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("You may need to switch worlds to update your cape.");
    }, guiButton -> {
    });
    reg("CUSTOM", new GuiButton(nextId(), 1, 22, "Custom Cape"), guiButton -> {
        Desktop desktop = Desktop.getDesktop();
        if (desktop != null) {
            try {
                desktop.browse(new URL("https://capes.hyperium.cc").toURI());
            } catch (IOException | URISyntaxException e) {
                e.printStackTrace();
            }
        }
    }, guiButton -> {
    });
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) NettyClient(cc.hyperium.netty.NettyClient) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) GuiButton(net.minecraft.client.gui.GuiButton) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URL(java.net.URL)

Aggregations

NettyClient (cc.hyperium.netty.NettyClient)16 JsonHolder (cc.hyperium.utils.JsonHolder)13 AbstractAnimationHandler (cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler)3 EventBus (cc.hyperium.event.EventBus)2 InvokeEvent (cc.hyperium.event.InvokeEvent)2 Multithreading (cc.hyperium.mods.sk1ercommon.Multithreading)2 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)2 PurchaseApi (cc.hyperium.purchases.PurchaseApi)2 IOException (java.io.IOException)2 UUID (java.util.UUID)2 GuiYesNo (net.minecraft.client.gui.GuiYesNo)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 Hyperium (cc.hyperium.Hyperium)1 InternalAddons (cc.hyperium.addons.InternalAddons)1 HyperiumCommandHandler (cc.hyperium.commands.HyperiumCommandHandler)1 cc.hyperium.commands.defaults (cc.hyperium.commands.defaults)1 DefaultConfig (cc.hyperium.config.DefaultConfig)1 Settings (cc.hyperium.config.Settings)1 HyperiumCosmetics (cc.hyperium.cosmetics.HyperiumCosmetics)1 Priority (cc.hyperium.event.Priority)1