From eaecce86d73dd6810168f418c36155422f67addc Mon Sep 17 00:00:00 2001 From: syeyoung Date: Tue, 4 May 2021 13:13:43 +0900 Subject: deobfuscate --- .../kr/syeyoung/dungeonsguide/Authenticator.java | 295 +++++++++++++++++++++ .../kr/syeyoung/dungeonsguide/DGInterface.java | 28 ++ .../kr/syeyoung/dungeonsguide/DungeonsGuide.java | 217 +++++++++++++++ src/main/java/kr/syeyoung/dungeonsguide/Main.java | 145 ++++++++++ .../dungeonsguide/RichPresenceManager.java | 8 +- src/main/java/kr/syeyoung/dungeonsguide/a.java | 145 ---------- src/main/java/kr/syeyoung/dungeonsguide/b.java | 295 --------------------- src/main/java/kr/syeyoung/dungeonsguide/c.java | 28 -- .../commands/CommandDungeonsGuide.java | 24 +- src/main/java/kr/syeyoung/dungeonsguide/d/a.java | 49 ---- src/main/java/kr/syeyoung/dungeonsguide/d/b.java | 35 --- src/main/java/kr/syeyoung/dungeonsguide/d/c.java | 36 --- .../dungeonsguide/dungeon/DungeonContext.java | 15 +- .../dungeonsguide/dungeon/MapProcessor.java | 34 ++- .../dungeon/doorfinder/CatacombDataProvider.java | 4 +- .../doorfinder/CatacombMasterDataProvider.java | 4 +- .../roomfinder/DungeonRoomInfoRegistry.java | 1 - src/main/java/kr/syeyoung/dungeonsguide/e.java | 227 ---------------- .../eventlistener/DungeonListener.java | 28 +- .../eventlistener/FeatureListener.java | 54 ++-- .../eventlistener/PacketListener.java | 7 +- .../impl/advanced/FeatureDebuggableMap.java | 10 +- .../impl/advanced/FeatureRoomCoordDisplay.java | 7 +- .../impl/advanced/FeatureRoomDebugInfo.java | 11 +- .../features/impl/boss/FeatureAutoReparty.java | 19 +- .../features/impl/boss/FeatureBossHealth.java | 16 +- .../features/impl/boss/FeatureBoxRealLivid.java | 12 +- .../features/impl/boss/FeatureChestPrice.java | 5 +- .../features/impl/boss/FeatureCurrentPhase.java | 6 +- .../features/impl/boss/FeatureHideAnimals.java | 11 +- .../features/impl/boss/FeatureTerracotaTimer.java | 5 +- .../impl/boss/FeatureThornBearPercentage.java | 11 +- .../impl/boss/FeatureThornSpiritBowTimer.java | 4 +- .../features/impl/boss/FeatureWarningOnPortal.java | 4 +- .../impl/boss/terminal/FeatureSimonSaysSolver.java | 4 +- .../features/impl/dungeon/FeatureBoxBats.java | 6 +- .../impl/dungeon/FeatureBoxSkelemaster.java | 6 +- .../features/impl/dungeon/FeatureBoxStarMobs.java | 5 +- .../dungeon/FeatureDungeonCurrentRoomSecrets.java | 12 +- .../impl/dungeon/FeatureDungeonDeaths.java | 17 +- .../features/impl/dungeon/FeatureDungeonMap.java | 13 +- .../impl/dungeon/FeatureDungeonMilestone.java | 13 +- .../impl/dungeon/FeatureDungeonRealTime.java | 15 -- .../impl/dungeon/FeatureDungeonSBTime.java | 13 +- .../features/impl/dungeon/FeatureDungeonScore.java | 12 +- .../impl/dungeon/FeatureDungeonSecrets.java | 16 +- .../features/impl/dungeon/FeatureDungeonTombs.java | 10 +- .../features/impl/dungeon/FeatureHideNameTags.java | 7 +- .../features/impl/dungeon/FeaturePlayerESP.java | 20 +- .../dungeon/FeaturePressAnyKeyToCloseChest.java | 7 +- .../impl/dungeon/FeatureWarnLowHealth.java | 16 +- .../impl/dungeon/FeatureWatcherWarning.java | 11 +- .../impl/etc/FeatureAutoAcceptReparty.java | 15 +- .../features/impl/etc/FeatureCooldownCounter.java | 6 +- .../impl/etc/FeatureDecreaseExplosionSound.java | 4 +- .../features/impl/etc/FeatureDisableMessage.java | 4 +- .../features/impl/etc/FeaturePenguins.java | 8 +- .../features/impl/etc/FeatureUpdateAlarm.java | 4 - .../impl/etc/ability/FeatureAbilityCooldown.java | 4 +- .../features/impl/secret/FeatureActions.java | 12 +- .../impl/secret/FeatureFreezePathfind.java | 20 +- .../impl/secret/FeatureMechanicBrowse.java | 5 +- .../impl/secret/FeatureSoulRoomWarning.java | 27 +- .../dungeonsguide/party/PartyInviteViewer.java | 14 +- .../syeyoung/dungeonsguide/party/PartyManager.java | 18 +- .../dungeonsguide/resources/DGTexturePack.java | 11 +- .../roomedit/panes/GeneralEditPane.java | 5 +- .../roomprocessor/GeneralRoomProcessor.java | 18 +- .../bombdefuse/RoomProcessorBombDefuseSolver.java | 6 +- .../chambers/color/ColorRightProcessor.java | 6 - .../bossfight/BossfightProcessorThorn.java | 8 +- .../syeyoung/dungeonsguide/url/DGConnection.java | 49 ++++ .../dungeonsguide/url/DGStreamHandler.java | 36 +++ .../dungeonsguide/url/DGStreamHandlerFactory.java | 37 +++ .../kr/syeyoung/dungeonsguide/utils/AhUtils.java | 5 +- 75 files changed, 994 insertions(+), 1331 deletions(-) create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/DGInterface.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/Main.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/a.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/b.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/c.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/d/a.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/d/b.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/d/c.java delete mode 100755 src/main/java/kr/syeyoung/dungeonsguide/e.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java create mode 100755 src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java (limited to 'src/main/java/kr') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java new file mode 100755 index 00000000..44e0908c --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java @@ -0,0 +1,295 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; +import net.minecraftforge.fml.common.ProgressManager; +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.net.ssl.*; +import java.io.*; +import java.math.BigInteger; +import java.net.*; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class Authenticator { + private KeyPair rsaKey; + private String token; + private final ProgressManager.ProgressBar progressBar; + + public String getToken() { + return token; + } + + private KeyPair getKeyPair() { + KeyPairGenerator a = null; + try { + a = KeyPairGenerator.getInstance("RSA"); + } catch (NoSuchAlgorithmException b) { } + a.initialize(1024); + this.rsaKey = a.generateKeyPair(); + return this.rsaKey; + } + + private PublicKey dgPublicKey; + private PublicKey getDGPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException { + if (dgPublicKey != null) return dgPublicKey; + X509EncodedKeySpec spec = new X509EncodedKeySpec(Base64.decodeBase64("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxO89qtwG67jNucQ9Y44c" + + "IUs/B+5BeJPs7G+RG2gfs4/2+tzF/c1FLDc33M7yKw8aKk99vsBUY9Oo8gxxiEPB" + + "JitP/qfon2THp94oM77ZTpHlmFoqbZMcKGZVI8yfvEL4laTM8Hw+qh5poQwtpEbK" + + "Xo47AkxygxJasUnykER2+aSTZ6kWU2D4xiNtFA6lzqN+/oA+NaYfPS0amAvyVlHR" + + "n/8IuGkxb5RrlqVssQstFnxsJuv88qdGSEqlcKq2tLeg9hb8eCnl2OFzvXmgbVER" + + "0JaV+4Z02fVG1IlR3Xo1mSit7yIU6++3usRCjx2yfXpnGGJUW5pe6YETjNew3ax+" + + "FAZ4GePWCdmS7FvBnbbABKo5pE06ZTfDUTCjQlAJQiUgoF6ntMJvQAXPu48Vr8q/" + + "mTcuZWVnI6CDgyE7nNq3WNoq3397sBzxRohMxuqzl3T19zkfPKF05iV2Ju1HQMW5" + + "I119bYrmVD240aGESZc20Sx/9g1BFpNzQbM5PGUlWJ0dhLjl2ge4ip2hHciY3OEY" + + "p2Qy2k+xEdenpKdL+WMRimCQoO9gWe2Tp4NmP5dppDXZgPjXqjZpnGs0Uxs+fXqW" + + "cwlg3MbX3rFl9so/fhVf4p9oXZK3ve7z5D6XSSDRYECvsKIa08WAxJ/U6n204E/4" + + "xUF+3ZgFPdzZGn2PU7SsnOsCAwEAAQ==")); + return dgPublicKey = KeyFactory.getInstance("RSA").generatePublic(spec); + } + + public Authenticator(ProgressManager.ProgressBar progressBar) { + this.progressBar = progressBar; + progressBar.step("Generating KeyPair"); + getKeyPair(); + } + + public String authenticateAndDownload(String version) throws IOException, AuthenticationException, NoSuchAlgorithmException, CertificateException, KeyStoreException, KeyManagementException, InvalidKeySpecException, SignatureException { + Session session = Minecraft.getMinecraft().getSession(); + String sessionToken = session.getToken(); + + progressBar.step("Authenticating (1/2)"); + String tempToken = requestAuth(session.getProfile()); + MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); + JsonObject d = getJwtPayload(tempToken); + String hash = calculateServerHash(Base64.decodeBase64(d.get("sharedSecret").getAsString()), + Base64.decodeBase64(d.get("publicKey").getAsString())); + yggdrasilMinecraftSessionService.joinServer(session.getProfile(), sessionToken, hash); + progressBar.step("Authenticating (2/2)"); + this.token = verifyAuth(tempToken, this.rsaKey.getPublic()); + try { + progressBar.step("Downloading Jar"); + if (version != null) + downloadSafe(this.token, "https://dungeons.guide/resource/version?v=" + version, true); + progressBar.step("Downloading Rooms"); + downloadSafe(this.token, "https://dungeons.guide/resource/roomdata", false); + } catch (Throwable t) { + t.printStackTrace(); + } + return this.token; + } + + public JsonObject getJwtPayload(String jwt) { + String midPart = jwt.split("\\.")[1].replace("+", "-").replace("/", "_"); + String base64Decode = new String(Base64.decodeBase64(midPart)); // padding + return (JsonObject) new JsonParser().parse(base64Decode); + } + + + + private String requestAuth(GameProfile profile) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, KeyManagementException { + HttpsURLConnection connection = (HttpsURLConnection) new URL("https://dungeons.guide/auth/requestAuth").openConnection(); + connection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + connection.setRequestProperty("Content-Type", "application/json"); + connection.setRequestMethod("POST"); + connection.setDoInput(true); + connection.setDoOutput(true); + + connection.getOutputStream().write(("{\"uuid\":\""+profile.getId().toString()+"\",\"nickname\":\""+profile.getName()+"\"}").getBytes()); + InputStreamReader inputStreamReader = new InputStreamReader(connection.getInputStream()); + JsonObject json = (JsonObject) new JsonParser().parse(inputStreamReader); + if (!"ok".equals(json.get("status").getAsString())) { + return null; + } + return json.get("data").getAsString(); + } + private String verifyAuth(String tempToken, PublicKey clientKey) throws IOException { + HttpsURLConnection urlConnection = (HttpsURLConnection) new URL("https://dungeons.guide/auth/authenticate").openConnection(); + urlConnection.setRequestMethod("POST"); + urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + urlConnection.setRequestProperty("Content-Type", "application/json"); + urlConnection.setDoInput(true); + urlConnection.setDoOutput(true); + + urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"publicKey\":\""+Base64.encodeBase64URLSafeString(clientKey.getEncoded())+"\"}").getBytes()); + urlConnection.getResponseCode(); + InputStreamReader reader = new InputStreamReader(urlConnection.getInputStream()); + JsonObject jsonObject = (JsonObject) new JsonParser().parse(reader); + if (!"ok".equals(jsonObject.get("status").getAsString())) { + return null; + } + return jsonObject.get("data").getAsString(); + } + + private final HashMap loadedResources = new HashMap(); + + public HashMap getResources() { + return loadedResources; + } + + private void downloadSafe(String dgToken, String url, boolean isValidateSignature) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException, SignatureException, InvalidKeySpecException { + HttpsURLConnection dgConnection = (HttpsURLConnection) new URL(url).openConnection(); + dgConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + dgConnection.setRequestProperty("Content-Type", "application/json"); + dgConnection.setRequestMethod("GET"); + dgConnection.setRequestProperty("Authorization", dgToken); + dgConnection.setDoInput(true); + dgConnection.setDoOutput(true); + + InputStream inputStream = dgConnection.getInputStream(); + byte[] lengthBytes = new byte[4]; + inputStream.read(lengthBytes); + int length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + while (inputStream.available() < length) ; + byte[] keyPayload = new byte[length]; + inputStream.read(keyPayload); + + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, this.rsaKey.getPrivate()); + byte[] h = cipher.doFinal(keyPayload); + + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(h, "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(h); + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); + + cipherInputStream.read(lengthBytes); + length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + + int totalLen = length; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + byte[] buff = new byte[256]; + while (totalLen > 0) { + int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); + totalLen -= len; + bos.write(buff, 0, len); + } + byte[] body = bos.toByteArray(); + + byte[] signed = null; + if (isValidateSignature) { + progressBar.step("Validating Signature"); + cipherInputStream.read(lengthBytes,0 , 4); + length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + + totalLen = length; + bos = new ByteArrayOutputStream(); + while (totalLen > 0) { + int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); + totalLen -= len; + bos.write(buff, 0, len); + } + signed = bos.toByteArray(); + + Signature sign = Signature.getInstance("SHA512withRSA"); + sign.initVerify(getDGPublicKey()); + sign.update(body); + boolean truth = sign.verify(signed); + if (!truth) throw new SignatureException("DG SIGNATURE FORGED"); + } + + ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(body)); + ZipEntry zipEntry; + while ((zipEntry=zipInputStream.getNextEntry()) != null) { + byte[] buffer = new byte[256]; + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + int p = 0; + while((p = zipInputStream.read(buffer)) > 0) { + byteArrayOutputStream.write(buffer, 0, p); + } + this.loadedResources.put(zipEntry.getName(), byteArrayOutputStream.toByteArray()); + } + dgConnection.disconnect(); + } + + public JsonElement getJsonSecured(String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException { + HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(u).openConnection(); + httpsURLConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + httpsURLConnection.setRequestProperty("Content-Type", "application/json"); + httpsURLConnection.setRequestMethod("GET"); + httpsURLConnection.setRequestProperty("Authorization", this.token); + httpsURLConnection.setDoInput(true); + httpsURLConnection.setDoOutput(true); + + InputStream inputStream = httpsURLConnection.getInputStream(); + byte[] lengthPayload = new byte[4]; + inputStream.read(lengthPayload); + int length = ((lengthPayload[0] & 0xFF) << 24) | + ((lengthPayload[1] & 0xFF) << 16) | + ((lengthPayload[2] & 0xFF) << 8) | + ((lengthPayload[3] & 0xFF)); + while (inputStream.available() < length) ; + byte[] keyPayload = new byte[length]; + inputStream.read(keyPayload); + + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, this.rsaKey.getPrivate()); + byte[] AESKey = cipher.doFinal(keyPayload); + + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(AESKey, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(AESKey); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec); + CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); + cipherInputStream.read(lengthPayload); + length = ((lengthPayload[0] & 0xFF) << 24) | + ((lengthPayload[1] & 0xFF) << 16) | + ((lengthPayload[2] & 0xFF) << 8) | + ((lengthPayload[3] & 0xFF)); + JsonElement l = new JsonParser().parse(new InputStreamReader(cipherInputStream)); + httpsURLConnection.disconnect(); + return l; + } + + public String calculateServerHash(byte[] a, byte[] b) throws NoSuchAlgorithmException { + MessageDigest c = MessageDigest.getInstance("SHA-1"); + c.update("".getBytes()); + c.update(a); + c.update(b); + byte[] d = c.digest(); + return new BigInteger(d).toString(16); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DGInterface.java b/src/main/java/kr/syeyoung/dungeonsguide/DGInterface.java new file mode 100755 index 00000000..0529f0a6 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/DGInterface.java @@ -0,0 +1,28 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide; + +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public interface DGInterface { + void init(FMLInitializationEvent event); + + void pre(FMLPreInitializationEvent event); +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java new file mode 100755 index 00000000..c1d3e4ea --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java @@ -0,0 +1,217 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.commands.*; +import kr.syeyoung.dungeonsguide.config.Config; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.eventlistener.DungeonListener; +import kr.syeyoung.dungeonsguide.eventlistener.FeatureListener; +import kr.syeyoung.dungeonsguide.eventlistener.PacketListener; +import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; +import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.party.PartyInviteViewer; +import kr.syeyoung.dungeonsguide.party.PartyManager; +import kr.syeyoung.dungeonsguide.resources.DGTexturePack; +import kr.syeyoung.dungeonsguide.stomp.CloseListener; +import kr.syeyoung.dungeonsguide.stomp.StompClient; +import kr.syeyoung.dungeonsguide.stomp.StompInterface; +import kr.syeyoung.dungeonsguide.utils.AhUtils; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.launchwrapper.LaunchClassLoader; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.common.ProgressManager; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.relauncher.ReflectionHelper; +import org.apache.commons.io.IOUtils; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.io.*; +import java.net.URI; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +public class DungeonsGuide implements DGInterface, CloseListener { + + private SkyblockStatus skyblockStatus; + + private static DungeonsGuide dungeonsGuide; + + + @Getter + private final Authenticator authenticator; + + @Getter + private StompInterface stompConnection; + + public DungeonsGuide(Authenticator authenticator) { + this.authenticator = authenticator; + } + + public static void sendDebugChat(IChatComponent iChatComponent) { + if (FeatureRegistry.DEBUG.isEnabled()) + Minecraft.getMinecraft().thePlayer.addChatMessage(iChatComponent); + } + @Getter + CommandReparty commandReparty; + + + private final String stompURL = "wss://dungeons.guide/ws"; +// private String stompURL = "ws://localhost/ws"; + public void init(FMLInitializationEvent event) { + ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4); + + + try { + Set invalid = ReflectionHelper.getPrivateValue(LaunchClassLoader.class, (LaunchClassLoader) Main.class.getClassLoader(), "invalidClasses"); + ((LaunchClassLoader) Main.class.getClassLoader()).clearNegativeEntries(Sets.newHashSet("org.slf4j.LoggerFactory")); + for (String s : invalid) { + System.out.println(s+" in invalid"); + } + invalid.clear(); + } catch (Throwable t) { + t.printStackTrace(); + } + + progressbar.step("Registering Events & Commands"); + dungeonsGuide = this; + skyblockStatus = new SkyblockStatus(); + + CommandDungeonsGuide commandDungeonsGuide; + MinecraftForge.EVENT_BUS.register(new DungeonListener()); + ClientCommandHandler.instance.registerCommand(commandDungeonsGuide = new CommandDungeonsGuide()); + MinecraftForge.EVENT_BUS.register(commandDungeonsGuide); + + commandReparty = new CommandReparty(); + if (FeatureRegistry.ETC_REPARTY.isEnabled()) + ClientCommandHandler.instance.registerCommand(commandReparty); + + MinecraftForge.EVENT_BUS.register(commandReparty); + MinecraftForge.EVENT_BUS.register(new FeatureListener()); + MinecraftForge.EVENT_BUS.register(new PacketListener()); + MinecraftForge.EVENT_BUS.register(new Keybinds()); + + RichPresenceManager.INSTANCE.setup(); + MinecraftForge.EVENT_BUS.register(RichPresenceManager.INSTANCE); + MinecraftForge.EVENT_BUS.register(PartyManager.INSTANCE); + MinecraftForge.EVENT_BUS.register(PartyInviteViewer.INSTANCE); + + AhUtils.registerTimer(); + + progressbar.step("Downloading Roomdatas"); + try { + DungeonRoomInfoRegistry.loadAll(configDir); + } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | IOException | NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { + e.printStackTrace(); + } + Keybinds.register(); + + progressbar.step("Opening connection"); + try { + stompConnection = new StompClient(new URI(stompURL), authenticator.getToken(), this); + MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); + } catch (Exception e) { + throw new RuntimeException(e); + } + + + progressbar.step("Loading Config"); + try { + Config.loadConfig( null ); + } catch (IOException e) { + e.printStackTrace(); + } + + + ProgressManager.pop(progressbar); + } + public void pre(FMLPreInitializationEvent event) { + configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide"); + File configFile = new File(configDir, "config.json"); + if (!configFile.exists()) { + configDir.mkdirs(); + } + Config.f = configFile; + Minecraft.getMinecraft().getFramebuffer().enableStencil(); + + try { + List resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(),"defaultResourcePacks", "aA", "field_110449_ao"); + resourcePackList.add(new DGTexturePack(authenticator)); + } catch (Throwable t){ + t.printStackTrace(); + } + } + private void copy(InputStream inputStream, File f) throws IOException { + FileOutputStream fos = new FileOutputStream(f); + IOUtils.copy(inputStream, fos); + fos.flush(); + fos.close(); + inputStream.close(); + } + + private void combineConfig(Configuration saved, Configuration newest) { + } + + @Getter + private File configDir; + + + public SkyblockStatus getSkyblockStatus() { + return skyblockStatus; + } + + public static DungeonsGuide getDungeonsGuide() { + return dungeonsGuide; + } + ScheduledExecutorService ex = Executors.newScheduledThreadPool(2); + @Override + public void onClose(int code, String reason, boolean remote) { + System.out.println("Stomp Connection closed, trying to reconnect - "+reason+ " - "+code); + connectStomp(); + } + + public void connectStomp() { + ex.schedule(new Runnable() { + @Override + public void run() { + try { + stompConnection = new StompClient(new URI(stompURL), authenticator.getToken(), DungeonsGuide.this); + MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); + } catch (Exception e) { + e.printStackTrace(); + } + } + }, 5L, TimeUnit.SECONDS); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Main.java b/src/main/java/kr/syeyoung/dungeonsguide/Main.java new file mode 100755 index 00000000..10d20b2f --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/Main.java @@ -0,0 +1,145 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide; + +import com.mojang.authlib.exceptions.AuthenticationException; +import kr.syeyoung.dungeonsguide.url.DGStreamHandlerFactory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiErrorScreen; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.launchwrapper.LaunchClassLoader; +import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.ProgressManager; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.io.*; +import java.net.URL; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.spec.InvalidKeySpecException; + +@Mod(modid = Main.MOD_ID, version = Main.VERSION) +public class Main +{ + public static final String MOD_ID = "skyblock_dungeons_guide"; + public static final String VERSION = "1.0"; + + private static Main main; + + private DGInterface dgInterface; + + @EventHandler + public void initEvent(FMLInitializationEvent initializationEvent) + { + + main = this; + dgInterface.init(initializationEvent); + } + + @EventHandler + public void preInit(FMLPreInitializationEvent preInitializationEvent) { + ProgressManager.ProgressBar progressBar = ProgressManager.push("DungeonsGuide", this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/e.class") == null ? 7 : 6); + Authenticator authenticator = new Authenticator(progressBar); + String token = null; + try { + token = authenticator.authenticateAndDownload(this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/e.class") == null ? System.getProperty("dg.version") == null ? "latest" : System.getProperty("dg.version") : null); + if (token != null) { + main = this; + URL.setURLStreamHandlerFactory(new DGStreamHandlerFactory(authenticator)); + LaunchClassLoader classLoader = (LaunchClassLoader) Main.class.getClassLoader(); + classLoader.addURL(new URL("z:///")); + + try { + progressBar.step("Initializing"); + this.dgInterface = new DungeonsGuide(authenticator); + this.dgInterface.pre(preInitializationEvent); + ProgressManager.pop(progressBar); + } catch (Exception e) { + e.printStackTrace(); + + throwError(new String[]{ + "Couldn't load Dungeons Guide", + "Please contact developer if this problem persists after restart" + }); + } + return; + } + } catch (IOException | AuthenticationException | NoSuchAlgorithmException | CertificateException | KeyStoreException | KeyManagementException | InvalidKeySpecException | SignatureException e) { + e.printStackTrace(); + } + + throwError(new String[]{ + "Can't validate current installation of Dungeons Guide", + "Steps to fix", + "1. check if other people can't join minecraft servers.", + "2. restart minecraft launcher", + "3. make sure you're on the right account", + "4. restart your computer", + "If the problem persists after following these steps, please contact developer", + "If you haven't purchased the mod, please consider doing so" + }); + } + + public void throwError(final String[] a) { + final GuiScreen b = new GuiErrorScreen(null, null) { + @Override + public void drawScreen(int par1, int par2, float par3) { + super.drawScreen(par1, par2, par3); + for (int i = 0; i < a.length; ++i) { + drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); + } + } + + @Override + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, width / 2 - 50, height - 50, 100,20, "close")); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + System.exit(-1); + } + }; + @SuppressWarnings("serial") CustomModLoadingErrorDisplayException e = new CustomModLoadingErrorDisplayException() { + + @Override + public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { + Minecraft.getMinecraft().displayGuiScreen(b); + } + + @Override + public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { + } + }; + throw e; + } + public static Main a() { + return main; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java index 149de8eb..411d7dc9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java @@ -33,10 +33,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.json.JSONObject; -import java.io.*; -import java.net.URL; -import java.time.Instant; - public class RichPresenceManager implements Runnable { public static RichPresenceManager INSTANCE = new RichPresenceManager(); private Thread t = new Thread(this); @@ -60,7 +56,7 @@ public class RichPresenceManager implements Runnable { PartyInviteViewer.INSTANCE.joinRequests.add(partyJoinRequest); }).setJoinGameEventHandler(joinSecret -> { - e.getDungeonsGuide().getStompConnection().send(new StompPayload().method(StompHeader.SEND) + DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().method(StompHeader.SEND) .header("destination", "/app/party.askedtojoin") .payload(new JSONObject().put("token", joinSecret).toString())); }).setErroredEventHandler((errorCode, message) -> { @@ -74,7 +70,7 @@ public class RichPresenceManager implements Runnable { }).build(), true); } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public void updatePresence() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/a.java b/src/main/java/kr/syeyoung/dungeonsguide/a.java deleted file mode 100755 index f0867c9a..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/a.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide; - -import com.mojang.authlib.exceptions.AuthenticationException; -import kr.syeyoung.dungeonsguide.d.c; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiErrorScreen; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.ProgressManager; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.io.*; -import java.net.URL; -import java.security.*; -import java.security.cert.CertificateException; -import java.security.spec.InvalidKeySpecException; - -@Mod(modid = a.b, version = a.c) -public class a -{ - public static final String b = "skyblock_dungeons_guide"; - public static final String c = "1.0"; - - private static a a; - - private kr.syeyoung.dungeonsguide.c d; - - @EventHandler - public void a(FMLInitializationEvent a) - { - - kr.syeyoung.dungeonsguide.a.a = this; - d.init(a); - } - - @EventHandler - public void a(FMLPreInitializationEvent a) { - ProgressManager.ProgressBar f = ProgressManager.push("DungeonsGuide", this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/e.class") == null ? 7 : 6); - b b = new b(f); - String c = null; - try { - c = b.b(this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/e.class") == null ? System.getProperty("dg.version") == null ? "latest" : System.getProperty("dg.version") : null); - if (c != null) { - kr.syeyoung.dungeonsguide.a.a = this; - URL.setURLStreamHandlerFactory(new c(b)); - LaunchClassLoader d = (LaunchClassLoader) a.class.getClassLoader(); - d.addURL(new URL("z:///")); - - try { - f.step("Initializing"); - this.d = new e(b); - this.d.pre(a); - ProgressManager.pop(f); - } catch (Exception e) { - e.printStackTrace(); - - a(new String[]{ - "Couldn't load Dungeons Guide", - "Please contact developer if this problem persists after restart" - }); - } - return; - } - } catch (IOException | InvalidAlgorithmParameterException | AuthenticationException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | CertificateException | KeyStoreException | KeyManagementException | InvalidKeySpecException | SignatureException e) { - e.printStackTrace(); - } - - a(new String[]{ - "Can't validate current installation of Dungeons Guide", - "Steps to fix", - "1. check if other people can't join minecraft servers.", - "2. restart minecraft launcher", - "3. make sure you're on the right account", - "4. restart your computer", - "If the problem persists after following these steps, please contact developer", - "If you haven't purchased the mod, please consider doing so" - }); - } - - public void a(final String[] a) { - final GuiScreen b = new GuiErrorScreen(null, null) { - @Override - public void drawScreen(int par1, int par2, float par3) { - super.drawScreen(par1, par2, par3); - for (int i = 0; i < a.length; ++i) { - drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); - } - } - - @Override - public void initGui() { - super.initGui(); - this.buttonList.clear(); - this.buttonList.add(new GuiButton(0, width / 2 - 50, height - 50, 100,20, "close")); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - System.exit(-1); - } - }; - @SuppressWarnings("serial") CustomModLoadingErrorDisplayException e = new CustomModLoadingErrorDisplayException() { - - @Override - public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { - Minecraft.getMinecraft().displayGuiScreen(b); - } - - @Override - public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { - } - }; - throw e; - } - public static a a() { - return a; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/b.java b/src/main/java/kr/syeyoung/dungeonsguide/b.java deleted file mode 100755 index 1647bf59..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/b.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import net.minecraft.client.Minecraft; -import net.minecraft.util.Session; -import net.minecraftforge.fml.common.ProgressManager; -import org.apache.commons.codec.binary.Base64; - -import javax.crypto.*; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.*; -import java.io.*; -import java.math.BigInteger; -import java.net.*; -import java.security.*; -import java.security.cert.CertificateException; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.X509EncodedKeySpec; -import java.util.HashMap; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class b { - private KeyPair a; - private String b; - private final ProgressManager.ProgressBar p; - - public String c() { - return b; - } - - private KeyPair a() { - KeyPairGenerator a = null; - try { - a = KeyPairGenerator.getInstance("RSA"); - } catch (NoSuchAlgorithmException b) { } - a.initialize(1024); - this.a = a.generateKeyPair(); - return this.a; - } - - private PublicKey d; - private PublicKey e() throws NoSuchAlgorithmException, InvalidKeySpecException { - if (d != null) return d; - X509EncodedKeySpec spec = new X509EncodedKeySpec(Base64.decodeBase64("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxO89qtwG67jNucQ9Y44c" + - "IUs/B+5BeJPs7G+RG2gfs4/2+tzF/c1FLDc33M7yKw8aKk99vsBUY9Oo8gxxiEPB" + - "JitP/qfon2THp94oM77ZTpHlmFoqbZMcKGZVI8yfvEL4laTM8Hw+qh5poQwtpEbK" + - "Xo47AkxygxJasUnykER2+aSTZ6kWU2D4xiNtFA6lzqN+/oA+NaYfPS0amAvyVlHR" + - "n/8IuGkxb5RrlqVssQstFnxsJuv88qdGSEqlcKq2tLeg9hb8eCnl2OFzvXmgbVER" + - "0JaV+4Z02fVG1IlR3Xo1mSit7yIU6++3usRCjx2yfXpnGGJUW5pe6YETjNew3ax+" + - "FAZ4GePWCdmS7FvBnbbABKo5pE06ZTfDUTCjQlAJQiUgoF6ntMJvQAXPu48Vr8q/" + - "mTcuZWVnI6CDgyE7nNq3WNoq3397sBzxRohMxuqzl3T19zkfPKF05iV2Ju1HQMW5" + - "I119bYrmVD240aGESZc20Sx/9g1BFpNzQbM5PGUlWJ0dhLjl2ge4ip2hHciY3OEY" + - "p2Qy2k+xEdenpKdL+WMRimCQoO9gWe2Tp4NmP5dppDXZgPjXqjZpnGs0Uxs+fXqW" + - "cwlg3MbX3rFl9so/fhVf4p9oXZK3ve7z5D6XSSDRYECvsKIa08WAxJ/U6n204E/4" + - "xUF+3ZgFPdzZGn2PU7SsnOsCAwEAAQ==")); - return d = KeyFactory.getInstance("RSA").generatePublic(spec); - } - - public b(ProgressManager.ProgressBar p) { - this.p = p; - p.step("Generating KeyPair"); - a(); - } - - public String b(String e) throws IOException, AuthenticationException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException, CertificateException, KeyStoreException, KeyManagementException, InvalidKeySpecException, SignatureException { - Session a = Minecraft.getMinecraft().getSession(); - String b = a.getToken(); - - p.step("Authenticating (1/2)"); - String c = a(a.getProfile()); - MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); - JsonObject d = a(c); - String hash = a(Base64.decodeBase64(d.get("sharedSecret").getAsString()), - Base64.decodeBase64(d.get("publicKey").getAsString())); - yggdrasilMinecraftSessionService.joinServer(a.getProfile(), b, hash); - p.step("Authenticating (2/2)"); - this.b = a(c, this.a.getPublic()); - try { - p.step("Downloading Jar"); - if (e != null) - b(this.b, "https://dungeons.guide/resource/version?v=" + e, true); - p.step("Downloading Rooms"); - b(this.b, "https://dungeons.guide/resource/roomdata", false); - } catch (Throwable t) { - t.printStackTrace(); - } - return this.b; - } - - public JsonObject a(String c) { - String a = c.split("\\.")[1].replace("+", "-").replace("/", "_"); - String b = new String(Base64.decodeBase64(a)); // padding - return (JsonObject) new JsonParser().parse(b); - } - - - - private String a(GameProfile d) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, KeyManagementException { - HttpsURLConnection a = (HttpsURLConnection) new URL("https://dungeons.guide/auth/requestAuth").openConnection(); - a.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - a.setRequestProperty("Content-Type", "application/json"); - a.setRequestMethod("POST"); - a.setDoInput(true); - a.setDoOutput(true); - - a.getOutputStream().write(("{\"uuid\":\""+d.getId().toString()+"\",\"nickname\":\""+d.getName()+"\"}").getBytes()); - InputStreamReader b = new InputStreamReader(a.getInputStream()); - JsonObject c = (JsonObject) new JsonParser().parse(b); - if (!"ok".equals(c.get("status").getAsString())) { - return null; - } - return c.get("data").getAsString(); - } - private String a(String a, PublicKey b) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException, KeyManagementException { - HttpsURLConnection c = (HttpsURLConnection) new URL("https://dungeons.guide/auth/authenticate").openConnection(); - c.setRequestMethod("POST"); - c.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - c.setRequestProperty("Content-Type", "application/json"); - c.setDoInput(true); - c.setDoOutput(true); - - c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+Base64.encodeBase64URLSafeString(b.getEncoded())+"\"}").getBytes()); - c.getResponseCode(); - InputStreamReader d = new InputStreamReader(c.getInputStream()); - JsonObject e = (JsonObject) new JsonParser().parse(d); - if (!"ok".equals(e.get("status").getAsString())) { - return null; - } - return e.get("data").getAsString(); - } - - private final HashMap c = new HashMap(); - - public HashMap d() { - return c; - } - - private void b(String a, String u, boolean v) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException, SignatureException, InvalidKeySpecException { - HttpsURLConnection b = (HttpsURLConnection) new URL(u).openConnection(); - b.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - b.setRequestProperty("Content-Type", "application/json"); - b.setRequestMethod("GET"); - b.setRequestProperty("Authorization", a); - b.setDoInput(true); - b.setDoOutput(true); - - InputStream c = b.getInputStream(); - byte[] d = new byte[4]; - c.read(d); - int f = ((d[0] & 0xFF) << 24) | - ((d[1] & 0xFF) << 16) | - ((d[2] & 0xFF) << 8) | - ((d[3] & 0xFF)); - while (c.available() < f) ; - byte[] e = new byte[f]; - c.read(e); - - Cipher g = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - g.init(Cipher.DECRYPT_MODE, this.a.getPrivate()); - byte[] h = g.doFinal(e); - - g = Cipher.getInstance("AES/CBC/PKCS5Padding"); - SecretKeySpec i = new SecretKeySpec(h, "AES"); - IvParameterSpec j = new IvParameterSpec(h); - g.init(Cipher.DECRYPT_MODE, i, j); - CipherInputStream k = new CipherInputStream(c, g); - - k.read(d); - f = ((d[0] & 0xFF) << 24) | - ((d[1] & 0xFF) << 16) | - ((d[2] & 0xFF) << 8) | - ((d[3] & 0xFF)); - - int totalLen = f; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - byte[] buff = new byte[256]; - while (totalLen > 0) { - int len = k.read(buff, 0, Math.min(buff.length, totalLen)); - totalLen -= len; - bos.write(buff, 0, len); - } - byte[] payload = bos.toByteArray(); - - byte[] signed = null; - if (v) { - p.step("Validating Signature"); - k.read(d,0 , 4); - f = ((d[0] & 0xFF) << 24) | - ((d[1] & 0xFF) << 16) | - ((d[2] & 0xFF) << 8) | - ((d[3] & 0xFF)); - - totalLen = f; - bos = new ByteArrayOutputStream(); - while (totalLen > 0) { - int len = k.read(buff, 0, Math.min(buff.length, totalLen)); - totalLen -= len; - bos.write(buff, 0, len); - } - signed = bos.toByteArray(); - - Signature sign = Signature.getInstance("SHA512withRSA"); - sign.initVerify(e()); - sign.update(payload); - boolean truth = sign.verify(signed); - if (!truth) throw new SignatureException("DG SIGNATURE FORGED"); - } - - ZipInputStream l = new ZipInputStream(new ByteArrayInputStream(payload)); - ZipEntry m; - while ((m=l.getNextEntry()) != null) { - byte[] n = new byte[256]; - ByteArrayOutputStream o = new ByteArrayOutputStream(); - int p = 0; - while((p = l.read(n)) > 0) { - o.write(n, 0, p); - } - this.c.put(m.getName(), o.toByteArray()); - } - b.disconnect(); - } - - public JsonElement d(String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException { - HttpsURLConnection b = (HttpsURLConnection) new URL(u).openConnection(); - b.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - b.setRequestProperty("Content-Type", "application/json"); - b.setRequestMethod("GET"); - b.setRequestProperty("Authorization", this.b); - b.setDoInput(true); - b.setDoOutput(true); - - InputStream c = b.getInputStream(); - byte[] d = new byte[4]; - c.read(d); - int f = ((d[0] & 0xFF) << 24) | - ((d[1] & 0xFF) << 16) | - ((d[2] & 0xFF) << 8) | - ((d[3] & 0xFF)); - while (c.available() < f) ; - byte[] e = new byte[f]; - c.read(e); - - Cipher g = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - g.init(Cipher.DECRYPT_MODE, this.a.getPrivate()); - byte[] h = g.doFinal(e); - - g = Cipher.getInstance("AES/CBC/PKCS5Padding"); - SecretKeySpec i = new SecretKeySpec(h, "AES"); - IvParameterSpec j = new IvParameterSpec(h); - g.init(Cipher.DECRYPT_MODE, i, j); - CipherInputStream k = new CipherInputStream(c, g); - k.read(d); - f = ((d[0] & 0xFF) << 24) | - ((d[1] & 0xFF) << 16) | - ((d[2] & 0xFF) << 8) | - ((d[3] & 0xFF)); - JsonElement l = new JsonParser().parse(new InputStreamReader(k)); - b.disconnect(); - return l; - } - - public String a(byte[] a, byte[] b) throws NoSuchAlgorithmException { - MessageDigest c = MessageDigest.getInstance("SHA-1"); - c.update("".getBytes()); - c.update(a); - c.update(b); - byte[] d = c.digest(); - return new BigInteger(d).toString(16); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/c.java b/src/main/java/kr/syeyoung/dungeonsguide/c.java deleted file mode 100755 index ac4c80a5..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/c.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide; - -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -public interface c { - void init(FMLInitializationEvent event); - - void pre(FMLPreInitializationEvent event); -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index 8e70f191..ff86b083 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.commands; import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; @@ -27,7 +28,6 @@ import kr.syeyoung.dungeonsguide.dungeon.events.DungeonEventHolder; import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.DungeonLeftEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; @@ -74,11 +74,11 @@ public class CommandDungeonsGuide extends CommandBase { if (args.length == 0) { openConfig = true; } else if (args[0].equalsIgnoreCase("saverooms")) { - DungeonRoomInfoRegistry.saveAll(e.getDungeonsGuide().getConfigDir()); + DungeonRoomInfoRegistry.saveAll(DungeonsGuide.getDungeonsGuide().getConfigDir()); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully saved user generated roomdata")); } else if (args[0].equalsIgnoreCase("loadrooms")) { try { - DungeonRoomInfoRegistry.loadAll(e.getDungeonsGuide().getConfigDir()); + DungeonRoomInfoRegistry.loadAll(DungeonsGuide.getDungeonsGuide().getConfigDir()); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully loaded roomdatas")); return; } catch (BadPaddingException e) { @@ -124,11 +124,11 @@ public class CommandDungeonsGuide extends CommandBase { String serverBrand = Minecraft.getMinecraft().thePlayer.getClientBrand(); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + serverBrand)); } else if (args[0].equalsIgnoreCase("reparty")) { - e.getDungeonsGuide().getCommandReparty().requestReparty(); + DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(); } else if (args[0].equalsIgnoreCase("gui")) { openConfig = true; } else if (args[0].equalsIgnoreCase("info")) { - JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + JsonObject obj = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJwtPayload(DungeonsGuide.getDungeonsGuide().getAuthenticator().getToken()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fCurrent Plan§7: §e" + obj.get("plan").getAsString())); @@ -137,7 +137,7 @@ public class CommandDungeonsGuide extends CommandBase { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSession Expire§7: §e" + sdf.format(new Date(obj.get("exp").getAsLong() * 1000)))); } else if (args[0].equalsIgnoreCase("pathfind")) { try { - DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; if (thePlayer == null) return; if (context.getBossfightProcessor() != null) context.getBossfightProcessor().tick(); @@ -150,7 +150,7 @@ public class CommandDungeonsGuide extends CommandBase { t.printStackTrace(); } } else if (args[0].equals("process") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { - File root = e.getDungeonsGuide().getConfigDir(); + File root = DungeonsGuide.getDungeonsGuide().getConfigDir(); File dir = new File(root, "processorinput"); File outpuzzle = new File(root, "processoroutpuzzle"); File outsecret = new File(root, "processoroutsecret"); @@ -182,7 +182,7 @@ public class CommandDungeonsGuide extends CommandBase { } } } else if (args[0].equals("check") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { - File root = e.getDungeonsGuide().getConfigDir(); + File root = DungeonsGuide.getDungeonsGuide().getConfigDir(); for (File f : root.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { @@ -243,7 +243,7 @@ public class CommandDungeonsGuide extends CommandBase { } else if (args[0].equals("reloaddungeon") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")){ try { MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); - e.getDungeonsGuide().getSkyblockStatus().setContext(null); + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setContext(null); MapUtils.clearMap(); } catch (Throwable t) { t.printStackTrace(); @@ -316,16 +316,16 @@ public class CommandDungeonsGuide extends CommandBase { } else if (args[0].equals("partyid")) { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fInternal Party id: "+PartyManager.INSTANCE.getPartyID())); } else if (args[0].equalsIgnoreCase("loc")) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fYou're in "+e.getDungeonsGuide().getSkyblockStatus().getDungeonName())); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fYou're in "+ DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName())); } else if (args[0].equalsIgnoreCase("saverun")) { try { - File f = e.getDungeonsGuide().getConfigDir(); + File f = DungeonsGuide.getDungeonsGuide().getConfigDir(); File runDir = new File(f, "dungeonruns"); runDir.mkdirs(); File runFile = new File(runDir, UUID.randomUUID() +".dgrun"); - DungeonContext dungeonContext = e.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext dungeonContext = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); if (dungeonContext == null) { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find dungeon to save!")); return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/a.java b/src/main/java/kr/syeyoung/dungeonsguide/d/a.java deleted file mode 100755 index 1e9e5c42..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/d/a.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.d; - -import kr.syeyoung.dungeonsguide.b; - -import java.io.*; -import java.net.URL; -import java.net.URLConnection; - -public class a extends URLConnection { - private final b a; - protected a(URL b, b a) { - super(b); - connected = false; - this.a = a; - } - - @Override - public void connect() throws IOException { - } - @Override - public InputStream getInputStream() throws IOException { - if (a != null) { - String path = url.getPath().substring(1); - if (!a.d().containsKey(path)) throw new FileNotFoundException(); - return new ByteArrayInputStream(a.d().get(path)); - } else if (url.getPath().contains("roomdata")){ - return a.class.getResourceAsStream(url.getPath()); - } - throw new FileNotFoundException(); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/b.java b/src/main/java/kr/syeyoung/dungeonsguide/d/b.java deleted file mode 100755 index f851a72d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/d/b.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.d; - -import lombok.AllArgsConstructor; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; - -@AllArgsConstructor -public class b extends URLStreamHandler { - private final kr.syeyoung.dungeonsguide.b a; - @Override - protected URLConnection openConnection(URL a) throws IOException { - return new a(a, this.a); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/d/c.java b/src/main/java/kr/syeyoung/dungeonsguide/d/c.java deleted file mode 100755 index 2b16bfa2..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/d/c.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.d; - -import lombok.AllArgsConstructor; - -import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; - -@AllArgsConstructor -public class c implements URLStreamHandlerFactory { - private final kr.syeyoung.dungeonsguide.b a; - @Override - public URLStreamHandler createURLStreamHandler(String a) { - if ("z".equals(a)) { - return new b(this.a); - } - return null; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java index d293c3af..026be921 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java @@ -18,12 +18,11 @@ package kr.syeyoung.dungeonsguide.dungeon; -import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.events.*; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.BossroomEnterEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureDungeonMap; @@ -108,9 +107,9 @@ public class DungeonContext { this.world = world; createEvent(new DungeonNodataEvent("DUNGEON_CONTEXT_CREATION")); mapProcessor = new MapProcessor(this); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder != null) - trapRoomGen = doorFinder.isTrapSpawn(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + trapRoomGen = doorFinder.isTrapSpawn(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); else mapProcessor.setBugged(true); init = System.currentTimeMillis(); } @@ -130,11 +129,11 @@ public class DungeonContext { bossroomSpawnPos = Minecraft.getMinecraft().thePlayer.getPosition(); MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent()); createEvent(new DungeonNodataEvent("BOSSROOM_ENTER")); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder != null) { - bossfightProcessor = doorFinder.createBossfightProcessor(world, e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + bossfightProcessor = doorFinder.createBossfightProcessor(world, DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); } else { - e.sendDebugChat(new ChatComponentText("Error:: Null Data Providier")); + DungeonsGuide.sendDebugChat(new ChatComponentText("Error:: Null Data Providier")); } } List list = FeatureDungeonMap.field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); @@ -176,7 +175,7 @@ public class DungeonContext { int z = Integer.parseInt(coords.split("/")[1]); int secrets2 = Integer.parseInt(secrets); Point roomPt = mapProcessor.worldPointToRoomPoint(new BlockPos(x,70,z)); - e.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: "+roomPt.x+" / " + roomPt.y + " total secrets "+secrets2)); + DungeonsGuide.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: "+roomPt.x+" / " + roomPt.y + " total secrets "+secrets2)); DungeonRoom dr = roomMapper.get(roomPt); if (dr != null) { dr.setTotalSecrets(secrets2); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index d6a37d7d..a86a5326 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -19,14 +19,12 @@ package kr.syeyoung.dungeonsguide.dungeon; import com.google.common.collect.BiMap; -import com.google.common.collect.EnumHashBiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; @@ -145,26 +143,26 @@ public class MapProcessor { } // determine door location based on npc, and determine map min from there { - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (doorFinder == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find door processor for "+e.getDungeonsGuide().getSkyblockStatus().getDungeonName())); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find door processor for "+ DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName())); bugged = true; return; } - BlockPos door = doorFinder.findDoor(context.getWorld(), e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + BlockPos door = doorFinder.findDoor(context.getWorld(), DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); if (door == null) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't determine door of the room, disabling mod for this dungeon run")); bugged = true; return; } - e.sendDebugChat(new ChatComponentText("door Pos:"+door)); + DungeonsGuide.sendDebugChat(new ChatComponentText("door Pos:"+door)); Point unitPoint = mapPointToRoomPoint(startroom); unitPoint.translate(unitPoint.x + 1, unitPoint.y + 1); unitPoint.translate((int)doorDir.x, (int)doorDir.y); - Vector2d offset = doorFinder.findDoorOffset(context.getWorld(), e.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + Vector2d offset = doorFinder.findDoorOffset(context.getWorld(), DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); axisMatch = doorDir.equals(offset); int worldX = unitPoint.x * 16; @@ -174,12 +172,12 @@ public class MapProcessor { } - e.sendDebugChat(new ChatComponentText("Found Green room:"+startroom)); - e.sendDebugChat(new ChatComponentText("Axis match:"+axisMatch)); - e.sendDebugChat(new ChatComponentText("World Min:"+context.getDungeonMin())); - e.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension)); - e.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint)); - e.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension)); + DungeonsGuide.sendDebugChat(new ChatComponentText("Found Green room:"+startroom)); + DungeonsGuide.sendDebugChat(new ChatComponentText("Axis match:"+axisMatch)); + DungeonsGuide.sendDebugChat(new ChatComponentText("World Min:"+context.getDungeonMin())); + DungeonsGuide.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension)); + DungeonsGuide.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint)); + DungeonsGuide.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension)); context.createEvent(new DungeonNodataEvent("MAP_PROCESSOR_INIT")); initialized = true; MinecraftForge.EVENT_BUS.post(new DungeonContextInitializationEvent()); @@ -253,8 +251,8 @@ public class MapProcessor { DungeonRoom rooms = buildRoom(mapData, new Point(x,y)); if (rooms == null) continue; context.createEvent(new DungeonRoomDiscoverEvent(rooms.getUnitPoints().get(0), rooms.getRoomMatcher().getRotation(), rooms.getMin(), rooms.getShape(),rooms.getColor(), rooms.getDungeonRoomInfo().getUuid(), rooms.getDungeonRoomInfo().getName(), rooms.getDungeonRoomInfo().getProcessorId())); - e.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y)); - e.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin() + " mapMx: "+rooms.getMax())); + DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y)); + DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin() + " mapMx: "+rooms.getMax())); StringBuilder builder = new StringBuilder(); for (int dy =0;dy<4;dy++) { builder.append("\n"); @@ -263,7 +261,7 @@ public class MapProcessor { builder.append(isSet ? "O" : "X"); } } - e.sendDebugChat(new ChatComponentText("Shape visual: "+ builder)); + DungeonsGuide.sendDebugChat(new ChatComponentText("Shape visual: "+ builder)); context.getDungeonRoomList().add(rooms); for (Point p:rooms.getUnitPoints()) { @@ -318,7 +316,7 @@ public class MapProcessor { try{ return new DungeonRoom(ayConnected, shape, unit1, roomPointToWorldPoint(new Point(minX, minY)), roomPointToWorldPoint(new Point(maxX+1, maxY+1)).add(-1, 0, -1), context); } catch (IllegalStateException ex) { - e.sendDebugChat(new ChatComponentText("Failed to load room, retrying later :: "+ex.getLocalizedMessage())); + DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to load room, retrying later :: "+ex.getLocalizedMessage())); return null; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 952e041f..79277c98 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -20,7 +20,7 @@ package kr.syeyoung.dungeonsguide.dungeon.doorfinder; import com.google.common.base.Predicate; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.*; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; @@ -92,7 +92,7 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { @Override public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { String floor = dungeonName.substring(14).trim(); - e.sendDebugChat(new ChatComponentText("Floor: "+floor+ " Building bossfight processor")); + DungeonsGuide.sendDebugChat(new ChatComponentText("Floor: "+floor+ " Building bossfight processor")); if (floor.equals("F1")) { return new BossfightProcessorBonzo(); } else if (floor.equals("F2")) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java index 6ea8d6ce..54c8f3dd 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java @@ -20,7 +20,7 @@ package kr.syeyoung.dungeonsguide.dungeon.doorfinder; import com.google.common.base.Predicate; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.*; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; @@ -92,7 +92,7 @@ public class CatacombMasterDataProvider implements DungeonSpecificDataProvider { @Override public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { String floor = dungeonName.substring(14).trim(); - e.sendDebugChat(new ChatComponentText("Floor: Master mode "+floor+ " Building bossfight processor")); + DungeonsGuide.sendDebugChat(new ChatComponentText("Floor: Master mode "+floor+ " Building bossfight processor")); return null; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java index 78765bd9..2bdc4206 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -19,7 +19,6 @@ package kr.syeyoung.dungeonsguide.dungeon.roomfinder; import com.google.common.io.Files; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import net.minecraft.client.Minecraft; import org.apache.commons.io.IOUtils; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java deleted file mode 100755 index 226195f5..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide; - -import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.commands.*; -import kr.syeyoung.dungeonsguide.config.Config; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.eventlistener.DungeonListener; -import kr.syeyoung.dungeonsguide.eventlistener.FeatureListener; -import kr.syeyoung.dungeonsguide.eventlistener.PacketListener; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.party.PartyInviteViewer; -import kr.syeyoung.dungeonsguide.party.PartyManager; -import kr.syeyoung.dungeonsguide.resources.DGTexturePack; -import kr.syeyoung.dungeonsguide.stomp.CloseListener; -import kr.syeyoung.dungeonsguide.stomp.StompClient; -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResourcePack; -import net.minecraft.command.ICommand; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraft.launchwrapper.LogWrapper; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.common.ProgressManager; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.ReflectionHelper; -import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.LogManager; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.io.*; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -public class e implements c, CloseListener { - - private SkyblockStatus skyblockStatus; - - private static e dungeonsGuide; - - - @Getter - private final b authenticator; - - @Getter - private StompInterface stompConnection; - - public e(b authenticator) { - this.authenticator = authenticator; - } - - public static void sendDebugChat(IChatComponent iChatComponent) { - if (FeatureRegistry.DEBUG.isEnabled()) - Minecraft.getMinecraft().thePlayer.addChatMessage(iChatComponent); - } - @Getter - CommandReparty commandReparty; - - - private final String stompURL = "wss://dungeons.guide/ws"; -// private String stompURL = "ws://localhost/ws"; - public void init(FMLInitializationEvent event) { - ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4); - - - try { - Set invalid = ReflectionHelper.getPrivateValue(LaunchClassLoader.class, (LaunchClassLoader) a.class.getClassLoader(), "invalidClasses"); - ((LaunchClassLoader)a.class.getClassLoader()).clearNegativeEntries(Sets.newHashSet("org.slf4j.LoggerFactory")); - for (String s : invalid) { - System.out.println(s+" in invalid"); - } - invalid.clear(); - } catch (Throwable t) { - t.printStackTrace(); - } - - progressbar.step("Registering Events & Commands"); - dungeonsGuide = this; - skyblockStatus = new SkyblockStatus(); - - CommandDungeonsGuide commandDungeonsGuide; - MinecraftForge.EVENT_BUS.register(new DungeonListener()); - ClientCommandHandler.instance.registerCommand(commandDungeonsGuide = new CommandDungeonsGuide()); - MinecraftForge.EVENT_BUS.register(commandDungeonsGuide); - - commandReparty = new CommandReparty(); - if (FeatureRegistry.ETC_REPARTY.isEnabled()) - ClientCommandHandler.instance.registerCommand(commandReparty); - - MinecraftForge.EVENT_BUS.register(commandReparty); - MinecraftForge.EVENT_BUS.register(new FeatureListener()); - MinecraftForge.EVENT_BUS.register(new PacketListener()); - MinecraftForge.EVENT_BUS.register(new Keybinds()); - - RichPresenceManager.INSTANCE.setup(); - MinecraftForge.EVENT_BUS.register(RichPresenceManager.INSTANCE); - MinecraftForge.EVENT_BUS.register(PartyManager.INSTANCE); - MinecraftForge.EVENT_BUS.register(PartyInviteViewer.INSTANCE); - - AhUtils.registerTimer(); - - progressbar.step("Downloading Roomdatas"); - try { - DungeonRoomInfoRegistry.loadAll(configDir); - } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | IOException | NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } - Keybinds.register(); - - progressbar.step("Opening connection"); - try { - stompConnection = new StompClient(new URI(stompURL), authenticator.c(), this); - MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); - } catch (Exception e) { - throw new RuntimeException(e); - } - - - progressbar.step("Loading Config"); - try { - Config.loadConfig( null ); - } catch (IOException e) { - e.printStackTrace(); - } - - - ProgressManager.pop(progressbar); - } - public void pre(FMLPreInitializationEvent event) { - configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide"); - File configFile = new File(configDir, "config.json"); - if (!configFile.exists()) { - configDir.mkdirs(); - } - Config.f = configFile; - Minecraft.getMinecraft().getFramebuffer().enableStencil(); - - try { - List resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(),"defaultResourcePacks", "aA", "field_110449_ao"); - resourcePackList.add(new DGTexturePack(authenticator)); - } catch (Throwable t){ - t.printStackTrace(); - } - } - private void copy(InputStream inputStream, File f) throws IOException { - FileOutputStream fos = new FileOutputStream(f); - IOUtils.copy(inputStream, fos); - fos.flush(); - fos.close(); - inputStream.close(); - } - - private void combineConfig(Configuration saved, Configuration newest) { - } - - @Getter - private File configDir; - - - public SkyblockStatus getSkyblockStatus() { - return skyblockStatus; - } - - public static e getDungeonsGuide() { - return dungeonsGuide; - } - ScheduledExecutorService ex = Executors.newScheduledThreadPool(2); - @Override - public void onClose(int code, String reason, boolean remote) { - System.out.println("Stomp Connection closed, trying to reconnect - "+reason+ " - "+code); - connectStomp(); - } - - public void connectStomp() { - ex.schedule(new Runnable() { - @Override - public void run() { - try { - stompConnection = new StompClient(new URI(stompURL), authenticator.c(), e.this); - MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); - } catch (Exception e) { - e.printStackTrace(); - } - } - }, 5L, TimeUnit.SECONDS); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 438d58aa..90d3f537 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.eventlistener; import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.Keybinds; import kr.syeyoung.dungeonsguide.SkyblockStatus; @@ -26,7 +27,6 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.*; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; @@ -85,7 +85,7 @@ public class DungeonListener { @SubscribeEvent public void onPostDraw(GuiScreenEvent.DrawScreenEvent.Post e) { try { - SkyblockStatus skyblockStatus = kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; @@ -107,7 +107,7 @@ public class DungeonListener { @SubscribeEvent public void onEntityUpdate(LivingEvent.LivingUpdateEvent e) { try { - SkyblockStatus skyblockStatus = kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; @@ -133,7 +133,7 @@ public class DungeonListener { if (ev.phase == TickEvent.Phase.START) { - JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + JsonObject obj = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJwtPayload(DungeonsGuide.getDungeonsGuide().getAuthenticator().getToken()); if (!obj.get("uuid").getAsString().equals(Minecraft.getMinecraft().getSession().getProfile().getId().toString())) { if (Minecraft.getMinecraft().currentScreen instanceof GuiErrorScreen) return; @@ -168,7 +168,7 @@ public class DungeonListener { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); { boolean isOnDungeon = skyblockStatus.isOnDungeon(); boolean isOnSkyblock = skyblockStatus.isOnSkyblock(); @@ -227,7 +227,7 @@ public class DungeonListener { try { if (postRender.type != RenderGameOverlayEvent.ElementType.TEXT) return; - JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + JsonObject obj = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJwtPayload(DungeonsGuide.getDungeonsGuide().getAuthenticator().getToken()); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; if (obj.get("plan").getAsString().equalsIgnoreCase("TRIAL")) { fr.drawString("Using trial Version of Dungeons Guide", 0,0, 0xFFFFFFFF); @@ -235,7 +235,7 @@ public class DungeonListener { } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; if (skyblockStatus.getContext() != null) { @@ -261,7 +261,7 @@ public class DungeonListener { @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST) public void onChatReceived(ClientChatReceivedEvent clientChatReceivedEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; if (clientChatReceivedEvent.type != 2 && clientChatReceivedEvent.message.getFormattedText().contains("§6> §e§lEXTRA STATS §6<")) { @@ -322,7 +322,7 @@ public class DungeonListener { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent renderWorldLastEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); @@ -378,7 +378,7 @@ public class DungeonListener { @SubscribeEvent() public void onKey2(InputEvent.KeyInputEvent keyInputEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); @@ -409,7 +409,7 @@ public class DungeonListener { @SubscribeEvent() public void onInteract(PlayerInteractEntityEvent interact) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); @@ -443,7 +443,7 @@ public class DungeonListener { if (FeatureRegistry.DEBUG.isEnabled() && FeatureRegistry.ADVANCED_ROOMEDIT.isEnabled() && Keybinds.editingSession.isKeyDown() ){ EditingContext ec = EditingContext.getEditingContext(); if (ec == null) { - DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); if (context == null) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Not in dungeons")); return; @@ -470,7 +470,7 @@ public class DungeonListener { @SubscribeEvent public void onInteract(PlayerInteractEvent keyInputEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); @@ -513,7 +513,7 @@ public class DungeonListener { DungeonActionManager.getKilleds().add(deathEvent.entity.getEntityId()); try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; DungeonContext context = skyblockStatus.getContext(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index f5aa70c8..971d7ca9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -18,40 +18,22 @@ package kr.syeyoung.dungeonsguide.eventlistener; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.*; import kr.syeyoung.dungeonsguide.features.*; import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.util.*; import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.InputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; public class FeatureListener { @SubscribeEvent @@ -60,7 +42,7 @@ public class FeatureListener { boolean isLocConfig = Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig; if (postRender.type != RenderGameOverlayEvent.ElementType.ALL) return; - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -88,7 +70,7 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderLivingEvent.Pre preRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -104,7 +86,7 @@ public class FeatureListener { @SubscribeEvent public void onSound(PlaySoundEvent soundEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -120,7 +102,7 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderLivingEvent.Post preRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -135,7 +117,7 @@ public class FeatureListener { @SubscribeEvent public void onRender(TitleEvent titleEvent) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -150,7 +132,7 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderPlayerEvent.Pre preRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -165,7 +147,7 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderPlayerEvent.Post preRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -182,7 +164,7 @@ public class FeatureListener { @SubscribeEvent public void onRenderWorld(RenderWorldLastEvent postRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -197,7 +179,7 @@ public class FeatureListener { @SubscribeEvent public void onInteract(PlayerInteractEvent postRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -214,7 +196,7 @@ public class FeatureListener { @SubscribeEvent public void onRenderWorld(ClientChatReceivedEvent postRender) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -243,7 +225,7 @@ public class FeatureListener { @SubscribeEvent public void dungeonTooltip(ItemTooltipEvent event) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -260,7 +242,7 @@ public class FeatureListener { public void onTick(TickEvent.ClientTickEvent tick) { if (tick.phase == TickEvent.Phase.END && tick.type == TickEvent.Type.CLIENT ) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -276,7 +258,7 @@ public class FeatureListener { @SubscribeEvent public void onGuiOpen(GuiOpenEvent tick) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -291,7 +273,7 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post render) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -307,7 +289,7 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Pre render) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -323,7 +305,7 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent render) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { @@ -340,7 +322,7 @@ public class FeatureListener { @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGH) public void onGuiEvent(GuiScreenEvent.MouseInputEvent.Pre input) { try { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java index 554e0a46..a05cedce 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java @@ -23,7 +23,7 @@ import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.events.TitleEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; @@ -33,15 +33,12 @@ import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; import net.minecraft.network.play.server.S45PacketTitle; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.EventBus; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; -import java.lang.reflect.Field; - @ChannelHandler.Sharable public class PacketListener extends ChannelDuplexHandler { - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java index 48751c3c..d474f62c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java @@ -18,25 +18,19 @@ package kr.syeyoung.dungeonsguide.features.impl.advanced; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.utils.MapUtils; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.util.ResourceLocation; -import org.apache.commons.lang3.StringUtils; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -51,7 +45,7 @@ public class FeatureDebuggableMap extends GuiFeature { DynamicTexture dynamicTexture = new DynamicTexture(128, 128); ResourceLocation location = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation("dungeons/map/", dynamicTexture); - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawHUD(float partialTicks) { if (!skyblockStatus.isOnDungeon()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java index 95cabd87..307927aa 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java @@ -22,17 +22,14 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import org.apache.commons.lang3.StringUtils; import java.awt.*; @@ -43,7 +40,7 @@ public class FeatureRoomCoordDisplay extends GuiFeature { parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.yellow, "color")); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final String[] facing = {"Z+", "X-", "Z-", "X+"}; @Override public void drawHUD(float partialTicks) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java index d107cf32..df5a0f51 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java @@ -21,23 +21,16 @@ package kr.syeyoung.dungeonsguide.features.impl.advanced; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; import org.apache.commons.lang3.StringUtils; import java.awt.*; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; public class FeatureRoomDebugInfo extends GuiFeature { public FeatureRoomDebugInfo() { @@ -46,7 +39,7 @@ public class FeatureRoomDebugInfo extends GuiFeature { parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.white, "color")); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawHUD(float partialTicks) { if (!skyblockStatus.isOnDungeon()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java index 3321c6c4..992802c2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java @@ -18,24 +18,9 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.opengl.GL11; public class FeatureAutoReparty extends SimpleFeature implements DungeonQuitListener { public FeatureAutoReparty() { @@ -44,6 +29,6 @@ public class FeatureAutoReparty extends SimpleFeature implements DungeonQuitList @Override public void onDungeonQuit() { - if (isEnabled()) e.getDungeonsGuide().getCommandReparty().requestReparty(); + if (isEnabled()) DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java index 35d9d129..f8cd2257 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java @@ -18,31 +18,19 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData; import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import java.awt.*; -import java.awt.font.TextHitInfo; import java.util.ArrayList; import java.util.Arrays; -import java.util.Map; -import java.util.regex.Matcher; import java.util.List; -import java.util.regex.Pattern; public class FeatureBossHealth extends TextHUDFeature { public FeatureBossHealth() { @@ -59,7 +47,7 @@ public class FeatureBossHealth extends TextHUDFeature { getStyles().add(new TextStyle("maxHealth", new AColor(0x55, 0x55,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java index 7bb306e9..51d649eb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java @@ -18,24 +18,16 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; -import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.awt.*; -import java.util.List; public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderListener { @@ -45,7 +37,7 @@ public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderLis } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java index 9fef5a6c..f6c61608 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java @@ -18,11 +18,10 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -49,7 +48,7 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) { if (!isEnabled()) return; if (!(rendered.gui instanceof GuiChest)) return; - if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; GlStateManager.disableLighting(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java index 56ec8285..502229fe 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java @@ -20,12 +20,10 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; import java.util.ArrayList; import java.util.Arrays; @@ -40,7 +38,7 @@ public class FeatureCurrentPhase extends TextHUDFeature { getStyles().add(new TextStyle("phase", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final List dummyText= new ArrayList(); static { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java index c1f2fad9..4bd2d4e8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java @@ -18,20 +18,13 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.entity.Entity; import net.minecraft.entity.passive.*; -import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.client.event.RenderLivingEvent; @@ -46,7 +39,7 @@ public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRen } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java index d7404448..6a705499 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java @@ -20,12 +20,11 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorSadan; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.entity.boss.BossStatus; @@ -42,7 +41,7 @@ public class FeatureTerracotaTimer extends TextHUDFeature { getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final List dummyText= new ArrayList(); static { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java index 16d78188..c7365386 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java @@ -20,19 +20,12 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.gui.FontRenderer; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -47,7 +40,7 @@ public class FeatureThornBearPercentage extends TextHUDFeature { getStyles().add(new TextStyle("unit", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final java.util.List dummyText= new ArrayList(); static { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java index 6f2d5987..4c9bfd2b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java @@ -18,9 +18,9 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.listener.TitleListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; @@ -43,7 +43,7 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final List dummyText= new ArrayList(); static { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java index cf30dbe8..0242cfc6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java @@ -19,13 +19,13 @@ package kr.syeyoung.dungeonsguide.features.impl.boss; import com.google.common.base.Supplier; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; import kr.syeyoung.dungeonsguide.config.guiconfig.PanelDefaultParameterConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.SimpleFeature; @@ -97,7 +97,7 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP return dummyText; } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public List getText() { ArrayList texts = new ArrayList(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java index 1366b55f..74f6d948 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java @@ -18,9 +18,9 @@ package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.InteractListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; @@ -42,7 +42,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender super("Bossfight","Simon Says Solver","Solver for Simon says puzzle", "bossfight.simonsays2"); } - private final SkyblockStatus ss = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus ss = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private final List orderbuild = new ArrayList(); private final LinkedList orderclick = new LinkedList(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java index 517b1d51..a7c58ea4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java @@ -19,16 +19,14 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import com.google.common.base.Predicate; -import com.google.common.base.Predicates; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.Nullable; @@ -44,7 +42,7 @@ public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java index e8192e57..5020edc6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java @@ -21,18 +21,16 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.Nullable; -import java.awt.*; import java.util.List; @@ -44,7 +42,7 @@ public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderL } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java index 4efbdae9..992051bb 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java @@ -19,9 +19,9 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; @@ -31,7 +31,6 @@ import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.BlockPos; import org.jetbrains.annotations.Nullable; -import java.awt.*; import java.util.List; @@ -43,7 +42,7 @@ public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderList } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java index 16d29af6..df6553e4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java @@ -20,21 +20,13 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -50,7 +42,7 @@ public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements getStyles().add(new TextStyle("totalSecrets", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final List dummyText= new ArrayList(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java index be7dad61..58f6e83a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java @@ -18,31 +18,22 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonDeathEvent; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.*; import java.util.List; import java.util.regex.Matcher; @@ -59,7 +50,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener getStyles().add(new TextStyle("totalDeaths", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean isHUDViewable() { if (!skyblockStatus.isOnDungeon()) return false; @@ -162,7 +153,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener int deaths = context.getDeaths().getOrDefault(nickname, 0); context.getDeaths().put(nickname, deaths + 1); context.createEvent(new DungeonDeathEvent(nickname, txt, deaths)); - e.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); + DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); } Matcher m2 = meDeathPattern.matcher(txt); if (m2.matches()) { @@ -170,7 +161,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener int deaths = context.getDeaths().getOrDefault(nickname, 0); context.getDeaths().put(nickname, deaths + 1); context.createEvent(new DungeonDeathEvent(Minecraft.getMinecraft().thePlayer.getName(), txt, deaths)); - e.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); + DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java index e08c38f9..7a0aafb5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java @@ -20,13 +20,12 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; -import com.mojang.authlib.GameProfile; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.*; @@ -36,25 +35,20 @@ import net.minecraft.block.material.MapColor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiPlayerTabOverlay; -import net.minecraft.client.gui.MapItemRenderer; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec4b; import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.MapData; -import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -62,9 +56,6 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.List; import java.util.Comparator; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { public FeatureDungeonMap() { @@ -85,7 +76,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, parameters.put("player_color", new FeatureParameter("player_color", "Color of the player border", "Same as name", new AColor(255,255,255,0), "acolor")); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public static final Ordering field_175252_a = Ordering.from(new PlayerComparator()); private boolean on = false; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java index dfa602c8..dd3a8a50 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java @@ -21,26 +21,19 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -55,7 +48,7 @@ public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListe getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final List dummyText= new ArrayList(); static { @@ -110,7 +103,7 @@ public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListe TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()), TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) }); - e.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); + DungeonsGuide.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java index f074f060..0718ab0f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java @@ -18,29 +18,14 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; -import java.awt.*; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java index b01cdc24..baef5de6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java @@ -18,28 +18,19 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.events.DungeonEndedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -47,7 +38,7 @@ import java.util.List; public class FeatureDungeonSBTime extends TextHUDFeature { - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public FeatureDungeonSBTime() { super("Dungeon", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java index 2490b13c..35371d96 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java @@ -18,15 +18,14 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; @@ -39,15 +38,10 @@ import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -69,7 +63,7 @@ public class FeatureDungeonScore extends TextHUDFeature implements StompConnecte getStyles().add(new TextStyle("required", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean isHUDViewable() { return skyblockStatus.isOnDungeon(); @@ -297,7 +291,7 @@ public class FeatureDungeonScore extends TextHUDFeature implements StompConnecte { double timeModifier; int timeModifierModifier = - e.getDungeonsGuide().getSkyblockStatus().getDungeonName().substring(14).trim().equals("F2") ? -120 : 0; + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName().substring(14).trim().equals("F2") ? -120 : 0; if (context.getBossRoomEnterSeconds() != -1) { timeModifier = Math.max(0, context.getBossRoomEnterSeconds() - timeModifierModifier); } else { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java index 5023f6ad..4c4ac44f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java @@ -22,30 +22,18 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.regex.Pattern; public class FeatureDungeonSecrets extends TextHUDFeature { public FeatureDungeonSecrets() { @@ -59,7 +47,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { getStyles().add(new TextStyle("unknown", new AColor(0xFF, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public int getSecretsFound() { for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java index 3e9510f1..cc0c0ea6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java @@ -20,21 +20,15 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -48,7 +42,7 @@ public class FeatureDungeonTombs extends TextHUDFeature { getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public int getTombsFound() { for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java index 8c64a6a4..130f3448 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java @@ -18,14 +18,11 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.entity.passive.*; import net.minecraftforge.client.event.RenderLivingEvent; @@ -35,7 +32,7 @@ public class FeatureHideNameTags extends SimpleFeature implements EntityLivingRe } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java index adb97fe9..16652d9e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java @@ -18,35 +18,19 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; -import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraftforge.client.event.RenderPlayerEvent; -import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; -import java.util.List; - public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListener { public FeaturePlayerESP() { @@ -55,7 +39,7 @@ public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListe } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private boolean preCalled = false; @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java index 7aa385ff..c2113120 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java @@ -18,7 +18,7 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice; @@ -30,7 +30,6 @@ import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.common.gameevent.InputEvent; public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements KeyInputListener, GuiClickListener { public FeaturePressAnyKeyToCloseChest() { @@ -42,7 +41,7 @@ public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements Key public void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent) { GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (!isEnabled()) return; - if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; if (screen instanceof GuiChest){ ContainerChest ch = (ContainerChest) ((GuiChest)screen).inventorySlots; @@ -66,7 +65,7 @@ public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements Key public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (!isEnabled()) return; - if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; if (screen instanceof GuiChest){ ContainerChest ch = (ContainerChest) ((GuiChest)screen).inventorySlots; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java index 574935c9..47de8d18 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java @@ -18,32 +18,20 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; -import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; -import org.lwjgl.opengl.GL11; -import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -61,7 +49,7 @@ public class FeatureWarnLowHealth extends TextHUDFeature { } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java index 5d942b2f..2fa1b763 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java @@ -21,22 +21,15 @@ package kr.syeyoung.dungeonsguide.features.impl.dungeon; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import java.awt.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -50,7 +43,7 @@ public class FeatureWatcherWarning extends TextHUDFeature implements ChatListene setEnabled(false); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean isHUDViewable() { return warning > System.currentTimeMillis(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java index 523b7701..14a49951 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java @@ -19,30 +19,19 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiOpenEvent; - -import java.awt.*; public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListener { public FeatureAutoAcceptReparty() { super("ETC", "Auto accept reparty", "Automatically accept reparty", "qol.autoacceptreparty", true); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private String lastDisband; @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java index 5c5e81a5..f42b724f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java @@ -18,20 +18,18 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.ContainerChest; import net.minecraftforge.client.event.GuiOpenEvent; -import org.lwjgl.opengl.GL11; import java.awt.*; @@ -60,7 +58,7 @@ public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitLis fr.drawString("Cooldown: 20s", 0,0,this.getParameter("color").getValue().getRGB()); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onDungeonQuit() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java index 53cc786b..11bf89ab 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java @@ -19,7 +19,7 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.SoundListener; @@ -32,7 +32,7 @@ public class FeatureDecreaseExplosionSound extends SimpleFeature implements Soun parameters.put("sound", new FeatureParameter("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, "float")); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onSound(PlaySoundEvent soundEvent) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java index 7ec59e5e..6092eb88 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java @@ -18,8 +18,8 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; @@ -61,7 +61,7 @@ public class FeatureDisableMessage extends SimpleFeature implements ChatListener } } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java index 39c8dbdd..102a53fa 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java @@ -18,27 +18,23 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderPlayerEvent; -import org.lwjgl.opengl.GL11; public class FeaturePenguins extends SimpleFeature implements PlayerRenderListener { @@ -47,7 +43,7 @@ public class FeaturePenguins extends SimpleFeature implements PlayerRenderListen } - private final SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private final ResourceLocation penguin = new ResourceLocation("dungeonsguide:penguin.png"); @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java index 6686a3f9..bd517b43 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java @@ -18,7 +18,6 @@ package kr.syeyoung.dungeonsguide.features.impl.etc; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener; @@ -30,9 +29,6 @@ import kr.syeyoung.dungeonsguide.stomp.StompSubscription; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; - public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, StompMessageHandler, TickListener { public FeatureUpdateAlarm() { super("ETC", "Update Alarm","Show a warning on chat when new update has bnee released.", "etc.updatealarm", true); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java index 3d41a76d..066c0b66 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java @@ -18,9 +18,9 @@ package kr.syeyoung.dungeonsguide.features.impl.etc.ability; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; @@ -40,7 +40,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListener, TickListener { - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public FeatureAbilityCooldown() { super("ETC", "View Ability Cooldowns", "A handy hud for viewing cooldown abilities", "etc.abilitycd2", false, 100, getFontRenderer().FONT_HEIGHT * 5); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java index 0fa8cd30..35606731 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java @@ -24,21 +24,13 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.actions.Action; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.AllArgsConstructor; -import lombok.Data; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.MathHelper; import java.awt.*; import java.util.ArrayList; @@ -60,7 +52,7 @@ public class FeatureActions extends TextHUDFeature { getStyles().add(new TextStyle("afterline", new AColor(0xAA, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean doesScaleWithHeight() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java index e4485218..f9016b15 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java @@ -18,30 +18,14 @@ package kr.syeyoung.dungeonsguide.features.impl.secret; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; public class FeatureFreezePathfind extends SimpleFeature { public FeatureFreezePathfind() { super("Secret", "Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move", "secret.freezepathfind", false); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index 84053952..864f6ce4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.features.impl.secret; import com.google.common.collect.Lists; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; @@ -26,7 +27,6 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; @@ -37,7 +37,6 @@ import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.*; @@ -73,7 +72,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis return this.getParameter("refreshrate").getValue(); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private UUID lastRoomUID = null; @Override public void drawHUD(float partialTicks) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java index f5824e17..43a97a01 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java @@ -18,42 +18,19 @@ package kr.syeyoung.dungeonsguide.features.impl.secret; -import com.google.common.collect.Lists; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiIngameMenu; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.MathHelper; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.*; @@ -66,7 +43,7 @@ public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListen getStyles().add(new TextStyle("warning", new AColor(0xFF, 0x69,0x17,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean isHUDViewable() { return warning > System.currentTimeMillis(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java index 61d53687..299e4b48 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java @@ -18,14 +18,7 @@ package kr.syeyoung.dungeonsguide.party; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.e; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.arikia.dev.drpc.DiscordRPC; import net.minecraft.client.Minecraft; @@ -34,18 +27,15 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; import javax.imageio.ImageIO; -import java.awt.*; import java.awt.image.BufferedImage; import java.net.HttpURLConnection; import java.net.URL; @@ -77,7 +67,7 @@ public class PartyInviteViewer { try { if (clientTickEvent.phase != TickEvent.Phase.START) return; List partyJoinRequestList = new ArrayList<>(); - boolean isOnHypixel = e.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); + boolean isOnHypixel = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); for (PartyJoinRequest joinRequest:joinRequests) { if (joinRequest.getTtl() != -1) { joinRequest.setTtl(joinRequest.getTtl() - 1); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java index aa5f2b70..f756eb08 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java @@ -19,10 +19,8 @@ package kr.syeyoung.dungeonsguide.party; import kr.syeyoung.dungeonsguide.RichPresenceManager; -import kr.syeyoung.dungeonsguide.commands.CommandReparty; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.events.HypixelJoinedEvent; -import kr.syeyoung.dungeonsguide.events.SkyblockJoinedEvent; import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; import kr.syeyoung.dungeonsguide.stomp.StompInterface; import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler; @@ -84,7 +82,7 @@ public class PartyManager implements StompMessageHandler { if (this.partyID != null && partyID == null) { JSONObject object = new JSONObject(); object.put("members", new JSONArray()); - StompInterface stompInterface = e.getDungeonsGuide().getStompConnection(); + StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); stompInterface.send(new StompPayload().payload(object.toString()).header("destination", "/app/party.join")); } @@ -109,7 +107,7 @@ public class PartyManager implements StompMessageHandler { if (partyID == null) { JSONObject object = new JSONObject(); object.put("members", new JSONArray()); - StompInterface stompInterface = e.getDungeonsGuide().getStompConnection(); + StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); stompInterface.send(new StompPayload().payload(object.toString()).header("destination", "/app/party.join")); } @@ -119,7 +117,7 @@ public class PartyManager implements StompMessageHandler { } this.askToJoinSecret = secretBuilder.toString(); - StompInterface stompInterface = e.getDungeonsGuide().getStompConnection(); + StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); stompInterface.send(new StompPayload().payload(new JSONObject().put("secret", askToJoinSecret).toString()).header("destination", "/app/party.setjoinsecret")); RichPresenceManager.INSTANCE.updatePresence(); } @@ -171,7 +169,7 @@ public class PartyManager implements StompMessageHandler { } JSONObject object = new JSONObject(); object.put("members", jsonArray); - StompInterface stompInterface = e.getDungeonsGuide().getStompConnection(); + StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); stompInterface.send(new StompPayload().payload(object.toString()).header("destination", "/app/party.join")); } if (checkPlayer == 3) { @@ -179,9 +177,9 @@ public class PartyManager implements StompMessageHandler { String playerName = theObject.getString("player"); String token = theObject.getString("token"); if (!members.contains(playerName)) { - e.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).header("destination", "/app/party.check.resp")); + DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).header("destination", "/app/party.check.resp")); } else { - e.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp")); + DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp")); } } if (invitedDash == 1 || invitedDash == 3) { @@ -362,7 +360,7 @@ public class PartyManager implements StompMessageHandler { } } } catch (Exception ex) {ex.printStackTrace(); - e.sendDebugChat(new ChatComponentText("ERRORRR!! on chat "+ ex));} + DungeonsGuide.sendDebugChat(new ChatComponentText("ERRORRR!! on chat "+ ex));} } @SubscribeEvent public void onTick(TickEvent.ClientTickEvent clientTickEvent) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java b/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java index 10224ec8..b9646993 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java @@ -18,9 +18,7 @@ package kr.syeyoung.dungeonsguide.resources; -import kr.syeyoung.dungeonsguide.a; -import kr.syeyoung.dungeonsguide.b; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.Authenticator; import lombok.AllArgsConstructor; import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.data.IMetadataSection; @@ -31,25 +29,24 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URL; import java.util.Collections; import java.util.Set; @AllArgsConstructor public class DGTexturePack implements IResourcePack { - private final b authenticator; + private final Authenticator authenticator; @Override public InputStream getInputStream(ResourceLocation location) throws IOException { InputStream inputStream = this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()); if (inputStream != null) return inputStream; - return new ByteArrayInputStream(authenticator.d().get("assets/dg/"+location.getResourcePath())); + return new ByteArrayInputStream(authenticator.getResources().get("assets/dg/"+location.getResourcePath())); } @Override public boolean resourceExists(ResourceLocation location) { - return authenticator.d().containsKey("assets/dg/"+location.getResourcePath()) + return authenticator.getResources().containsKey("assets/dg/"+location.getResourcePath()) || this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()) != null; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java index dcb924a0..1133a8a9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -18,9 +18,9 @@ package kr.syeyoung.dungeonsguide.roomedit.panes; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.*; @@ -28,7 +28,6 @@ import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; @@ -151,7 +150,7 @@ public class GeneralEditPane extends MPanel { try { NBTTagCompound nbtTagCompound2 = createNBT(); - File f=new File(e.getDungeonsGuide().getConfigDir(), "schematics/"+ + File f=new File(DungeonsGuide.getDungeonsGuide().getConfigDir(), "schematics/"+ dungeonRoom.getDungeonRoomInfo().getName()+"-"+dungeonRoom.getDungeonRoomInfo().getUuid().toString()+"-"+ UUID.randomUUID()+".schematic"); Method method = null; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 81c86cc1..d775aca4 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.Keybinds; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; @@ -27,7 +28,6 @@ import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; @@ -35,33 +35,23 @@ import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; import lombok.Getter; import lombok.Setter; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.passive.EntityBat; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.util.*; import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; -import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.*; -import java.util.List; public class GeneralRoomProcessor implements RoomProcessor { @@ -171,13 +161,13 @@ public class GeneralRoomProcessor implements RoomProcessor { private long secrets2 = 0; @Override public void actionbarReceived(IChatComponent chat) { - if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; if (dungeonRoom.getTotalSecrets() == -1) { - e.sendDebugChat(new ChatComponentText(chat.getFormattedText().replace('§', '&') + " - received")); + DungeonsGuide.sendDebugChat(new ChatComponentText(chat.getFormattedText().replace('§', '&') + " - received")); } if (!chat.getFormattedText().contains("/")) return; BlockPos pos = Minecraft.getMinecraft().thePlayer.getPosition(); - DungeonContext context = e.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); Point pt1 = context.getMapProcessor().worldPointToRoomPoint(pos.add(2, 0, 2)); Point pt2 = context.getMapProcessor().worldPointToRoomPoint(pos.add(-2, 0, -2)); if (!pt1.equals(pt2)) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java index 763f72c9..0623174e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java @@ -21,7 +21,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; @@ -176,7 +176,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { } } catch (IOException e2) { e2.printStackTrace(); - e.sendDebugChat(new ChatComponentText("Failed to send Bomb Defuse Chat")); + DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to send Bomb Defuse Chat")); } } @@ -206,7 +206,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { } } catch (Throwable t) { t.printStackTrace(); - e.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); + DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java index e7d5a230..2350c38b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java @@ -21,24 +21,18 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.color; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import kr.syeyoung.dungeonsguide.Keybinds; -import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.event.entity.living.LivingEvent; import org.lwjgl.input.Keyboard; -import java.awt.*; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java index 5c4a0723..80b6ede5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java @@ -18,18 +18,14 @@ package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; import net.minecraft.entity.boss.BossStatus; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.event.entity.living.LivingEvent; import java.awt.*; import java.util.ArrayList; @@ -45,7 +41,7 @@ public class BossfightProcessorThorn extends GeneralBossfightProcessor { .phase("fight").build() ); - w= e.getDungeonsGuide().getSkyblockStatus().getContext().getWorld(); + w= DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getWorld(); } private final Set progressBar = new HashSet(); private final World w; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java new file mode 100755 index 00000000..2fb35638 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGConnection.java @@ -0,0 +1,49 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.url; + +import kr.syeyoung.dungeonsguide.Authenticator; + +import java.io.*; +import java.net.URL; +import java.net.URLConnection; + +public class DGConnection extends URLConnection { + private final Authenticator authenticator; + protected DGConnection(URL url, Authenticator a) { + super(url); + connected = false; + this.authenticator = a; + } + + @Override + public void connect() throws IOException { + } + @Override + public InputStream getInputStream() throws IOException { + if (authenticator != null) { + String path = url.getPath().substring(1); + if (!authenticator.getResources().containsKey(path)) throw new FileNotFoundException(); + return new ByteArrayInputStream(authenticator.getResources().get(path)); + } else if (url.getPath().contains("roomdata")){ + return DGConnection.class.getResourceAsStream(url.getPath()); + } + throw new FileNotFoundException(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java new file mode 100755 index 00000000..bc6fa10d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandler.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.url; + +import kr.syeyoung.dungeonsguide.Authenticator; +import lombok.AllArgsConstructor; + +import java.io.IOException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +@AllArgsConstructor +public class DGStreamHandler extends URLStreamHandler { + private final Authenticator auth; + @Override + protected URLConnection openConnection(URL url) throws IOException { + return new DGConnection(url, this.auth); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java new file mode 100755 index 00000000..9f574a86 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/url/DGStreamHandlerFactory.java @@ -0,0 +1,37 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package kr.syeyoung.dungeonsguide.url; + +import kr.syeyoung.dungeonsguide.Authenticator; +import lombok.AllArgsConstructor; + +import java.net.URLStreamHandler; +import java.net.URLStreamHandlerFactory; + +@AllArgsConstructor +public class DGStreamHandlerFactory implements URLStreamHandlerFactory { + private final Authenticator auth; + @Override + public URLStreamHandler createURLStreamHandler(String protocol) { + if ("z".equals(protocol)) { + return new DGStreamHandler(this.auth); + } + return null; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java index 6bc57c2a..049f8a0d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java @@ -18,7 +18,6 @@ package kr.syeyoung.dungeonsguide.utils; -import java.io.IOException; import java.security.*; import java.security.cert.CertificateException; import java.util.HashMap; @@ -26,7 +25,7 @@ import java.util.Map; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; @@ -57,7 +56,7 @@ public class AhUtils { try { Map semi_auctions = new HashMap(); - JsonElement object = e.getDungeonsGuide().getAuthenticator().d("https://dungeons.guide/resource/keys"); + JsonElement object = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJsonSecured("https://dungeons.guide/resource/keys"); for (JsonElement element : object.getAsJsonArray()) { JsonObject object1 = element.getAsJsonObject(); AuctionData auctionData = new AuctionData(object1.get("id").getAsString()); -- cgit