use of cc.hyperium.mods.levelhead.util.LevelheadJsonHolder in project Hyperium by HyperiumClient.
the class DisplayManager method save.
public void save() {
LevelheadJsonHolder jsonHolder = new LevelheadJsonHolder();
jsonHolder.put("master", new LevelheadJsonHolder(GSON.toJson(config)));
if (tab != null)
jsonHolder.put("tab", new LevelheadJsonHolder(GSON.toJson(tab.getConfig())));
if (chat != null)
jsonHolder.put("chat", new LevelheadJsonHolder(GSON.toJson(chat.getConfig())));
JsonArray head = new JsonArray();
aboveHead.stream().map(aboveHeadDisplay -> new LevelheadJsonHolder(GSON.toJson(aboveHeadDisplay.getConfig())).getObject()).forEach(head::add);
jsonHolder.put("head", head);
try {
FileUtils.writeStringToFile(file, jsonHolder.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
use of cc.hyperium.mods.levelhead.util.LevelheadJsonHolder in project Hyperium by HyperiumClient.
the class LevelheadDisplay method getFooterConfig.
public LevelheadJsonHolder getFooterConfig() {
LevelheadJsonHolder holder = new LevelheadJsonHolder();
holder.put("chroma", config.isFooterChroma());
holder.put("rgb", config.isFooterRgb());
holder.put("red", config.getFooterRed());
holder.put("green", config.getFooterGreen());
holder.put("blue", config.getFooterBlue());
holder.put("alpha", config.getFooterAlpha());
holder.put("color", config.getFooterColor());
return holder;
}
use of cc.hyperium.mods.levelhead.util.LevelheadJsonHolder in project Hyperium by HyperiumClient.
the class CustomLevelheadConfigurer method refresh.
private void refresh() {
Multithreading.runAsync(() -> {
LevelheadJsonHolder jsonHolder = new LevelheadJsonHolder(Sk1erMod.getInstance().rawWithAgent("https://sk1er.club/newlevel/" + mc.getSession().getProfile().getId().toString().replace("-", "")));
header.setText(jsonHolder.optString("header"));
level.setText(jsonHolder.optString("true_footer"));
});
Multithreading.runAsync(() -> levelheadPropose = new LevelheadJsonHolder(Sk1erMod.getInstance().rawWithAgent("https://api.hyperium.cc/levelhead_propose" + mc.getSession().getProfile().getId().toString().replace("-", ""))));
}
use of cc.hyperium.mods.levelhead.util.LevelheadJsonHolder in project Hyperium by HyperiumClient.
the class CustomLevelheadConfigurer method initGui.
@Override
public void initGui() {
super.initGui();
header = new GuiTextField(nextId(), fontRendererObj, width / 2 - 205, 30, 200, 20);
level = new GuiTextField(nextId(), fontRendererObj, width / 2 + 5, 30, 200, 20);
header.setMaxStringLength(50);
level.setMaxStringLength(50);
Multithreading.runAsync(() -> {
LevelheadJsonHolder jsonHolder = new LevelheadJsonHolder(Sk1erMod.getInstance().rawWithAgent("https://sk1er.club/newlevel/" + mc.getSession().getProfile().getId().toString().replace("-", "")));
header.setText(jsonHolder.optString("header"));
level.setText(jsonHolder.optString("true_footer"));
});
Multithreading.runAsync(() -> levelheadPropose = new LevelheadJsonHolder(Sk1erMod.getInstance().rawWithAgent("https://api.hyperium.cc/levelhead_propose" + mc.getSession().getProfile().getId().toString().replace("-", ""))));
Multithreading.runAsync(() -> {
LevelheadJsonHolder jsonHolder = new LevelheadJsonHolder(Sk1erMod.getInstance().rawWithAgent("https://api.sk1er.club/levelheadv5/" + mc.getSession().getProfile().getId().toString().replace("-", "") + "/LEVEL"));
if (!jsonHolder.has("uuid")) {
if (mc.currentScreen instanceof CustomLevelheadConfigurer) {
mc.displayGuiScreen(null);
Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("You must purchase Custom Levelhead to use this!");
}
}
});
refresh();
reg(new GuiButton(nextId(), width / 2 - 205, 55, 200, 20, "Reset to default"), button -> {
Sk1erMod.getInstance().rawWithAgent("https://api.sk1er.club/customlevelhead/reset?hash=" + Levelhead.getInstance().getAuth().getHash() + "&level=default&header=default");
refresh();
});
reg(new GuiButton(nextId(), width / 2 + 5, 55, 200, 20, "Send for review"), button -> {
Sk1erMod.getInstance().rawWithAgent("https://api.sk1er.club/customlevelhead/propose?hash=" + Levelhead.getInstance().getAuth().getHash() + "&footer=" + URLEncoder.encode(level.getText()) + "&header=" + URLEncoder.encode(header.getText()));
refresh();
});
reg(new GuiButton(nextId(), width / 2 - 50, 80, 100, 20, "Refresh"), button -> refresh());
}
use of cc.hyperium.mods.levelhead.util.LevelheadJsonHolder in project Hyperium by HyperiumClient.
the class LevelheadTag method build.
private LevelheadComponent build(LevelheadJsonHolder holder, boolean isHeader) {
String seek = isHeader ? "header" : "footer";
LevelheadJsonHolder json = holder.optJsonObject(seek);
LevelheadComponent component = new LevelheadComponent(json.optString(seek, "Big problem, report to Sk1er."));
boolean custom = json.optBoolean("custom");
component.setCustom(custom);
if (custom && isHeader && !holder.optBoolean("exclude")) {
component.setValue(component.getValue() + ": ");
}
if (json.optBoolean("chroma")) {
component.setChroma(true);
} else if (json.optBoolean("rgb")) {
component.setRgb(true);
component.setAlpha(json.optInt("alpha"));
component.setRed(json.optInt("red"));
component.setGreen(json.optInt("green"));
component.setBlue(json.optInt("blue"));
} else {
component.setColor(json.optString("color"));
}
return component;
}
Aggregations