use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.
the class Sk1erMod method rawWithAgent.
public String rawWithAgent(String url) {
Hyperium.LOGGER.info("[Sk1erMod] Fetching " + url);
if (!Hyperium.INSTANCE.isAcceptedTos()) {
return new JsonHolder().put("success", false).put("cause", "TOS_NOT_ACCEPTED").toString();
}
url = url.replace(" ", "%20");
HttpURLConnection connection = null;
try {
URL u = new URL(url);
connection = (HttpURLConnection) u.openConnection();
connection.setRequestMethod("GET");
connection.setUseCaches(true);
connection.addRequestProperty("User-Agent", "Mozilla/4.76 (" + modid + " V" + version + ") via Hyperium ");
connection.setReadTimeout(15000);
connection.setConnectTimeout(15000);
connection.setDoOutput(true);
InputStream is = connection.getInputStream();
return IOUtils.toString(is, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (connection != null)
connection.disconnect();
}
JsonObject object = new JsonObject();
object.addProperty("success", false);
object.addProperty("cause", "Exception");
return object.toString();
}
use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.
the class Sk1erMod method checkStatus.
public void checkStatus() {
if (Minecraft.getMinecraft().gameSettings.snooperEnabled) {
Multithreading.schedule(() -> {
en = new JsonHolder(rawWithAgent("https://sk1er.club/genkey?name=" + Minecraft.getMinecraft().getSession().getProfile().getName() + "&uuid=" + Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "") + "&mcver=" + Minecraft.getMinecraft().getVersion() + "&modver=" + version + "&mod=" + modid));
if (callback != null)
callback.call(en);
en.optBoolean("enabled");
apiKey = en.optString("key");
}, 0, 5, TimeUnit.MINUTES);
}
}
use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.
the class HypixelApiGuild method getCustomRanks.
public List<GuildRank> getCustomRanks() {
if (ranks == null) {
ranks = new ArrayList<>();
ranks.add(new GuildRank("GUILDMASTER", Integer.MAX_VALUE));
ranks.add(new GuildRank("OFFICER", 4));
ranks.add(new GuildRank("MEMBER", 3));
for (JsonElement element : getRoot().optJSONArray("ranks")) {
JsonHolder holder = new JsonHolder(element.getAsJsonObject());
ranks.add(new GuildRank(holder.optString("name"), holder.optInt("priority")));
}
}
return ranks;
}
use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.
the class PurchaseApi method getPackageSync.
public HyperiumPurchase getPackageSync(UUID uuid) {
if (uuid == null)
return null;
return purchasePlayers.computeIfAbsent(uuid, uuid1 -> {
String s = uuid.toString().replace("-", "");
if (s.length() == 32 && s.charAt(12) != '4') {
HyperiumPurchase non_player = new HyperiumPurchase(uuid, new JsonHolder().put("non_player", true));
EventBus.INSTANCE.post(new PurchaseLoadEvent(uuid, non_player, false));
return non_player;
}
HyperiumPurchase hyperiumPurchase = new HyperiumPurchase(uuid, get(url + uuid.toString()));
EventBus.INSTANCE.post(new PurchaseLoadEvent(uuid, hyperiumPurchase, uuid.equals(UUIDUtil.getClientUUID())));
return hyperiumPurchase;
});
}
use of cc.hyperium.utils.JsonHolder in project Hyperium by HyperiumClient.
the class CommandDebug method get.
public static String get() {
StringBuilder builder = new StringBuilder();
PurchaseApi api = PurchaseApi.getInstance();
if (api == null)
return "";
builder.append("\n\n");
Multithreading.runAsync(CommandDebug::checkUUID);
if (isPremium) {
builder.append("Premium: True, ").append("UUID is ").append(Minecraft.getMinecraft().thePlayer.getGameProfile().getId());
} else {
builder.append("Premium: False, user doesn't have a UUID");
}
builder.append("\n\n");
HyperiumPurchase self = PurchaseApi.getInstance().getSelf();
builder.append("Purchase callback: ");
if (self != null) {
JsonHolder response = self.getResponse();
if (response != null)
builder.append(printer.toJson(response.getObject()));
}
builder.append("\n\n");
HypixelDetector instance = HypixelDetector.getInstance();
if (instance != null)
builder.append("Hypixel: ").append(instance.isHypixel());
builder.append("\n\n\n\n");
NetworkHandler networkHandler = Hyperium.INSTANCE.getNetworkHandler();
if (networkHandler != null) {
List<String> verboseLogs = networkHandler.getVerboseLogs();
verboseLogs.forEach(verboseLog -> {
builder.append(verboseLog);
builder.append("\n");
});
builder.append(verboseLogs);
builder.append("\n");
}
tryConfig(builder);
builder.append("\n\n");
tryChromaHUD(builder);
builder.append("\n\n");
tryKeybinds(builder);
builder.append("\n\n");
tryLevelhead(builder);
builder.append("\n\n");
builder.append("Levelhead");
builder.append("\n");
return builder.toString();
}
Aggregations