Skip to content

Commit

Permalink
tell it when its dead
Browse files Browse the repository at this point in the history
  • Loading branch information
gatooooooo committed Jan 25, 2025
1 parent d17037f commit 151b462
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 28 deletions.
10 changes: 7 additions & 3 deletions src/main/java/me/eldodebug/soar/Glide.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import me.eldodebug.soar.gui.mainmenu.GuiGlideMainMenu;
import me.eldodebug.soar.gui.modmenu.GuiModMenu;
import me.eldodebug.soar.management.remote.discord.DiscordStats;
import me.eldodebug.soar.management.remote.discord.DiscordManager;
import me.eldodebug.soar.management.remote.update.Update;
import me.eldodebug.soar.ui.ClickEffects;
import me.eldodebug.soar.utils.Sound;
Expand Down Expand Up @@ -39,7 +38,7 @@ public class Glide {

private static Glide instance = new Glide();
private Minecraft mc = Minecraft.getMinecraft();
private boolean updateNeeded;
private boolean updateNeeded, soar8Released;
private String name, version;
private int verIdentifier;

Expand Down Expand Up @@ -100,7 +99,7 @@ public void start() {
quickPlayManager = new QuickPlayManager();
changelogManager = new ChangelogManager();
discordStats = new DiscordStats();
new DiscordManager();
discordStats.check();
update = new Update();
update.check();
waypointManager = new WaypointManager();
Expand Down Expand Up @@ -236,7 +235,12 @@ public void createFirstLoginFile() {
public Update getUpdateInstance(){
return update;
}

public void setUpdateNeeded(boolean in) {updateNeeded = in;}
public boolean getUpdateNeeded() {return updateNeeded;}

public void setSoar8Released(boolean in) {soar8Released = in;}
public boolean getSoar8Released() {return soar8Released;}

public ClickEffects getClickEffects() {return clickEffects;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.util.ArrayList;

import me.eldodebug.soar.gui.mainmenu.impl.DiscontinuedSoar8;
import me.eldodebug.soar.gui.mainmenu.impl.UpdateScene;
import me.eldodebug.soar.gui.mainmenu.impl.welcome.*;
import me.eldodebug.soar.utils.Sound;
Expand Down Expand Up @@ -57,13 +58,16 @@ public GuiGlideMainMenu() {
scenes.add(new AccentColorSelectScene(this));
scenes.add(new LastMessageScene(this));
scenes.add(new UpdateScene(this));
scenes.add(new DiscontinuedSoar8(this));

if (instance.isFirstLogin()) {
currentScene = getSceneByClass(WelcomeMessageScene.class);
} else {
if (instance.getUpdateNeeded()) {
if (instance.getSoar8Released()) {
currentScene = getSceneByClass(DiscontinuedSoar8.class);
} else if (instance.getUpdateNeeded()) {
currentScene = getSceneByClass(UpdateScene.class);
} else {
} else {
currentScene = getSceneByClass(MainScene.class);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package me.eldodebug.soar.gui.mainmenu.impl;

import me.eldodebug.soar.Glide;
import me.eldodebug.soar.gui.mainmenu.GuiGlideMainMenu;
import me.eldodebug.soar.gui.mainmenu.MainMenuScene;
import me.eldodebug.soar.management.nanovg.NanoVGManager;
import me.eldodebug.soar.management.nanovg.font.Fonts;
import me.eldodebug.soar.management.remote.update.Update;
import me.eldodebug.soar.utils.mouse.MouseUtils;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Keyboard;

import java.awt.*;
import java.net.URI;

public class DiscontinuedSoar8 extends MainMenuScene {

public DiscontinuedSoar8(GuiGlideMainMenu parent) {
super(parent);
}

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {

ScaledResolution sr = new ScaledResolution(mc);

Glide instance = Glide.getInstance();
NanoVGManager nvg = instance.getNanoVGManager();

nvg.setupAndDraw(() -> drawNanoVG(mouseX, mouseY, sr, instance, nvg));
}

private void drawNanoVG(int mouseX, int mouseY, ScaledResolution sr, Glide instance, NanoVGManager nvg) {
nvg.drawRect(0,0, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 210));
int acWidth = 350;
int acHeight = 190;
int acX = sr.getScaledWidth() / 2 - (acWidth / 2);
int acY = sr.getScaledHeight() / 2 - (acHeight / 2);

nvg.drawRoundedRect(acX, acY, acWidth, acHeight, 20, new Color(245, 249, 239));
nvg.drawCenteredText("Soar Client 8", acX + (acWidth / 2), acY + 12, new Color(24, 29, 23), 14, Fonts.SEMIBOLD);

nvg.drawCenteredText("Soar Client V8 is finally ready for public use and because of this", acX + (acWidth / 2), acY + 35, new Color(66, 73, 64), 9, Fonts.REGULAR);
nvg.drawCenteredText("GlideClient is now discontinued so we ask that you get Soar 8.", acX + (acWidth / 2), acY + 45, new Color(66, 73, 64), 9, Fonts.REGULAR);

nvg.drawCenteredText("Soar 8 features many new modern features such as its material", acX + (acWidth / 2), acY + 60, new Color(66, 73, 64), 9, Fonts.REGULAR);
nvg.drawCenteredText("you design, better performance and so much more to discover!", acX + (acWidth / 2), acY + 70, new Color(66, 73, 64), 9, Fonts.REGULAR);

nvg.drawCenteredText("Thank you for supporting Glide we appreciated it so much <3", acX + (acWidth / 2), acY + 90, new Color(66, 73, 64), 9, Fonts.REGULAR);

nvg.drawCenteredText("Anyway... It's time to stop Gliding and start Soaring!", acX + (acWidth / 2), acY + 135, new Color(66, 73, 64), 9, Fonts.REGULAR);

nvg.drawRoundedRect(acX + acWidth/2 + 5, acY + acHeight - 32, 90, 20, 10F, new Color(58, 105, 58));
nvg.drawCenteredText("Get Soar 8", acX + acWidth/2 + 50, acY + acHeight - 22 - (nvg.getTextHeight("Get Soar 8", 9.5F, Fonts.REGULAR)/2), Color.WHITE, 9.5F, Fonts.REGULAR);

nvg.drawRoundedRect(acX + acWidth/2 - 95, acY + acHeight - 32, 90, 20, 10F, new Color(212, 231, 206));
nvg.drawCenteredText("Maybe Later", acX + acWidth/2 - 50, acY + acHeight - 22 - (nvg.getTextHeight("Maybe Later", 9.5F, Fonts.REGULAR)/2), new Color(59, 75, 57), 9.5F, Fonts.REGULAR);

}

public void exitGui(){
Glide instance = Glide.getInstance();
instance.setUpdateNeeded(false);
this.setCurrentScene(this.getSceneByClass(MainScene.class));
}

@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (mouseButton == 0) {
ScaledResolution sr = new ScaledResolution(mc);
int acWidth = 350;
int acHeight = 190;
int acX = sr.getScaledWidth() / 2 - (acWidth / 2);
int acY = sr.getScaledHeight() / 2 - (acHeight / 2);
if (MouseUtils.isInside(mouseX, mouseY, acX + acWidth/2 + 5, acY + acHeight - 32, 90, 20)) {
try{ Desktop.getDesktop().browse(new URI("https://glideclient.github.io/soar8")); } catch (Exception ignored) {}
}
if (MouseUtils.isInside(mouseX, mouseY, acX + acWidth/2 - 95, acY + acHeight - 32, 90, 20)) {
exitGui();
}
}
}

@Override
public void keyTyped(char typedChar, int keyCode) {
if (keyCode == Keyboard.KEY_ESCAPE) {
exitGui();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public MainScene(GuiGlideMainMenu parent) {
public void drawScreen(int mouseX, int mouseY, float partialTicks) {

Glide instance = Glide.getInstance();
if(instance.getUpdateNeeded()){
if(instance.getSoar8Released()){
instance.setSoar8Released(false);
this.setCurrentScene(this.getSceneByClass(DiscontinuedSoar8.class));
} else if(instance.getUpdateNeeded()){
instance.setUpdateNeeded(false);
this.setCurrentScene(this.getSceneByClass(UpdateScene.class));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
package me.eldodebug.soar.management.nanovg;

/*
* Copyright (C) 2021-2024 Polyfrost Inc. and contributors.
* <https://polyfrost.org> <https://github.com/Polyfrost>
*
* OneConfig is licensed under the terms of version 3 of the GNU Lesser
* General Public License as published by the Free Software Foundation, AND
* under the Additional Terms Applicable to OneConfig, as published by Polyfrost Inc.,
* either version 1.1 of the Additional Terms, or (at your option) any later
* version.
*
* A copy of version 3 of the GNU Lesser General Public License is
* found below, along with the Additional Terms Applicable to OneConfig.
* A copy of version 3 of the GNU General Public License, which supplements
* version 3 of the GNU Lesser General Public License, is also found below.
*
* https://github.com/Polyfrost/OneConfig/blob/develop-v0/LICENSE
*/

import java.awt.Color;
import java.io.File;
import java.util.HashMap;
Expand Down Expand Up @@ -399,6 +417,7 @@ public void drawTextBox(String text, float x, float y, float maxWidth, Color col
NanoVG.nvgFillColor(nvg, nvgColor);
NanoVG.nvgTextBox(nvg, x, y, maxWidth, text);
}


public void drawCenteredText(String text, float x, float y, Color color, float size, Font font) {

Expand All @@ -418,6 +437,7 @@ public float getTextWidth(String text, float size, Font font) {

return bounds[2] - bounds[0];
}


public float getTextHeight(String text, float size, Font font) {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
package me.eldodebug.soar.management.remote.discord;

import com.google.gson.JsonObject;
import me.eldodebug.soar.Glide;
import me.eldodebug.soar.utils.JsonUtils;
import me.eldodebug.soar.utils.Multithreading;
import me.eldodebug.soar.utils.network.HttpUtils;

/**
* I know what people are like so il explain this class .
* This class checks the discord api to see how many members the glide server has
* you can see this within the ui from the home screen in the mod menu
*/
public class DiscordStats {
int membersCount = -1;
int membersOnline = -1;
Expand All @@ -13,4 +24,16 @@ public void setMemberOnline(int in){
}
public int getMemberOnline(){return membersOnline;}

public void check(){
Multithreading.runAsync(this::checkDiscordValues);
}
public void checkDiscordValues(){
DiscordStats discordStats = Glide.getInstance().getDiscordStats();
JsonObject jsonObject = HttpUtils.readJson("https://discord.com/api/v9/invites/42PXqKvwxq?with_counts=true", null);

if(jsonObject != null) {
discordStats.setMemberCount(JsonUtils.getIntProperty(jsonObject, "approximate_member_count", -1));
discordStats.setMemberOnline(JsonUtils.getIntProperty(jsonObject, "approximate_presence_count", -1));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Update {
String updateVersionString = "something is broken lmao";
int updateBuildID = 0;
boolean discontinued = false;
boolean soar8Released = false;

public void setUpdateLink(String in){
this.updateLink = in;
Expand Down Expand Up @@ -39,6 +40,12 @@ public boolean getDiscontinued(){
return discontinued;
}

public void setSoar8Released(boolean in){
this.soar8Released = in;
}
public boolean getSoar8Released() {return soar8Released;}


public void check(){
try{
Multithreading.runAsync(this::checkUpdates);
Expand All @@ -50,6 +57,7 @@ public void checkForUpdates(){
if (g.getVersionIdentifier() < this.updateBuildID){
g.setUpdateNeeded(true);
}
g.setSoar8Released(getSoar8Released());
}

private void checkUpdates() {
Expand All @@ -59,6 +67,7 @@ private void checkUpdates() {
setVersionString(JsonUtils.getStringProperty(jsonObject, "latestversionstring", "something is broken lmao"));
setBuildID(JsonUtils.getIntProperty(jsonObject, "latestversion", 0));
setDiscontinued(JsonUtils.getBooleanProperty(jsonObject, "discontinued", false));
setSoar8Released(JsonUtils.getBooleanProperty(jsonObject, "soar8released", false));
checkForUpdates();
}
}
Expand Down

0 comments on commit 151b462

Please sign in to comment.