Search in sources :

Example 81 with JsonHolder

use of cc.hyperium.utils.JsonHolder 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

JsonHolder (cc.hyperium.utils.JsonHolder)81 DisplayLine (cc.hyperium.handlers.handlers.stats.display.DisplayLine)42 StatsDisplayItem (cc.hyperium.handlers.handlers.stats.display.StatsDisplayItem)42 ArrayList (java.util.ArrayList)34 NettyClient (cc.hyperium.netty.NettyClient)13 DisplayTable (cc.hyperium.handlers.handlers.stats.display.DisplayTable)10 JsonArray (com.google.gson.JsonArray)9 JsonElement (com.google.gson.JsonElement)8 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)5 JsonObject (com.google.gson.JsonObject)5 URL (java.net.URL)5 UUID (java.util.UUID)5 HashMap (java.util.HashMap)4 InvokeEvent (cc.hyperium.event.InvokeEvent)3 PurchaseLoadEvent (cc.hyperium.event.network.PurchaseLoadEvent)3 AbstractAnimationHandler (cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler)3 DisplayItem (cc.hyperium.mods.chromahud.api.DisplayItem)3 IOException (java.io.IOException)3 ExecutionException (java.util.concurrent.ExecutionException)3 GuiButton (net.minecraft.client.gui.GuiButton)3