├── .idea ├── .gitignore ├── misc.xml ├── modules.xml └── vcs.xml ├── IProtocol.java ├── OpenProtocol.iml ├── README.md ├── heypixel ├── BlockItemRegistry.java ├── BufferConstructorType.java ├── ClassesRandom.java ├── HardwareList.java ├── Heypixel.java ├── HeypixelHwid.java ├── HeypixelHwids.java ├── IDKAnnotation.java ├── S2CEvent.java ├── TypeRegistry.java ├── ValueDataType.java ├── ValueTypeEnum.java ├── buffer │ ├── BufferConfiguration.java │ ├── BufferConstructorMapping.java │ ├── BufferSet.java │ ├── BufferSlice.java │ ├── BufferUtils.java │ ├── BufferWrapper.java │ ├── BufferedOutput.java │ ├── ChannelBuffer.java │ ├── CopiedBuffer.java │ ├── DataBuffer.java │ ├── DataBufferProcessor.java │ ├── EBuffer.java │ ├── ExTH.java │ ├── ILBuffer.java │ ├── InputStreamBuffer.java │ ├── MessageBuffer.java │ ├── OutputStreamBuffer.java │ ├── ProcessorBuilder.java │ ├── ReadableChannelBuffer.java │ ├── TPositionBuffer.java │ └── UBuffer.java ├── check │ ├── Base64.java │ ├── EncryptDataC2SPacket.java │ ├── HeypixelCheckPacket.java │ ├── HeypixelSessionManager.java │ ├── c2s │ │ ├── BlockStateC2SPacket.java │ │ ├── ClassesC2SPacket.java │ │ ├── EmptyC2SPacket.java │ │ ├── GameDataC2SPacket.java │ │ ├── HitResultC2SPacket.java │ │ └── ReflectDataC2SPacket.java │ └── s2c │ │ ├── BlockPosS2CPacket.java │ │ ├── HeypixelKeysS2CPacket.java │ │ ├── NeteaseCheckS2CPacket.java │ │ ├── PlayerListDataS2CPacket.java │ │ ├── ReflectCheckS2CPacket.java │ │ ├── SyncKeysS2CPacket.java │ │ ├── TokenDataS2CPacket.java │ │ └── UnknownS2CPacket.java ├── collections │ ├── ObjectDataArrCollection.java │ ├── ObjectDataArrMap.java │ ├── ObjectDataEntryIterator.java │ ├── ObjectDataEntrySet.java │ ├── ObjectDataIterator.java │ ├── ObjectDataIterator1.java │ ├── ObjectDataList.java │ ├── ObjectDataMap.java │ ├── ObjectDataSet.java │ └── StringSet.java ├── data │ ├── BigIntegerData.java │ ├── BooleanData.java │ ├── BufferData.java │ ├── BytesDataProvider.java │ ├── DataFactory.java │ ├── DataTypes.java │ ├── DoubleData.java │ ├── InstantByteData.java │ ├── LongData.java │ ├── MapData.java │ ├── NullData.java │ ├── ObjectData.java │ ├── ObjectDataListData.java │ ├── PayloadData.java │ ├── hex │ │ ├── HexBytesData.java │ │ └── HexEncodedData.java │ ├── interfaces │ │ ├── IBoolData.java │ │ ├── IBufferData.java │ │ ├── IBytesData.java │ │ ├── IDataList.java │ │ ├── IDoubleData.java │ │ ├── IHexBytesData.java │ │ ├── IInstantBytes.java │ │ ├── ILongNumberData.java │ │ ├── IMapData.java │ │ └── INullData.java │ └── retrievers │ │ ├── AbstractDataRetriever.java │ │ ├── BoolRetriever.java │ │ ├── ByteBufRetriever.java │ │ ├── BytesDataRetriever.java │ │ ├── BytesRetriever.java │ │ ├── DataListRetriever.java │ │ ├── DataRetriever.java │ │ ├── DoubleRetriever.java │ │ ├── InstantRetriever.java │ │ ├── LongNumberRetriever.java │ │ ├── MapRetriever.java │ │ ├── NullRetriever.java │ │ ├── NumberValueRetriever.java │ │ ├── ObjectRetriever.java │ │ └── PayloadRetriever.java ├── exceptions │ ├── BigIntgerException.java │ ├── CharacterCodingFailedException.java │ └── ProcessorException.java ├── utils │ ├── BufferHelper.java │ ├── ChiperUtils.java │ ├── DataBufferUtils.java │ ├── EncryptionUtils.java │ ├── HeypixelCipher.java │ ├── HeypixelVarUtils.java │ ├── MsgUtils.java │ └── ProtocolKeyGenerator.java └── value │ ├── AbstractValue.java │ ├── BoolValue.java │ ├── ByteBufValue.java │ ├── BytesBufValue.java │ ├── BytesValue.java │ ├── DoubleValue.java │ ├── InstantPayloadValue.java │ ├── InstantValue.java │ ├── ListValue.java │ ├── LongValue.java │ ├── MapValue.java │ ├── NullValue.java │ ├── NumberValue.java │ └── Value.java └── nel ├── GameSessionProvider.java └── zone ├── ZoneSessionInfo.java └── ZoneSessionsProvider.java /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /IProtocol.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol; 2 | 3 | import dev.undefinedteam.gclient.GChat; 4 | import dev.undefinedteam.gensh1n.Client; 5 | import dev.undefinedteam.gensh1n.events.game.GameJoinedEvent; 6 | import dev.undefinedteam.gensh1n.events.world.EntityJoinWorldEvent; 7 | import dev.undefinedteam.gensh1n.events.world.WorldChangeEvent; 8 | import net.minecraft.network.packet.Packet; 9 | import net.minecraft.text.Text; 10 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 11 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 12 | import tech.skidonion.obfuscator.annotations.StringEncryption; 13 | 14 | import java.io.File; 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public interface IProtocol { 19 | File FOLDER = new File(Client.FOLDER, "protocol"); 20 | 21 | void init(); 22 | 23 | void reload(); 24 | 25 | String name(); 26 | 27 | boolean onPacket(Packet packet); 28 | void onMessage(Text text); 29 | 30 | void onEntityJoinWorld(EntityJoinWorldEvent e); 31 | void onWorldChanged(WorldChangeEvent e); 32 | void onGameJoin(GameJoinedEvent e); 33 | void tick(); 34 | } 35 | -------------------------------------------------------------------------------- /OpenProtocol.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Heypixel OpenProtocol 2 | 3 | ## How to use? 4 | ### Skid this to your sb heck. 5 | 6 | ## Is this latest? 7 | ### last updated at 2024/10/26 8 | -------------------------------------------------------------------------------- /heypixel/BufferConstructorType.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | 8 | @StringEncryption 9 | @ControlFlowObfuscation 10 | public enum BufferConstructorType { 11 | TYPE_1, 12 | TYPE_2, 13 | TYPE_3, 14 | TYPE_4, 15 | TYPE_5 16 | } 17 | -------------------------------------------------------------------------------- /heypixel/ClassesRandom.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import dev.undefinedteam.gensh1n.Genshin; 4 | import dev.undefinedteam.gensh1n.utils.RandomUtils; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public class ClassesRandom { 15 | /** 16 | * CLASS LOADER NAME 17 | * app , null , TRANSFORMER 18 | */ 19 | 20 | public static final HashMap check1 = new HashMap<>(); 21 | 22 | static { 23 | check1.put("net.minecraftforge.client.ClientCommandHandler", "TRANSFORMER"); 24 | check1.put("net.minecraftforge.client.event.EntityViewRenderEvent$FogColors", "TRANSFORMER"); 25 | check1.put("net.minecraft.client.multiplayer.ClientLevel", "TRANSFORMER"); 26 | check1.put("net.minecraft.client.gui.screens.Screen", "TRANSFORMER"); 27 | check1.put("net.minecraft.client.multiplayer.ClientChunkCache", "TRANSFORMER"); 28 | check1.put("net.minecraft.client.multiplayer.PlayerInfo", "TRANSFORMER"); 29 | check1.put("net.minecraft.client.Camera", "TRANSFORMER"); 30 | check1.put("net.minecraft.client.player.AbstractClientPlayer", "TRANSFORMER"); 31 | check1.put("com.mojang.blaze3d.pipeline.RenderTarget", "TRANSFORMER"); 32 | check1.put("net.minecraft.client.KeyMapping", "TRANSFORMER"); 33 | check1.put("net.minecraftforge.client.settings.KeyConflictContext$2", "TRANSFORMER"); 34 | check1.put("net.minecraft.client.resources.model.Material", "TRANSFORMER"); 35 | check1.put("net.minecraftforge.client.event.EntityViewRenderEvent$FogEvent", "TRANSFORMER"); 36 | check1.put("net.minecraftforge.client.ForgeRenderTypes$CustomizableTextureState", "TRANSFORMER"); 37 | check1.put("net.minecraft.client.renderer.RenderStateShard$OverlayStateShard", "TRANSFORMER"); 38 | check1.put("net.minecraft.client.renderer.RenderStateShard$LightmapStateShard", "TRANSFORMER"); 39 | check1.put("net.minecraft.client.gui.chat.NarratorChatListener", "TRANSFORMER"); 40 | check1.put("net.minecraft.client.renderer.RenderStateShard$TextureStateShard", "TRANSFORMER"); 41 | check1.put("net.minecraftforge.client.model.ModelDataManager", "TRANSFORMER"); 42 | check1.put("net.minecraft.client.gui.components.ComponentRenderUtils", "TRANSFORMER"); 43 | check1.put("net.minecraftforge.client.model.ModelLoaderRegistry", "TRANSFORMER"); 44 | check1.put("com.mojang.blaze3d.systems.RenderSystem", "TRANSFORMER"); 45 | check1.put("net.minecraft.client.renderer.PanoramaRenderer", "TRANSFORMER"); 46 | check1.put("net.minecraft.client.multiplayer.ClientLevel", "TRANSFORMER"); 47 | check1.put("net.minecraft.client.renderer.texture.MissingTextureAtlasSprite", "TRANSFORMER"); 48 | check1.put("net.minecraft.client.resources.SplashManager", "TRANSFORMER"); 49 | check1.put("net.minecraft.client.renderer.texture.TextureManager", "TRANSFORMER"); 50 | check1.put("net.minecraft.client.resources.SkinManager", "TRANSFORMER"); 51 | check1.put("net.minecraft.client.multiplayer.PlayerInfo", "TRANSFORMER"); 52 | check1.put("com.mojang.blaze3d.pipeline.RenderTarget", "TRANSFORMER"); 53 | check1.put("net.minecraft.client.KeyMapping", "TRANSFORMER"); 54 | check1.put("net.minecraft.client.resources.model.Material", "TRANSFORMER"); 55 | check1.put("net.minecraftforge.client.event.EntityRenderersEvent$AddLayers", "TRANSFORMER"); 56 | check1.put("net.minecraftforge.client.ForgeRenderTypes$CustomizableTextureState", "TRANSFORMER"); 57 | check1.put("net.minecraftforge.client.event.EntityViewRenderEvent$FogEvent", "TRANSFORMER"); 58 | check1.put("net.minecraftforge.client.event.FOVModifierEvent", "TRANSFORMER"); 59 | check1.put("com.mojang.realmsclient.client.RealmsClient", "TRANSFORMER"); 60 | check1.put("net.minecraft.client.renderer.RenderStateShard$LightmapStateShard", "TRANSFORMER"); 61 | check1.put("net.minecraft.client.gui.chat.NarratorChatListener", "TRANSFORMER"); 62 | check1.put("net.minecraftforge.client.model.ModelDataManager", "TRANSFORMER"); 63 | } 64 | 65 | public static Map randomCheck1() { 66 | Genshin.INSTANCE.onCheckVerify(); 67 | 68 | int len = RandomUtils.nextInt(10, 12); 69 | 70 | var map = new HashMap(); 71 | for (int i = 0; i < len; i++) { 72 | var id = RandomUtils.nextInt(0, check1.size() - 1); 73 | var key = check1.keySet().toArray()[id].toString(); 74 | while (map.containsKey(key)) { 75 | id = RandomUtils.nextInt(0, check1.size() - 1); 76 | key = check1.keySet().toArray()[id].toString(); 77 | } 78 | 79 | map.put(key, check1.get(key)); 80 | } 81 | 82 | return map; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /heypixel/HardwareList.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import dev.undefinedteam.gensh1n.utils.RandomUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.List; 8 | 9 | @StringEncryption 10 | @ControlFlowObfuscation 11 | public class HardwareList { 12 | 13 | public static final List CPUS = List.of( 14 | "AMD Ryzen(TM) 9 5980HX @ 3.3GHz", 15 | "AMD Ryzen(TM) 9 5980HS @ 3.3GHz", 16 | "AMD Ryzen(TM) 9 5900HX @ 3.3GHz", 17 | "AMD Ryzen(TM) 9 5900HS @ 3.3GHz", 18 | "AMD Ryzen(TM) 7 5800H @ 3.2GHz", 19 | "AMD Ryzen(TM) 7 5800HS @ 3.2GHz", 20 | "AMD Ryzen(TM) 7 5800U @ 2.7GHz", 21 | "AMD Ryzen(TM) 5 5600H @ 3.3GHz", 22 | "AMD Ryzen(TM) 5 5600HS @ 3.3GHz", 23 | "AMD Ryzen(TM) 5 5600U @ 2.9GHz", 24 | "AMD Ryzen(TM) 7 1700X @ 3.4GHz", 25 | "AMD Ryzen(TM) 7 1700 @ 3.0GHz", 26 | "AMD Ryzen(TM) 5 1600X @ 3.6GHz", 27 | "AMD Ryzen(TM) 5 1600 @ 3.2GHz", 28 | "AMD Ryzen(TM) 3 1300X @ 3.5GHz", 29 | "AMD Ryzen(TM) 9 7950X @ 4.5GHz", 30 | "AMD Ryzen(TM) 9 7900X @ 4.7GHz", 31 | "AMD Ryzen(TM) 9 7900 @ 3.6GHz", 32 | "AMD Ryzen(TM) 7 7700X @ 4.5GHz", 33 | "AMD Ryzen(TM) 7 7700 @ 3.8GHz", 34 | "AMD Ryzen(TM) 5 7600X @ 4.7GHz", 35 | "AMD Ryzen(TM) 5 7600 @ 3.8GHz", 36 | "AMD Ryzen(TM) 5 5500 @ 3.6GHz", 37 | "AMD Ryzen(TM) 7 5700G @ 3.8GHz", 38 | "AMD Ryzen(TM) 5 5600G @ 3.9GHz", 39 | "AMD Ryzen(TM) 7 5800X @ 3.8GHz", 40 | "AMD Ryzen(TM) 9 3900X @ 3.8GHz", 41 | "AMD Ryzen(TM) 9 3900 @ 3.1GHz", 42 | "AMD Ryzen(TM) 7 3700X @ 3.6GHz", 43 | "AMD Ryzen(TM) 5 3600X @ 3.8GHz", 44 | "AMD Ryzen(TM) 5 3600 @ 3.6GHz", 45 | "AMD Ryzen(TM) 3 3300X @ 3.8GHz", 46 | "AMD Ryzen(TM) 9 5950X @ 3.4GHz", 47 | "Intel(R) Core(TM) i9-10900K @ 3.7GHz", 48 | "Intel(R) Core(TM) i7-10700K @ 3.8GHz", 49 | "Intel(R) Core(TM) i5-10600K @ 4.1GHz", 50 | "Intel(R) Core(TM) i9-9900K @ 3.6GHz", 51 | "Intel(R) Core(TM) i7-9700K @ 3.6GHz", 52 | "Intel(R) Core(TM) i5-9600K @ 3.7GHz", 53 | "Intel(R) Core(TM) i7-8700K @ 3.7GHz", 54 | "Intel(R) Core(TM) i5-8600K @ 3.6GHz", 55 | "Intel(R) Core(TM) i9-7900X @ 3.3GHz", 56 | "Intel(R) Core(TM) i7-7800X @ 3.5GHz", 57 | "Intel(R) Core(TM) i5-7600K @ 3.8GHz", 58 | "Intel(R) Core(TM) i9-7960X @ 2.8GHz", 59 | "Intel(R) Core(TM) i9-7940X @ 3.1GHz", 60 | "Intel(R) Core(TM) i7-7820X @ 3.6GHz", 61 | "Intel(R) Core(TM) i7-7700K @ 4.2GHz", 62 | "Intel(R) Core(TM) i5-7500 @ 3.4GHz", 63 | "Intel(R) Core(TM) i7-6800K @ 3.4GHz" 64 | ); 65 | 66 | 67 | public static final List DISKS = List.of( 68 | "Samsung SSD 941 EVO 1TB", 69 | "Western Digital Blue SN550 NVMe 1TB", 70 | "Crucial P5 NVMe 1TB", 71 | "Seagate FireCuda 520 NVMe 1TB", 72 | "Kingston A2000 NVMe PCIe M.2 1TB", 73 | "Corsair MP600 PRO NVMe Gen4 1TB", 74 | "ADATA XPG Gammix D30 NVMe 1TB", 75 | "SanDisk Extreme PRO NVMe 1TB", 76 | "Plextor M9P Plus NVMe PCIe M.2 1TB", 77 | "OWC Aura Pro X2 NVMe 1TB", 78 | "Gigabyte AORUS NVMe Gen4 1TB", 79 | "TeamGroup Delta Max NVMe PCIe M.2 1TB", 80 | "KLEVV Cras C930 NVMe PCIe M.2 1TB" 81 | ); 82 | 83 | public static final List NETWORKS = List.of( 84 | "TAP-Windows Adapter V9-WFP 802.2 MAC Layer LightWeight Filter-2000", 85 | "Realtek PCIe GbE Family Controller-WFP Native MAC Layer LightWeight Filter-0000", 86 | "Broadcom 802.11ac WLAN Adapter-WFP Native MAC Layer LightWeight Filter-0001", 87 | "Intel Centrino Advanced-N 6230 Network Adapter-WFP Native MAC Layer LightWeight Filter-0002", 88 | "Qualcomm Atheros AR9485WB-EG Wireless Network Adapter-WFP Native MAC Layer LightWeight Filter-0003", 89 | "Marvell Yukon 88E8059 PCI-E Gigabit Ethernet Controller-WFP Native MAC Layer LightWeight Filter-0004", 90 | "TP-Link Archer T4U AC1300 Wireless Network Adapter-WFP Native MAC Layer LightWeight Filter-0005", 91 | "D-Link DWA-182 USB 3.0 N600 Wi-Fi Adapter-WFP Native MAC Layer LightWeight Filter-0006", 92 | "ASUS USB-N13 Nano Dual-Band 802.11n Network Wi-Fi", 93 | "Netgear A6210 AC1200 DB Wi-Fi WFP Native LightWeight Pro", 94 | "Edimax EW-7811UTC 802.11ac Wi-Fi", 95 | "Linksys WUSB6300 AC1200 Wi-Fi Adapter-WFP " 96 | ); 97 | 98 | public static String randomCpu() { 99 | return CPUS.get(RandomUtils.nextInt(0, CPUS.size() - 1)); 100 | } 101 | 102 | public static String randomDisk() { 103 | return DISKS.get(RandomUtils.nextInt(0, DISKS.size() - 1)); 104 | } 105 | 106 | public static String randomNetwork() { 107 | return NETWORKS.get(RandomUtils.nextInt(0, NETWORKS.size() - 1)); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /heypixel/HeypixelHwid.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import lombok.AllArgsConstructor; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | @AllArgsConstructor 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class HeypixelHwid { 16 | @SerializedName("userId") 17 | public String userId; 18 | @SerializedName("networkHardware") 19 | public List networkHardware; 20 | @SerializedName("cpuInfo") 21 | public String cpuInfo; 22 | @SerializedName("baseboardSerial") 23 | public String baseboardSerial; 24 | @SerializedName("diskSerials") 25 | public List diskSerials; 26 | @SerializedName("baseboardInfo") 27 | public Map baseboardInfo; 28 | @SerializedName("diskStoreInfo") 29 | public List> diskStoreInfo; 30 | @SerializedName("networkInterfaces") 31 | public List> networkInterfaces; 32 | @SerializedName("systemHwid") 33 | public String systemHwid; 34 | } 35 | -------------------------------------------------------------------------------- /heypixel/HeypixelHwids.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import dev.undefinedteam.gensh1n.utils.json.GsonIgnore; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.function.Consumer; 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class HeypixelHwids { 16 | @SerializedName("hwids") 17 | public List hwids = new ArrayList<>(); 18 | 19 | public boolean has(String s) { 20 | return hwids.stream().anyMatch(h -> h.userId.equals(s)); 21 | } 22 | 23 | public HeypixelHwid get(String s) { 24 | return hwids.stream().filter(h -> h.userId.equals(s)).findFirst().orElse(null); 25 | } 26 | 27 | public void add(HeypixelHwid hwid) { 28 | if (!has(hwid.userId)) { 29 | hwids.add(hwid); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /heypixel/IDKAnnotation.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | 7 | 8 | public @interface IDKAnnotation { 9 | } 10 | -------------------------------------------------------------------------------- /heypixel/S2CEvent.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | import com.google.gson.JsonObject; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | @StringEncryption 10 | @ControlFlowObfuscation 11 | public class S2CEvent { 12 | public String CODEC; 13 | public String plugin; 14 | public JsonObject size; 15 | 16 | public S2CEvent(String str, String str2, JsonObject jsonObject) { 17 | this.plugin = str; 18 | this.CODEC = str2; 19 | this.size = jsonObject; 20 | } 21 | 22 | public String getPlugin() { 23 | return this.plugin; 24 | } 25 | 26 | public JsonObject getData() { 27 | return this.size; 28 | } 29 | 30 | public String getEvent() { 31 | return this.CODEC; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /heypixel/ValueDataType.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | @StringEncryption 11 | @ControlFlowObfuscation 12 | public enum ValueDataType { 13 | NULL_TYPE(DataTypes.NULL), 14 | BOOLEAN_TYPE(DataTypes.BOOLEAN), 15 | LONG_TYPE(DataTypes.LONG), 16 | BIGINTEGER_LONG_TYPE(DataTypes.LONG), 17 | DOUBLE_TYPE(DataTypes.DOUBLE), 18 | BTYEARRAY_TYPE(DataTypes.BYTES), 19 | BYTES_TYPE(DataTypes.BYTES_BUF), 20 | LIST_TYPE(DataTypes.LIST), 21 | MAP_DATA(DataTypes.MAP), 22 | UINSTANT_TYPE(DataTypes.INSTANT), 23 | INSTANT_TYPE(DataTypes.INSTANT); 24 | 25 | public DataTypes valueType; 26 | 27 | ValueDataType(DataTypes dataTypes) { 28 | this.valueType = dataTypes; 29 | } 30 | 31 | public DataTypes getValueType() { 32 | return this.valueType; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferConfiguration.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.io.OutputStream; 8 | import java.nio.channels.WritableByteChannel; 9 | 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public class BufferConfiguration implements Cloneable { 15 | 16 | 17 | public int initialBufferSize; 18 | 19 | 20 | public boolean useDirectBuffers; 21 | 22 | 23 | public int bufferSize; 24 | 25 | 26 | public int maxBufferSize; 27 | 28 | public BufferConfiguration(BufferConfiguration bufferConfiguration) { 29 | this.initialBufferSize = 512; 30 | this.maxBufferSize = 8192; 31 | this.bufferSize = 8192; 32 | this.useDirectBuffers = true; 33 | this.initialBufferSize = bufferConfiguration.initialBufferSize; 34 | this.maxBufferSize = bufferConfiguration.maxBufferSize; 35 | this.bufferSize = bufferConfiguration.bufferSize; 36 | this.useDirectBuffers = bufferConfiguration.useDirectBuffers; 37 | } 38 | 39 | public BufferConfiguration() { 40 | this.initialBufferSize = 512; 41 | this.maxBufferSize = 8192; 42 | this.bufferSize = 8192; 43 | this.useDirectBuffers = true; 44 | } 45 | 46 | public MessageBuffer createMessageBuffer(BufferedOutput bufferedOutput) { 47 | return new MessageBuffer(bufferedOutput, this); 48 | } 49 | 50 | public int getInitialBufferSize() { 51 | return this.initialBufferSize; 52 | } 53 | 54 | public MessageBuffer createMessageBufferFromChannel(WritableByteChannel writableByteChannel) { 55 | return createMessageBuffer(new ChannelBuffer(writableByteChannel, this.bufferSize)); 56 | } 57 | 58 | public BufferConfiguration withBufferSize(int i) { 59 | BufferConfiguration cloneConfiguration = cloneConfiguration(); 60 | cloneConfiguration.bufferSize = i; 61 | return cloneConfiguration; 62 | } 63 | 64 | public BufferConfiguration withInitialBufferSize(int i) { 65 | BufferConfiguration cloneConfiguration = cloneConfiguration(); 66 | cloneConfiguration.initialBufferSize = i; 67 | return cloneConfiguration; 68 | } 69 | 70 | public boolean isDirectBuffersEnabled() { 71 | return this.useDirectBuffers; 72 | } 73 | 74 | 75 | public BufferConfiguration withMaxBufferSize(int i) { 76 | BufferConfiguration cloneConfiguration = cloneConfiguration(); 77 | cloneConfiguration.maxBufferSize = i; 78 | return cloneConfiguration; 79 | } 80 | 81 | public int hashCode() { 82 | int i = 31 * ((31 * this.initialBufferSize) + this.maxBufferSize); 83 | int i2 = this.bufferSize; 84 | int i3 = 31 * ((i | i2) + ((i2 | ((-i) - 1)) - ((-i) - 1))); 85 | int i4 = this.useDirectBuffers ? 1 : 0; 86 | int i5 = i4; 87 | return ((i3 | i4) * 2) - ((i3 | i5) & (((-i5) - 1) | ((-i3) - 1))); 88 | } 89 | 90 | 91 | public BufferConfiguration withDirectBuffersEnabled(boolean z) { 92 | BufferConfiguration cloneConfiguration = cloneConfiguration(); 93 | cloneConfiguration.useDirectBuffers = z; 94 | return cloneConfiguration; 95 | } 96 | 97 | 98 | public MessageBuffer createMessageBufferFromStream(OutputStream outputStream) { 99 | return createMessageBuffer(new OutputStreamBuffer(outputStream, this.bufferSize)); 100 | } 101 | 102 | 103 | public int getBufferSize() { 104 | return this.bufferSize; 105 | } 106 | 107 | public boolean equals(Object obj) { 108 | if (!(obj instanceof BufferConfiguration bufferConfiguration)) { 109 | return false; 110 | } 111 | return this.initialBufferSize == bufferConfiguration.initialBufferSize && this.maxBufferSize == bufferConfiguration.maxBufferSize && this.bufferSize == bufferConfiguration.bufferSize && this.useDirectBuffers == bufferConfiguration.useDirectBuffers; 112 | } 113 | 114 | 115 | public BufferConfiguration cloneConfiguration() { 116 | return new BufferConfiguration(this); 117 | } 118 | 119 | 120 | public int getMaxBufferSize() { 121 | return this.maxBufferSize; 122 | } 123 | 124 | 125 | public DataBuffer createBuffer() { 126 | return new DataBuffer(this); 127 | } 128 | 129 | 130 | public Object clone() { 131 | return cloneConfiguration(); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferConstructorMapping.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.BufferConstructorType; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | @StringEncryption 10 | @ControlFlowObfuscation 11 | public class BufferConstructorMapping { 12 | 13 | public static int[] constructorTypeToIntMap = new int[BufferConstructorType.values().length]; 14 | 15 | static { 16 | try { 17 | constructorTypeToIntMap[BufferConstructorType.TYPE_1.ordinal()] = 1; 18 | } catch (NoSuchFieldError e) { 19 | } 20 | try { 21 | constructorTypeToIntMap[BufferConstructorType.TYPE_2.ordinal()] = 2; 22 | } catch (NoSuchFieldError e2) { 23 | } 24 | try { 25 | constructorTypeToIntMap[BufferConstructorType.TYPE_3.ordinal()] = 3; 26 | } catch (NoSuchFieldError e3) { 27 | } 28 | try { 29 | constructorTypeToIntMap[BufferConstructorType.TYPE_4.ordinal()] = 4; 30 | } catch (NoSuchFieldError e4) { 31 | } 32 | try { 33 | constructorTypeToIntMap[BufferConstructorType.TYPE_5.ordinal()] = 5; 34 | } catch (NoSuchFieldError e5) { 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferSet.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | 11 | @StringEncryption 12 | @ControlFlowObfuscation 13 | public class BufferSet implements BufferedOutput { 14 | 15 | 16 | public List bufferList; 17 | 18 | 19 | public int bufferSize; 20 | 21 | 22 | public UBuffer buffer; 23 | 24 | 25 | public BufferSet() { 26 | this(8192); 27 | } 28 | 29 | public BufferSet(int i) { 30 | this.bufferSize = i; 31 | this.bufferList = new ArrayList<>(); 32 | } 33 | 34 | public void writeInt(int i) { 35 | this.bufferList.add(this.buffer.sliceBuffer(0, i)); 36 | if (this.buffer.remaining() - i > this.bufferSize / 4) { 37 | this.buffer = this.buffer.sliceBuffer(i, this.buffer.remaining() - i); 38 | } else { 39 | this.buffer = null; 40 | } 41 | } 42 | 43 | public byte[] getBytesArray() { 44 | byte[] bArr = new byte[calculateBufferSize()]; 45 | int i = 0; 46 | for (UBuffer buffer : this.bufferList) { 47 | buffer.writeArrayDataToBuffer(0, bArr, i, buffer.remaining()); 48 | i += buffer.remaining(); 49 | } 50 | return bArr; 51 | } 52 | 53 | public void writeBytes(byte[] bArr, int i, int i2) { 54 | UBuffer allocateBuffer = UBuffer.allocateBuffer(i2); 55 | allocateBuffer.copyMemory(0, bArr, i, i2); 56 | this.bufferList.add(allocateBuffer); 57 | } 58 | 59 | @Override 60 | public void flush() { 61 | } 62 | 63 | public UBuffer allocateBuffer(int i) { 64 | if (this.buffer != null && this.buffer.remaining() > i) { 65 | return this.buffer; 66 | } 67 | UBuffer allocateBuffer = UBuffer.allocateBuffer(Math.max(this.bufferSize, i)); 68 | this.buffer = allocateBuffer; 69 | return allocateBuffer; 70 | } 71 | 72 | public UBuffer mergeBuffers() { 73 | return this.bufferList.size() == 1 ? this.bufferList.get(0) : this.bufferList.isEmpty() ? UBuffer.allocateBuffer(0) : UBuffer.createFromByteArray(getBytesArray()); 74 | } 75 | 76 | @Override 77 | public void close() { 78 | } 79 | 80 | 81 | public void writeBytesWithOffset(byte[] bArr, int i, int i2) { 82 | this.bufferList.add(UBuffer.wrapByteArray(bArr, i, i2)); 83 | } 84 | 85 | 86 | public void clearBuffers() { 87 | this.bufferList.clear(); 88 | } 89 | 90 | 91 | public List getBufferList() { 92 | return new ArrayList<>(this.bufferList); 93 | } 94 | 95 | 96 | public int calculateBufferSize() { 97 | int i = 0; 98 | for (UBuffer value : this.bufferList) { 99 | i = (i - ((-value.remaining()) - 1)) - 1; 100 | } 101 | return i; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferSlice.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.nio.ByteBuffer; 9 | 10 | 11 | @StringEncryption 12 | @ControlFlowObfuscation 13 | public class BufferSlice extends UBuffer { 14 | 15 | public BufferSlice(ByteBuffer byteBuffer) { 16 | super(byteBuffer); 17 | } 18 | 19 | 20 | public BufferSlice(byte[] bArr, int i, int i2) { 21 | super(bArr, i, i2); 22 | } 23 | 24 | 25 | public BufferSlice(Object obj, long j, int i) { 26 | super(obj, j, i); 27 | } 28 | 29 | public BufferSlice sliceBuffer0(int i, int i2) { 30 | if (i == 0 && i2 == remaining()) { 31 | return this; 32 | } 33 | MsgUtils.checkArgument((i | i2) + ((i2 | ((-i) - 1)) - ((-i) - 1)) <= remaining()); 34 | return new BufferSlice(this.backingArray, this.offset + i, i2); 35 | } 36 | 37 | @Override 38 | public void putDouble(int i, double d) { 39 | unsafe.putDouble(this.backingArray, this.offset + i, d); 40 | } 41 | 42 | @Override 43 | public long getLong(int i) { 44 | return unsafe.getLong(this.backingArray, this.offset + i); 45 | } 46 | 47 | @Override 48 | public int getInt(int i) { 49 | return unsafe.getInt(this.backingArray, this.offset + i); 50 | } 51 | 52 | @Override 53 | public short getShort(int i) { 54 | return unsafe.getShort(this.backingArray, this.offset + i); 55 | } 56 | 57 | @Override 58 | public void putInt(int i, int i2) { 59 | unsafe.putInt(this.backingArray, this.offset + i, i2); 60 | } 61 | 62 | @Override 63 | public double toDouble(int i) { 64 | return unsafe.getDouble(this.backingArray, this.offset + i); 65 | } 66 | 67 | @Override 68 | public void putShort(int i, short s) { 69 | unsafe.putShort(this.backingArray, this.offset + i, s); 70 | } 71 | 72 | @Override 73 | public float toFloat(int i) { 74 | return unsafe.getFloat(this.backingArray, this.offset + i); 75 | } 76 | 77 | @Override 78 | public UBuffer sliceBuffer(int i, int i2) { 79 | return sliceBuffer0(i, i2); 80 | } 81 | 82 | @Override 83 | public void putLong(int i, long j) { 84 | unsafe.putLong(this.backingArray, this.offset + i, j); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferWrapper.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | @StringEncryption 11 | @ControlFlowObfuscation 12 | public class BufferWrapper implements ILBuffer { 13 | public boolean isNull; 14 | public UBuffer buf; 15 | 16 | public BufferWrapper(UBuffer buffer) { 17 | this.buf = buffer; 18 | this.isNull = buffer == null; 19 | } 20 | 21 | public BufferWrapper(byte[] bArr, int i, int i2) { 22 | this(UBuffer.wrapByteArray((byte[]) MsgUtils.requireNonNull(bArr, "数组为空"), i, i2)); 23 | } 24 | 25 | 26 | public BufferWrapper(byte[] bArr) { 27 | this(bArr, 0, bArr.length); 28 | } 29 | 30 | @Override 31 | public void close() { 32 | this.buf = null; 33 | this.isNull = true; 34 | } 35 | 36 | public void setBufferFromByteArray(byte[] bArr) { 37 | replaceBuffer(UBuffer.createFromByteArray((byte[]) MsgUtils.requireNonNull(bArr, "数组为空"))); 38 | } 39 | 40 | @Override 41 | public UBuffer getBuffer() { 42 | if (this.isNull) { 43 | return null; 44 | } 45 | this.isNull = true; 46 | return this.buf; 47 | } 48 | 49 | public UBuffer replaceBuffer(UBuffer buffer) { 50 | UBuffer buffer2 = this.buf; 51 | this.buf = buffer; 52 | this.isNull = buffer == null; 53 | return buffer2; 54 | } 55 | 56 | public void setBufferFromPartialByteArray(byte[] bArr, int i, int i2) { 57 | replaceBuffer(UBuffer.wrapByteArray((byte[]) MsgUtils.requireNonNull(bArr, "数组为空"), i, i2)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /heypixel/buffer/BufferedOutput.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.io.Closeable; 8 | import java.io.Flushable; 9 | import java.io.IOException; 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public interface BufferedOutput extends Closeable, Flushable { 15 | UBuffer allocateBuffer(int i); 16 | 17 | void writeInt(int i) throws IOException; 18 | 19 | void writeBytes(byte[] bArr, int i, int i2) throws IOException; 20 | 21 | void writeBytesWithOffset(byte[] bArr, int i, int i2) throws IOException; 22 | } 23 | -------------------------------------------------------------------------------- /heypixel/buffer/ChannelBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.io.IOException; 9 | import java.nio.ByteBuffer; 10 | import java.nio.channels.WritableByteChannel; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class ChannelBuffer implements BufferedOutput { 16 | public UBuffer buf; 17 | public WritableByteChannel channel; 18 | 19 | 20 | public ChannelBuffer(WritableByteChannel writableByteChannel) { 21 | this(writableByteChannel, 8192); 22 | } 23 | 24 | public ChannelBuffer(WritableByteChannel writableByteChannel, int i) { 25 | this.channel = (WritableByteChannel) MsgUtils.requireNonNull(writableByteChannel, "传出数据通道为空"); 26 | this.buf = UBuffer.allocateBuffer(i); 27 | } 28 | 29 | public void writeInt(int i) throws IOException { 30 | ByteBuffer sliceByteBuffer = this.buf.sliceByteBuffer(0, i); 31 | while (sliceByteBuffer.hasRemaining()) { 32 | this.channel.write(sliceByteBuffer); 33 | } 34 | } 35 | 36 | public void writeBytes(byte[] bArr, int i, int i2) throws IOException { 37 | ByteBuffer wrap = ByteBuffer.wrap(bArr, i, i2); 38 | while (wrap.hasRemaining()) { 39 | this.channel.write(wrap); 40 | } 41 | } 42 | 43 | public void writeBytesWithOffset(byte[] bArr, int i, int i2) throws IOException { 44 | writeBytes(bArr, i, i2); 45 | } 46 | 47 | 48 | public UBuffer allocateBuffer(int i) { 49 | if (this.buf.remaining() < i) { 50 | this.buf = UBuffer.allocateBuffer(i); 51 | } 52 | return this.buf; 53 | } 54 | 55 | public WritableByteChannel replaceChannel(WritableByteChannel writableByteChannel) { 56 | WritableByteChannel writableByteChannel2 = this.channel; 57 | this.channel = writableByteChannel; 58 | return writableByteChannel2; 59 | } 60 | 61 | 62 | @Override 63 | public void close() throws IOException { 64 | this.channel.close(); 65 | } 66 | 67 | @Override 68 | public void flush() { 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /heypixel/buffer/CopiedBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.nio.ByteBuffer; 9 | 10 | 11 | @StringEncryption 12 | @ControlFlowObfuscation 13 | public class CopiedBuffer implements ILBuffer { 14 | 15 | 16 | public ByteBuffer buffer; 17 | 18 | 19 | public boolean slice = false; 20 | public CopiedBuffer(ByteBuffer byteBuffer) { 21 | this.buffer = ((ByteBuffer) MsgUtils.requireNonNull(byteBuffer, "字节缓存为空")).slice(); 22 | } 23 | 24 | @Override 25 | public void close() { 26 | } 27 | 28 | @Override 29 | public UBuffer getBuffer() { 30 | if (this.slice) { 31 | return null; 32 | } 33 | UBuffer createFromByteBuffer = UBuffer.createFromByteBuffer(this.buffer); 34 | this.slice = true; 35 | return createFromByteBuffer; 36 | } 37 | 38 | 39 | public ByteBuffer sliceBuffer(ByteBuffer byteBuffer) { 40 | ByteBuffer byteBuffer2 = this.buffer; 41 | this.buffer = ((ByteBuffer) MsgUtils.requireNonNull(byteBuffer, "字节缓存为空")).slice(); 42 | this.slice = false; 43 | return byteBuffer2; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /heypixel/buffer/DataBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.io.IOException; 8 | import java.util.List; 9 | 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public class DataBuffer extends MessageBuffer { 15 | 16 | public DataBuffer(BufferConfiguration bufferConfiguration) { 17 | this(new BufferSet(bufferConfiguration.getBufferSize()), bufferConfiguration); 18 | } 19 | 20 | public DataBuffer(BufferSet bufferSet, BufferConfiguration bufferConfiguration) { 21 | super(bufferSet, bufferConfiguration); 22 | } 23 | 24 | public byte[] getBytes() throws IOException { 25 | flush(); 26 | return getOutputBuffer().getBytesArray(); 27 | } 28 | 29 | public int getSize() { 30 | return getOutputBuffer().calculateBufferSize(); 31 | } 32 | 33 | 34 | public List getList() throws IOException { 35 | flush(); 36 | return getOutputBuffer().getBufferList(); 37 | } 38 | 39 | 40 | @Override 41 | public BufferedOutput replaceBuffer(BufferedOutput bufferedOutput) throws IOException { 42 | if (bufferedOutput instanceof BufferSet) { 43 | return super.replaceBuffer(bufferedOutput); 44 | } 45 | throw new IllegalArgumentException("错误的数据类型#1!"); 46 | } 47 | 48 | 49 | @Override 50 | public void resetBuffer() { 51 | super.resetBuffer(); 52 | getOutputBuffer().clearBuffers(); 53 | } 54 | 55 | 56 | public BufferSet getOutputBuffer() { 57 | return (BufferSet) this.outputBuffer; 58 | } 59 | 60 | 61 | public UBuffer getBuffer() throws IOException { 62 | flush(); 63 | return getOutputBuffer().mergeBuffers(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /heypixel/buffer/EBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.nio.ByteBuffer; 7 | 8 | 9 | public class EBuffer { 10 | private ByteBuffer buffer; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/buffer/ExTH.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | @StringEncryption 11 | @ControlFlowObfuscation 12 | public class ExTH { 13 | public byte type; 14 | public int len; 15 | 16 | public ExTH(byte type, int len) { 17 | MsgUtils.checkArgumentWithMessage(len >= 0, "length must be >= 0"); 18 | this.type = type; 19 | this.len = len; 20 | } 21 | 22 | public static byte of(int i) { 23 | MsgUtils.checkArgumentWithMessage(-128 <= i && i <= 127, "Extension type code must be within the range of byte"); 24 | return (byte) i; 25 | } 26 | 27 | public boolean reset() { 28 | return this.type == -1; 29 | } 30 | 31 | public String toString() { 32 | return String.format("ExTH -> 类型:%d, 长度:%,d", this.type, this.len); 33 | } 34 | 35 | public byte getType() { 36 | return this.type; 37 | } 38 | 39 | public int hashCode() { 40 | int i = (this.type + 31) * 31; 41 | int i2 = this.len; 42 | return (i ^ i2) + (((i2 | ((-i) - 1)) - ((-i) - 1)) * 2); 43 | } 44 | 45 | public boolean equals(Object obj) { 46 | if (!(obj instanceof ExTH exTH)) { 47 | return false; 48 | } 49 | return this.type == exTH.type && this.len == exTH.len; 50 | } 51 | 52 | public int getLength() { 53 | return this.len; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /heypixel/buffer/ILBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.io.Closeable; 7 | import java.io.IOException; 8 | 9 | 10 | 11 | public interface ILBuffer extends Closeable { 12 | @Override 13 | void close() throws IOException; 14 | 15 | UBuffer getBuffer() throws IOException; 16 | } 17 | -------------------------------------------------------------------------------- /heypixel/buffer/InputStreamBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.io.FileInputStream; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.nio.channels.FileChannel; 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class InputStreamBuffer implements ILBuffer { 17 | public byte[] data; 18 | public InputStream stream; 19 | 20 | public InputStreamBuffer(InputStream inputStream, int i) { 21 | this.stream = (InputStream) MsgUtils.requireNonNull(inputStream, "空"); 22 | this.data = new byte[i]; 23 | } 24 | 25 | public InputStreamBuffer(InputStream inputStream) { 26 | this(inputStream, 8192); 27 | } 28 | 29 | public static ILBuffer replaceChannelN(InputStream inputStream) { 30 | FileChannel channel; 31 | MsgUtils.requireNonNull(inputStream, "输入流为空"); 32 | return (!(inputStream instanceof FileInputStream) || (channel = ((FileInputStream) inputStream).getChannel()) == null) ? new InputStreamBuffer(inputStream) : new ReadableChannelBuffer(channel); 33 | } 34 | 35 | public UBuffer getBuffer() throws IOException { 36 | int read = this.stream.read(this.data); 37 | if (read == -1) { 38 | return null; 39 | } 40 | return UBuffer.wrapByteArray(this.data, 0, read); 41 | } 42 | 43 | public InputStream replaceChannel(InputStream inputStream) { 44 | InputStream inputStream2 = this.stream; 45 | this.stream = inputStream; 46 | return inputStream2; 47 | } 48 | 49 | @Override 50 | public void close() throws IOException { 51 | this.stream.close(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /heypixel/buffer/OutputStreamBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.io.IOException; 9 | import java.io.OutputStream; 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public class OutputStreamBuffer implements BufferedOutput { 15 | 16 | 17 | public UBuffer buf; 18 | 19 | 20 | public OutputStream output; 21 | 22 | 23 | public OutputStreamBuffer(OutputStream outputStream) { 24 | this(outputStream, 8192); 25 | } 26 | 27 | public OutputStreamBuffer(OutputStream outputStream, int i) { 28 | this.output = (OutputStream) MsgUtils.requireNonNull(outputStream, "输出位空"); 29 | this.buf = UBuffer.allocateBuffer(i); 30 | } 31 | 32 | public void writeBytesWithOffset(byte[] bArr, int i, int i2) throws IOException { 33 | writeBytes(bArr, i, i2); 34 | } 35 | 36 | @Override 37 | public void flush() throws IOException { 38 | this.output.flush(); 39 | } 40 | 41 | 42 | public OutputStream setOutput(OutputStream outputStream) { 43 | OutputStream outputStream2 = this.output; 44 | this.output = outputStream; 45 | return outputStream2; 46 | } 47 | 48 | 49 | public void writeBytes(byte[] bArr, int i, int i2) throws IOException { 50 | this.output.write(bArr, i, i2); 51 | } 52 | 53 | 54 | @Override 55 | public void close() throws IOException { 56 | this.output.close(); 57 | } 58 | 59 | 60 | public UBuffer allocateBuffer(int i) { 61 | if (this.buf.remaining() < i) { 62 | this.buf = UBuffer.allocateBuffer(i); 63 | } 64 | return this.buf; 65 | } 66 | 67 | 68 | public void writeInt(int i) throws IOException { 69 | writeBytes(this.buf.getBackingArray(), this.buf.calculatePosition(), i); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /heypixel/buffer/ReadableChannelBuffer.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.buffer; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.MsgUtils; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import java.io.IOException; 9 | import java.nio.ByteBuffer; 10 | import java.nio.channels.ReadableByteChannel; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class ReadableChannelBuffer implements ILBuffer { 16 | public ReadableByteChannel channel; 17 | public UBuffer buffer; 18 | 19 | public ReadableChannelBuffer(ReadableByteChannel readableByteChannel, int i) { 20 | this.channel = (ReadableByteChannel) MsgUtils.requireNonNull(readableByteChannel, "传入数据通道为空"); 21 | MsgUtils.checkArgumentWithMessage(i > 0, "请传入有效数据: " + i); 22 | this.buffer = UBuffer.allocateBuffer(i); 23 | } 24 | 25 | public ReadableChannelBuffer(ReadableByteChannel readableByteChannel) { 26 | this(readableByteChannel, 8192); 27 | } 28 | 29 | @Override 30 | public void close() throws IOException { 31 | this.channel.close(); 32 | } 33 | 34 | public ReadableByteChannel replaceChannel(ReadableByteChannel readableByteChannel) { 35 | ReadableByteChannel readableByteChannel2 = this.channel; 36 | this.channel = readableByteChannel; 37 | return readableByteChannel2; 38 | } 39 | 40 | public UBuffer getBuffer() throws IOException { 41 | ByteBuffer byteBuffer = this.buffer.getByteBuffer(); 42 | if (this.channel.read(byteBuffer) == -1) { 43 | return null; 44 | } 45 | byteBuffer.flip(); 46 | return this.buffer.sliceBuffer(0, byteBuffer.limit()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /heypixel/check/Base64.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | 8 | 9 | @StringEncryption 10 | @NativeObfuscation 11 | @ControlFlowObfuscation 12 | public class Base64 { 13 | 14 | public static String encodeToString(byte[] bArr) { 15 | return java.util.Base64.getEncoder().encodeToString(bArr); 16 | } 17 | 18 | @NativeObfuscation.Inline 19 | public static byte[] deocde(String str) { 20 | return java.util.Base64.getDecoder().decode(str); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /heypixel/check/EncryptDataC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.value.Value; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.EncryptionUtils; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.HeypixelVarUtils; 8 | import net.minecraft.network.PacketByteBuf; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public class EncryptDataC2SPacket extends HeypixelCheckPacket { 18 | 19 | 20 | public int packetId; 21 | 22 | 23 | public EncryptDataC2SPacket(int i) { 24 | this.packetId = i; 25 | } 26 | 27 | public EncryptDataC2SPacket(PacketByteBuf friendlyByteBuf) { 28 | } 29 | 30 | @Override 31 | public void writeSessionData(DataBuffer dataBuffer) { 32 | try { 33 | dataBuffer.writeObjectData(new Value().setDataFromString(EncryptionUtils.encryptString(manager, String.valueOf(this.packetId)))); 34 | } catch (Exception e) { 35 | //e.printStackTrace(); 36 | } 37 | } 38 | 39 | @Override 40 | public void processBuffer(PacketByteBuf friendlyByteBuf, BufferHelper bufferHelper) { 41 | try { 42 | bufferHelper.writeString(friendlyByteBuf, EncryptionUtils.encryptString(manager, String.valueOf(this.packetId))); 43 | } catch (Exception e) { 44 | HeypixelVarUtils.writeVarLong(friendlyByteBuf, this.packetId); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /heypixel/check/HeypixelCheckPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.Heypixel; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c.*; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.DataBufferUtils; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.HeypixelVarUtils; 10 | import dev.undefinedteam.gensh1n.utils.network.NetPayload; 11 | import io.netty.buffer.Unpooled; 12 | import net.minecraft.client.MinecraftClient; 13 | import net.minecraft.client.network.ClientPlayerEntity; 14 | import net.minecraft.network.PacketByteBuf; 15 | import net.minecraft.util.Identifier; 16 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 17 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 18 | import tech.skidonion.obfuscator.annotations.StringEncryption; 19 | 20 | import java.io.IOException; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import java.util.function.Function; 24 | 25 | 26 | @StringEncryption 27 | @ControlFlowObfuscation 28 | public class HeypixelCheckPacket { 29 | @NativeObfuscation.Inline 30 | public static final String channel = "heypixel:check"; 31 | public static final MinecraftClient mc = MinecraftClient.getInstance(); 32 | 33 | public static BufferHelper helper = Heypixel.bufferHelper; 34 | 35 | @NativeObfuscation.Inline 36 | public static Map> s2cMap = new HashMap<>(); 37 | @NativeObfuscation.Inline 38 | public static Map, Integer> c2sMap = new HashMap<>(); 39 | 40 | protected HeypixelSessionManager manager; 41 | 42 | @NativeObfuscation.Inline 43 | public static void init() { 44 | registerC2S(0, EmptyC2SPacket.class); 45 | registerC2S(1, GameDataC2SPacket.class); 46 | registerC2S(2, HitResultC2SPacket.class); 47 | registerC2S(3, ReflectDataC2SPacket.class); 48 | registerC2S(4, EncryptDataC2SPacket.class); 49 | registerC2S(5, BlockStateC2SPacket.class); 50 | registerC2S(6, ClassesC2SPacket.class); 51 | 52 | registerS2C(100, UnknownS2CPacket::new); 53 | registerS2C(101, HeypixelKeysS2CPacket::new); 54 | registerS2C(102, TokenDataS2CPacket::new); 55 | registerS2C(103, SyncKeysS2CPacket::new); 56 | registerS2C(104, ReflectCheckS2CPacket::new); 57 | registerS2C(105, PlayerListDataS2CPacket::new); 58 | registerS2C(106, BlockPosS2CPacket::new); 59 | registerS2C(107, NeteaseCheckS2CPacket::new); 60 | } 61 | 62 | private static void registerC2S(int id, Class cls) { 63 | c2sMap.put(cls, id); 64 | } 65 | 66 | private static void registerS2C(int id, Function function) { 67 | s2cMap.put(id, function); 68 | } 69 | 70 | public static BufferHelper getHelper() { 71 | return helper; 72 | } 73 | 74 | public static String getChannel() { 75 | return channel; 76 | } 77 | 78 | public static Function newS2CInstance(int i) { 79 | return s2cMap.get(i); 80 | } 81 | 82 | public void handleClass(Class cls) { 83 | } 84 | 85 | public void processBuffer(PacketByteBuf buf, BufferHelper helper) { 86 | } 87 | 88 | public void handleClientSide(ClientPlayerEntity player) { 89 | throw new UnsupportedOperationException("This packet ( " + getPacketId() + ") does not implement a client side handler."); 90 | } 91 | 92 | public PacketByteBuf createPacketBuffer() { 93 | var buf = new PacketByteBuf(Unpooled.buffer()); 94 | HeypixelVarUtils.writeUnsignedInt(buf, getPacketId()); 95 | return buf; 96 | } 97 | 98 | public void sendCheckPacket() { 99 | try { 100 | DataBuffer buffer = DataBufferUtils.createBuffer(); 101 | buffer.writeStringWithLength(Heypixel.get().clientId.toString()); 102 | buffer.writeStringWithLength(Heypixel.get().getPlayerUUID()); 103 | writeSessionData(buffer); 104 | 105 | var buf = new PacketByteBuf(Unpooled.buffer()); 106 | HeypixelVarUtils.writeUnsignedInt(buf, getPacketId()); 107 | helper.writeByteArray(buf, buffer.getBytes()); 108 | 109 | Identifier channel = new Identifier(getChannel()); 110 | NetPayload.send(channel, buf); 111 | buffer.close(); 112 | 113 | // System.out.println("heypixel: send check packet " + getClass().getName()); 114 | } catch (IOException e) { 115 | throw new RuntimeException(e); 116 | } 117 | } 118 | 119 | public void sendCheckPacketVanilla() { 120 | Identifier channel; 121 | if (manager.getPlayerList() == null || manager.getPlayerList().isEmpty()) { 122 | channel = new Identifier(getChannel()); 123 | } else { 124 | channel = new Identifier(Heypixel.MOD_ID + ":" + manager.convertBytesToString((byte[]) manager.getPlayerList().get(manager.getPlayerCount()))); 125 | } 126 | 127 | var buf = createPacketBuffer(); 128 | processBuffer(buf, getHelper()); 129 | 130 | NetPayload.send(channel, buf); 131 | // System.out.println("heypixel: send check packet vanilla"); 132 | } 133 | 134 | public int getPacketId() { 135 | return c2sMap.getOrDefault(getClass(), -1); 136 | } 137 | 138 | public void writeSessionData(DataBuffer dataBuffer) throws IOException { 139 | } 140 | 141 | public T m(HeypixelSessionManager manager) { 142 | this.manager = manager; 143 | return (T) this; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /heypixel/check/c2s/BlockStateC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelSessionManager; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.value.Value; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 8 | import net.minecraft.block.BlockState; 9 | import net.minecraft.block.SkullBlock; 10 | import net.minecraft.block.WallPlayerSkullBlock; 11 | import net.minecraft.block.entity.BlockEntity; 12 | import net.minecraft.block.entity.SkullBlockEntity; 13 | import net.minecraft.client.MinecraftClient; 14 | import net.minecraft.network.PacketByteBuf; 15 | import net.minecraft.util.math.BlockPos; 16 | import net.minecraft.util.math.Direction; 17 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 18 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 19 | import tech.skidonion.obfuscator.annotations.StringEncryption; 20 | 21 | import java.io.IOException; 22 | 23 | 24 | 25 | @StringEncryption 26 | @ControlFlowObfuscation 27 | public class BlockStateC2SPacket extends HeypixelCheckPacket { 28 | 29 | 30 | public BlockState state; 31 | public String str; 32 | 33 | 34 | public BlockStateC2SPacket(BlockPos blockPos) { 35 | this.state = MinecraftClient.getInstance().world.getBlockState(blockPos); 36 | // if(state.getBlock() == Blocks.PLAYER_HEAD || state.getBlock() == Blocks.PLAYER_HEAD) { 37 | // this.str = ((SkullBlock)state.getBlock()). 38 | // } 39 | 40 | BlockEntity entity = mc.world.getBlockEntity(blockPos); 41 | if (entity != null && entity instanceof SkullBlockEntity sb) { 42 | int var2 = sb.getCachedState().get(SkullBlock.ROTATION); 43 | if (var2 == 15) { 44 | var2 = 0; 45 | } else { 46 | var2++; 47 | } 48 | var2 = (var2 / 4 + 2) % 4; 49 | Direction fac = switch (var2) { 50 | case 0 -> Direction.SOUTH; 51 | case 1 -> Direction.NORTH; 52 | case 2 -> Direction.WEST; 53 | case 3 -> Direction.EAST; 54 | default -> null; 55 | }; 56 | 57 | str = "Block{" + sb.getOwner().getName() + "}[facing=" + (state.getBlock() instanceof WallPlayerSkullBlock ? state.get(WallPlayerSkullBlock.FACING).getDirection().toString() : fac.toString()) + ",type=single,waterlogged=false]"; 58 | } else { 59 | str = state.toString(); 60 | } 61 | } 62 | 63 | 64 | public BlockStateC2SPacket(PacketByteBuf friendlyByteBuf) { 65 | this.state = null; 66 | } 67 | 68 | public static void asyncCheck(HeypixelSessionManager manager, BlockPos blockPos) { 69 | check(manager, blockPos); 70 | } 71 | 72 | public static void check(HeypixelSessionManager manager, BlockPos blockPos) { 73 | new BlockStateC2SPacket(blockPos).m(manager).sendCheckPacket(); 74 | } 75 | 76 | @Override 77 | public void processBuffer(PacketByteBuf friendlyByteBuf, BufferHelper bufferHelper) { 78 | bufferHelper.writeString(friendlyByteBuf, str); 79 | // System.out.println("state: " + str); 80 | } 81 | 82 | @Override 83 | public void writeSessionData(DataBuffer dataBuffer) throws IOException { 84 | dataBuffer.writeObjectData(new Value().setDataFromString(str)); 85 | // System.out.println("state: " + str); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /heypixel/check/c2s/ClassesC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.LongData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.HeypixelVarUtils; 10 | import net.minecraft.network.PacketByteBuf; 11 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 12 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 13 | import tech.skidonion.obfuscator.annotations.StringEncryption; 14 | 15 | import java.util.*; 16 | 17 | 18 | @StringEncryption 19 | @ControlFlowObfuscation 20 | public class ClassesC2SPacket extends HeypixelCheckPacket { 21 | public int size3; 22 | public int size2; 23 | public int size1; 24 | public int size; 25 | public int id; 26 | public Object obj; 27 | 28 | public ClassesC2SPacket(PacketByteBuf buf) { 29 | this.id = -2; 30 | this.size = -1; 31 | this.size1 = -1; 32 | this.size2 = -1; 33 | this.size3 = -1; 34 | this.obj = new HashSet(); 35 | } 36 | 37 | public ClassesC2SPacket(int i, int i2, Object obj, int i3, int i4, int i5) { 38 | this.id = i; 39 | this.size = i2; 40 | this.obj = obj; 41 | this.size1 = i3; 42 | this.size2 = i4; 43 | this.size3 = i5; 44 | } 45 | 46 | @Override 47 | public void processBuffer(PacketByteBuf buf, BufferHelper bufferHelper) { 48 | HeypixelVarUtils.writeVarInt(buf, this.id); 49 | HeypixelVarUtils.writeUnsignedInt(buf, this.size); 50 | HeypixelVarUtils.writeUnsignedInt(buf, this.size1); 51 | HeypixelVarUtils.writeUnsignedInt(buf, this.size2); 52 | HeypixelVarUtils.writeUnsignedInt(buf, this.size3); 53 | if (this.obj instanceof Set) { 54 | ArrayList arrayList = new ArrayList<>((Set) this.obj); 55 | Collections.shuffle(arrayList); 56 | bufferHelper.writeStringCollection(buf, arrayList.subList(0, Math.min(arrayList.size(), 30))); 57 | } 58 | Object obj = this.obj; 59 | if (obj instanceof HashMap hashMap) { 60 | bufferHelper.writeStringCollection(buf, new ArrayList<>(((HashMap) hashMap).keySet())); 61 | bufferHelper.writeStringCollection(buf, new ArrayList<>(((HashMap) hashMap).values())); 62 | } 63 | } 64 | 65 | @Override 66 | public void writeSessionData(DataBuffer buf) { 67 | try { 68 | buf.writeObjectData(new LongData(this.id)); 69 | buf.writeObjectData(new LongData(this.size)); 70 | buf.writeObjectData(new LongData(this.size1)); 71 | buf.writeObjectData(new LongData(this.size2)); 72 | buf.writeObjectData(new LongData(this.size3)); 73 | buf.writeObjectData(new LongData(System.currentTimeMillis())); 74 | 75 | if (this.obj instanceof Set) { 76 | ArrayList classes = new ArrayList<>((Set) this.obj); 77 | Collections.shuffle(classes); 78 | List subbedClasses = classes.subList(0, Math.min(classes.size(), 20)); 79 | ArrayList classesList = new ArrayList<>(); 80 | for (var o : subbedClasses) { 81 | classesList.add(DataFactory.ofBuffer(o)); 82 | } 83 | 84 | buf.writeObjectData(DataFactory.ofList(classesList)); 85 | } else { 86 | Object obj = this.obj; 87 | if (obj instanceof HashMap map) { 88 | List> classes = new ArrayList<>(map.entrySet()); 89 | Collections.shuffle(classes); 90 | List> subbedClasses = classes.subList(0, Math.min(20, classes.size())); 91 | HashMap classesMap = new HashMap<>(); 92 | for (Map.Entry entry : subbedClasses) { 93 | classesMap.put( 94 | DataFactory.ofBuffer(entry.getKey()), 95 | DataFactory.ofBuffer( 96 | entry.getValue() == null ? "null" : entry.getValue() 97 | )); 98 | } 99 | buf.writeObjectData(DataFactory.ofMap(classesMap)); 100 | } 101 | } 102 | } catch (Throwable th) { 103 | th.printStackTrace(); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /heypixel/check/c2s/EmptyC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 4 | import net.minecraft.network.PacketByteBuf; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public class EmptyC2SPacket extends HeypixelCheckPacket { 12 | public EmptyC2SPacket(PacketByteBuf friendlyByteBuf) { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /heypixel/check/c2s/GameDataC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.Heypixel; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelSessionManager; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.value.Value; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.HeypixelVarUtils; 10 | import net.minecraft.client.MinecraftClient; 11 | import net.minecraft.client.network.ClientPlayerEntity; 12 | import net.minecraft.entity.Entity; 13 | import net.minecraft.network.PacketByteBuf; 14 | import net.minecraft.util.hit.HitResult; 15 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 16 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 17 | import tech.skidonion.obfuscator.annotations.StringEncryption; 18 | 19 | import java.io.IOException; 20 | import java.util.List; 21 | import java.util.UUID; 22 | 23 | 24 | @StringEncryption 25 | @ControlFlowObfuscation 26 | public class GameDataC2SPacket extends HeypixelCheckPacket { 27 | 28 | 29 | public Entity entity; 30 | 31 | 32 | public ClientPlayerEntity player; 33 | 34 | 35 | public HitResult hitResult; 36 | 37 | public GameDataC2SPacket(ClientPlayerEntity player, Entity entity) { 38 | this.player = player; 39 | this.entity = entity; 40 | this.hitResult = mc.crosshairTarget; 41 | } 42 | 43 | 44 | public GameDataC2SPacket(PacketByteBuf friendlyByteBuf) { 45 | } 46 | 47 | public static void check(HeypixelSessionManager manager, ClientPlayerEntity player, Entity entity) { 48 | var minecraft = MinecraftClient.getInstance(); 49 | if (minecraft.getCameraEntity() == null || minecraft.world == null || mc.crosshairTarget == null) { 50 | return; 51 | } 52 | new GameDataC2SPacket(player, entity).m(manager).sendCheckPacketVanilla(); 53 | } 54 | 55 | 56 | @Override 57 | public void writeSessionData(DataBuffer dataBuffer) { 58 | try { 59 | var uuid = this.entity.getUuidAsString().equals(Heypixel.get().getPlayerUUID()) ? Heypixel.get().getPlayerUUID() : entity.getUuidAsString(); 60 | dataBuffer.writeObjectData(new Value().setDataFromString(uuid)); 61 | dataBuffer.writeSignedVarInt(this.hitResult.getType().ordinal()); 62 | dataBuffer.writeDoubleLE(this.hitResult.getPos().x); 63 | dataBuffer.writeDoubleLE(this.hitResult.getPos().y); 64 | dataBuffer.writeDoubleLE(this.hitResult.getPos().z); 65 | dataBuffer.writeObjectData(new Value().setDataFromLong(this.player.getPose().ordinal())); 66 | dataBuffer.writeObjectData(new Value().setListData( 67 | List.of( 68 | new Value().setDataFromDouble(this.player.getPos().x), 69 | new Value().setDataFromDouble(this.player.getPos().y), 70 | new Value().setDataFromDouble(this.player.getPos().z) 71 | ))); 72 | dataBuffer.writeFloatLE(this.player.getRotationClient().x); 73 | dataBuffer.writeFloatLE(this.player.getRotationClient().y); 74 | 75 | dataBuffer.writeSignedVarInt(this.entity.getPose().ordinal()); 76 | dataBuffer.writeDoubleLE(this.entity.getPos().x); 77 | dataBuffer.writeDoubleLE(this.entity.getPos().y); 78 | dataBuffer.writeDoubleLE(this.entity.getPos().z); 79 | dataBuffer.writeObjectData(new Value().setDataFromFloat(this.entity.getRotationClient().x)); 80 | dataBuffer.writeObjectData(new Value().setDataFromFloat(this.entity.getRotationClient().y)); 81 | } catch (IOException e) { 82 | } 83 | } 84 | 85 | @Override 86 | public void processBuffer(PacketByteBuf buf, BufferHelper bufferHelper) { 87 | var uuid = this.entity.getUuidAsString().equals(Heypixel.get().getPlayerUUID()) ? Heypixel.get().getPlayerUUID() : entity.getUuidAsString(); 88 | bufferHelper.writeUUID(buf, UUID.fromString(uuid)); 89 | HeypixelVarUtils.writeVarInt(buf, this.hitResult.getType().ordinal()); 90 | bufferHelper.writeVec3(buf, this.hitResult.getPos()); 91 | 92 | bufferHelper.writeEnum(buf, this.player.getPose()); 93 | bufferHelper.writeVec3(buf, this.player.getPos()); 94 | bufferHelper.writeVec2(buf, this.player.getRotationClient()); 95 | 96 | bufferHelper.writeEnum(buf, this.entity.getPose()); 97 | bufferHelper.writeVec3(buf, this.entity.getPos()); 98 | bufferHelper.writeVec2(buf, this.entity.getRotationClient()); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /heypixel/check/c2s/HitResultC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.value.Value; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 7 | import net.minecraft.client.MinecraftClient; 8 | import net.minecraft.client.network.ClientPlayerEntity; 9 | import net.minecraft.network.PacketByteBuf; 10 | import net.minecraft.util.Hand; 11 | import net.minecraft.util.hit.BlockHitResult; 12 | import net.minecraft.world.GameMode; 13 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 14 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 15 | import tech.skidonion.obfuscator.annotations.StringEncryption; 16 | 17 | import java.io.IOException; 18 | import java.util.List; 19 | 20 | 21 | @StringEncryption 22 | @ControlFlowObfuscation 23 | public class HitResultC2SPacket extends HeypixelCheckPacket { 24 | 25 | 26 | public static long delay; 27 | public Hand hand; 28 | public BlockHitResult hitResult; 29 | 30 | 31 | public ClientPlayerEntity player; 32 | 33 | public HitResultC2SPacket(PacketByteBuf friendlyByteBuf) { 34 | } 35 | 36 | 37 | public HitResultC2SPacket(ClientPlayerEntity localPlayer, Hand interactionHand, BlockHitResult blockHitResult) { 38 | this.player = localPlayer; 39 | this.hand = interactionHand; 40 | this.hitResult = blockHitResult; 41 | } 42 | 43 | public static void check(ClientPlayerEntity localPlayer, Hand clientLevel, Hand interactionHand, BlockHitResult blockHitResult, GameMode gameType) { 44 | var minecraft = MinecraftClient.getInstance(); 45 | var cameraEntity = minecraft.getCameraEntity(); 46 | if (System.currentTimeMillis() < delay || cameraEntity == null || minecraft.world == null || gameType.equals(GameMode.SPECTATOR) || blockHitResult == null) { 47 | return; 48 | } 49 | delay = System.currentTimeMillis() + 10; 50 | new HitResultC2SPacket(localPlayer, interactionHand, blockHitResult).sendCheckPacketVanilla(); 51 | } 52 | 53 | @Override 54 | public void processBuffer(PacketByteBuf buf, BufferHelper bufferHelper) { 55 | bufferHelper.writeVec3(buf, this.player.getPos()); 56 | buf.writeEnumConstant(this.hand); 57 | bufferHelper.writeBlockHitResult(buf, this.hitResult); 58 | } 59 | 60 | @Override 61 | public void writeSessionData(DataBuffer dataBuffer) { 62 | try { 63 | dataBuffer.writeObjectData(new Value().setListData( 64 | List.of( 65 | new Value().setDataFromDouble(this.player.getPos().x), 66 | new Value().setDataFromDouble(this.player.getPos().y), 67 | new Value().setDataFromDouble(this.player.getPos().z) 68 | ))); 69 | dataBuffer.writeSignedVarInt(this.hitResult.getSide().ordinal()); 70 | dataBuffer.writeSignedVarInt(this.hitResult.getType().ordinal()); 71 | dataBuffer.writeFloatLE((float) (this.hitResult.getPos().x - this.hitResult.getBlockPos().getX())); 72 | dataBuffer.writeFloatLE((float) (this.hitResult.getPos().y - this.hitResult.getBlockPos().getY())); 73 | dataBuffer.writeFloatLE((float) (this.hitResult.getPos().z - this.hitResult.getBlockPos().getZ())); 74 | dataBuffer.writeObjectData(new Value().setDataFromFloat(MinecraftClient.getInstance().player.getPitch())); 75 | dataBuffer.writeObjectData(new Value().setDataFromFloat(MinecraftClient.getInstance().player.getYaw())); 76 | } catch (IOException e) { 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /heypixel/check/c2s/ReflectDataC2SPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.JsonParser; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.Heypixel; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelSessionManager; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBuffer; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.value.Value; 10 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.BufferHelper; 11 | import net.minecraft.network.PacketByteBuf; 12 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 13 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 14 | import tech.skidonion.obfuscator.annotations.StringEncryption; 15 | 16 | import java.io.IOException; 17 | import java.util.Iterator; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | 22 | @StringEncryption 23 | @ControlFlowObfuscation 24 | public class ReflectDataC2SPacket extends HeypixelCheckPacket { 25 | public static String[] allowedPackages = { 26 | "com.heypixel", 27 | "com.mojang", 28 | "net.minecraft", 29 | "net.minecraftforge", 30 | "cpw.mods", 31 | "org.spongepowered", 32 | "software.bernie.geckolib3", 33 | "me.jellysquid.mods.sodium", 34 | "net.fabricmc.loader", 35 | "repack.joml" 36 | }; 37 | public static Gson GSON = new Gson(); 38 | public String jsonData; 39 | 40 | 41 | public ReflectDataC2SPacket(String str) { 42 | try { 43 | this.jsonData = str; 44 | // System.out.println("action: " + str); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | this.jsonData = ""; 48 | } 49 | } 50 | 51 | 52 | public ReflectDataC2SPacket(PacketByteBuf friendlyByteBuf) { 53 | } 54 | 55 | public static void sendCheckPacket(HeypixelSessionManager manager, String str) { 56 | new ReflectDataC2SPacket( 57 | !str.startsWith("[{") 58 | ? JsonParser.parseString(str).getAsJsonObject().get(manager.getEncryptKey()).getAsString() 59 | : processJsonAction(str) 60 | ).m(manager).sendCheckPacket(); 61 | } 62 | 63 | public static boolean isAllowedPackage(Map map) { 64 | boolean z = false; 65 | String[] strArr = allowedPackages; 66 | int length = strArr.length; 67 | int i = 0; 68 | while (true) { 69 | if (i >= length) { 70 | break; 71 | } 72 | if (map.get("className").startsWith(strArr[i])) { 73 | z = true; 74 | break; 75 | } 76 | i++; 77 | } 78 | return z; 79 | } 80 | 81 | public static String processJsonAction(String data) { 82 | // System.out.println("check: " + data); 83 | List> var1 = GSON.fromJson(data, List.class); 84 | Object result = null; 85 | 86 | try { 87 | Iterator> iterator = var1.iterator(); 88 | 89 | while (iterator.hasNext()) { 90 | Map map = iterator.next(); 91 | if (!isAllowedPackage(map)) { 92 | return String.valueOf(result); 93 | } 94 | 95 | String action = map.get("action"); 96 | byte actionByte = switch (action) { 97 | case "getEnumOrdinal" -> 1; 98 | default -> 0; 99 | }; 100 | 101 | Class clazz; 102 | switch (actionByte) { 103 | case 0: 104 | return String.valueOf(mc.player.getPlayerListEntry().getProfile().getId()); 105 | case 1: 106 | clazz = Class.forName(map.get("className")); 107 | if (!clazz.isEnum()) { 108 | result = "Error Json!"; 109 | } else { 110 | Object[] enumConstants = clazz.getEnumConstants(); 111 | Object[] constants = enumConstants; 112 | int length = enumConstants.length; 113 | 114 | for (int i = 0; i < length; ++i) { 115 | Object var13 = constants[i]; 116 | if (var13.toString().equals(map.get("enumName"))) { 117 | result = ((Enum) var13).ordinal(); 118 | break; 119 | } 120 | } 121 | } 122 | } 123 | } 124 | 125 | return String.valueOf(result); 126 | } catch (Exception e) { 127 | result = "CheckError"; 128 | return String.valueOf(result); 129 | } 130 | } 131 | 132 | @Override 133 | public void writeSessionData(DataBuffer dataBuffer) throws IOException { 134 | dataBuffer.writeObjectData(new Value().setDataFromString(this.jsonData)); 135 | dataBuffer.writeObjectData(new Value().setDataFromString(Heypixel.get().getPlayerUUID())); 136 | } 137 | 138 | @Override 139 | public void processBuffer(PacketByteBuf buf, BufferHelper bufferHelper) { 140 | bufferHelper.writeString(buf, this.jsonData); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /heypixel/check/s2c/BlockPosS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.Heypixel; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBufferProcessor; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s.BlockStateC2SPacket; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.DataBufferUtils; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 10 | import net.minecraft.client.network.ClientPlayerEntity; 11 | import net.minecraft.network.PacketByteBuf; 12 | import net.minecraft.util.math.BlockPos; 13 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 14 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 15 | import tech.skidonion.obfuscator.annotations.StringEncryption; 16 | 17 | import java.io.IOException; 18 | 19 | 20 | @StringEncryption 21 | @ControlFlowObfuscation 22 | public class BlockPosS2CPacket extends HeypixelCheckPacket { 23 | 24 | 25 | public BlockPos blockPos; 26 | 27 | public BlockPosS2CPacket(PacketByteBuf buf) { 28 | try { 29 | DataBufferProcessor processor = DataBufferUtils.create(helper.readByteArray(buf)); 30 | DataRetriever uuid = processor.readObject(); 31 | DataRetriever posX = processor.readObject(); 32 | DataRetriever posY = processor.readObject(); 33 | DataRetriever posZ = processor.readObject(); 34 | if (uuid.retrieveBytesData().toString().equals(Heypixel.get().getPlayerUUID())) { 35 | this.blockPos = new BlockPos( 36 | posX.retrieveLongNumber().toInt(), 37 | posY.retrieveLongNumber().toInt(), 38 | posZ.retrieveLongNumber().toInt() 39 | ); 40 | } else { 41 | this.blockPos = new BlockPos( 42 | processor.readObject().retrieveLongNumber().toInt(), 43 | processor.readObject().retrieveLongNumber().toInt(), 44 | processor.readObject().retrieveLongNumber().toInt() 45 | ); 46 | } 47 | processor.close(); 48 | } catch (IOException e) { 49 | throw new RuntimeException(e); 50 | } 51 | } 52 | 53 | 54 | @Override 55 | public void handleClientSide(ClientPlayerEntity player) { 56 | BlockStateC2SPacket.asyncCheck(manager, this.blockPos); 57 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacket(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /heypixel/check/s2c/HeypixelKeysS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import net.minecraft.client.network.ClientPlayerEntity; 6 | import net.minecraft.network.PacketByteBuf; 7 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 8 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 9 | import tech.skidonion.obfuscator.annotations.StringEncryption; 10 | 11 | import java.util.List; 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class HeypixelKeysS2CPacket extends HeypixelCheckPacket { 17 | public byte[] unknownBytes; 18 | public byte[] encryptModeA; 19 | public List keys; 20 | public byte[] encryptKey; 21 | public byte[] serverToken; 22 | public List unknownArr; 23 | public byte[] encryptModeB; 24 | public byte[] clientToken; 25 | public byte[] serverId; 26 | 27 | 28 | public HeypixelKeysS2CPacket(PacketByteBuf buf) { 29 | this.unknownArr = helper.readUnsignedByteList(buf); 30 | this.keys = helper.readUnsignedByteList(buf); 31 | this.encryptModeA = helper.readByteArray(buf); 32 | this.encryptModeB = helper.readByteArray(buf); 33 | this.unknownBytes = helper.readByteArray(buf); 34 | this.clientToken = helper.readByteArray(buf); 35 | this.serverId = helper.readByteArray(buf); 36 | this.serverToken = helper.readByteArray(buf); 37 | this.encryptKey = helper.readByteArray(buf); 38 | 39 | } 40 | 41 | @Override 42 | public void handleClientSide(ClientPlayerEntity player) { 43 | manager.unknownArray = this.unknownArr.stream().mapToInt(Integer::intValue).toArray(); 44 | manager.decodeKeys = this.keys.stream().mapToInt(Integer::intValue).toArray(); 45 | manager.encryptMode1 = this.encryptModeA; 46 | manager.encryptMode = this.encryptModeB; 47 | manager.unknownBytes = this.unknownBytes; 48 | manager.clientToken = this.clientToken; 49 | manager.serverId = this.serverId; 50 | manager.serverToken = this.serverToken; 51 | manager.encryptionKey = this.encryptKey; 52 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacketVanilla(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /heypixel/check/s2c/NeteaseCheckS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 4 | import net.minecraft.network.PacketByteBuf; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.lang.reflect.Method; 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public class NeteaseCheckS2CPacket extends HeypixelCheckPacket { 15 | public NeteaseCheckS2CPacket(PacketByteBuf friendlyByteBuf) { 16 | try { 17 | Method declaredMethod = Class.forName("com.netease.mc.mod.fullscreenpopup.ToggleFullscreenTransformer").getDeclaredMethod("showGameStorePopup"); 18 | declaredMethod.setAccessible(true); 19 | declaredMethod.invoke(null); 20 | } catch (Exception e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /heypixel/check/s2c/PlayerListDataS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.HeypixelVarUtils; 6 | import net.minecraft.client.network.ClientPlayerEntity; 7 | import net.minecraft.network.PacketByteBuf; 8 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 9 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 10 | import tech.skidonion.obfuscator.annotations.StringEncryption; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class PlayerListDataS2CPacket extends HeypixelCheckPacket { 19 | 20 | 21 | public List playerList = new ArrayList<>(); 22 | 23 | 24 | public int playerCount; 25 | 26 | public PlayerListDataS2CPacket(PacketByteBuf buf) { 27 | int readVarInt = HeypixelVarUtils.readVarInt(buf); 28 | for (int i = 0; i < readVarInt; i++) { 29 | this.playerList.add(helper.readByteArray(buf)); 30 | } 31 | this.playerCount = HeypixelVarUtils.readVarInt(buf); 32 | } 33 | 34 | 35 | @Override 36 | public void handleClientSide(ClientPlayerEntity player) { 37 | manager.setSessionData(this); 38 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacketVanilla(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /heypixel/check/s2c/ReflectCheckS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.c2s.ReflectDataC2SPacket; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.DataBufferUtils; 7 | import net.minecraft.client.network.ClientPlayerEntity; 8 | import net.minecraft.network.PacketByteBuf; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.util.UUID; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class ReflectCheckS2CPacket extends HeypixelCheckPacket { 19 | 20 | 21 | public UUID uuid; 22 | 23 | 24 | public String data; 25 | 26 | 27 | public ReflectCheckS2CPacket(PacketByteBuf friendlyByteBuf) { 28 | try { 29 | var invoke = DataBufferUtils.create( 30 | helper.readByteArray(friendlyByteBuf) 31 | ); 32 | 33 | var invoke2 = invoke.readObject(); 34 | var invoke3 = invoke.readObject(); 35 | if (invoke2 == null) { 36 | throw new NullPointerException("Rid is null"); 37 | } 38 | this.uuid = UUID.fromString(invoke2.toString()); 39 | this.data = invoke3.toString(); 40 | invoke.close(); 41 | } catch (Throwable th) { 42 | if (this.uuid == null) { 43 | this.uuid = UUID.randomUUID(); 44 | } 45 | if (this.data == null) { 46 | this.data = UUID.randomUUID().toString(); 47 | } 48 | throw new RuntimeException(th); 49 | } 50 | } 51 | 52 | @Override 53 | public void handleClientSide(ClientPlayerEntity player) { 54 | if (this.data.equals("SCI")) { // Send Client Info 55 | manager.asyncSendClientData(); 56 | } else { 57 | ReflectDataC2SPacket.sendCheckPacket(manager, this.data); 58 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacket(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /heypixel/check/s2c/SyncKeysS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import net.minecraft.client.network.ClientPlayerEntity; 6 | import net.minecraft.network.PacketByteBuf; 7 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 8 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 9 | import tech.skidonion.obfuscator.annotations.StringEncryption; 10 | 11 | import java.util.Arrays; 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class SyncKeysS2CPacket extends HeypixelCheckPacket { 17 | 18 | 19 | public byte[] keyListB; 20 | 21 | 22 | public byte[] keyListC; 23 | 24 | 25 | public byte[] keyB; 26 | 27 | 28 | public byte[] keyA; 29 | 30 | 31 | public byte[] keyC; 32 | 33 | 34 | public byte[] keyListA; 35 | 36 | 37 | public SyncKeysS2CPacket(PacketByteBuf buf) { 38 | this.keyA = helper.readByteArray(buf); 39 | this.keyListA = helper.readByteArray(buf); 40 | this.keyB = helper.readByteArray(buf); 41 | this.keyListB = helper.readByteArray(buf); 42 | this.keyC = helper.readByteArray(buf); 43 | this.keyListC = helper.readByteArray(buf); 44 | } 45 | 46 | @Override 47 | public void handleClientSide(ClientPlayerEntity player) { 48 | manager.processSyncKeys(this); 49 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacketVanilla(); 50 | } 51 | 52 | public String toString() { 53 | return "SyncKeysPacket(keyA=" + 54 | Arrays.toString(this.keyA) + 55 | ", keyListA=" + Arrays.toString(this.keyListA) + ", " + 56 | "keyB=" + Arrays.toString(this.keyB) + 57 | ", keyListB=" + Arrays.toString(this.keyListB) + 58 | ", keyC=" + Arrays.toString(this.keyC) + 59 | ", keyListC=" + Arrays.toString(this.keyListC) + ")"; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /heypixel/check/s2c/TokenDataS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.Base64; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 6 | import net.minecraft.client.network.ClientPlayerEntity; 7 | import net.minecraft.network.PacketByteBuf; 8 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 9 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 10 | import tech.skidonion.obfuscator.annotations.StringEncryption; 11 | 12 | import java.nio.charset.StandardCharsets; 13 | 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public class TokenDataS2CPacket extends HeypixelCheckPacket { 18 | public byte[] keyA; 19 | public byte[] ketC; 20 | public byte[] keyB; 21 | 22 | public TokenDataS2CPacket(PacketByteBuf friendlyByteBuf) { 23 | this.keyA = helper.readByteArray(friendlyByteBuf); 24 | this.keyB = helper.readByteArray(friendlyByteBuf); 25 | this.ketC = helper.readByteArray(friendlyByteBuf); 26 | } 27 | 28 | 29 | @Override 30 | public void handleClientSide(ClientPlayerEntity player) { 31 | var r0 = new String(this.keyA, StandardCharsets.UTF_8); 32 | var r1 = new String(this.keyB, StandardCharsets.UTF_8); 33 | var r2 = new String(this.ketC, StandardCharsets.UTF_8); 34 | 35 | var s1 = new String(Base64.deocde(r0), StandardCharsets.UTF_8); 36 | var s2 = new String(Base64.deocde(r1), StandardCharsets.UTF_8); 37 | var s3 = new String(Base64.deocde(r2), StandardCharsets.UTF_8); 38 | 39 | var splitStr = " "; 40 | for (char c : s1.toCharArray()) { 41 | try { 42 | Integer.valueOf(c + ""); 43 | } catch (NumberFormatException e) { 44 | splitStr = c + ""; 45 | break; 46 | } 47 | } 48 | 49 | String[] split = s1.split(splitStr); 50 | String[] split2 = s2.split(splitStr); 51 | String[] split3 = s3.split(splitStr); 52 | 53 | manager.tokenMap.put(manager.decodeString(split[0]), manager.decodeString(split[1])); 54 | manager.tokenMap.put(manager.decodeString(split2[0]), manager.decodeString(split2[1])); 55 | manager.tokenMap.put(manager.decodeString(split3[0]), manager.decodeString(split3[1])); 56 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacketVanilla(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /heypixel/check/s2c/UnknownS2CPacket.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.check.s2c; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.EncryptDataC2SPacket; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelCheckPacket; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.DataBufferProcessor; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.DataBufferUtils; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 8 | import net.minecraft.network.PacketByteBuf; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | import java.util.UUID; 15 | 16 | 17 | @StringEncryption 18 | @ControlFlowObfuscation 19 | public class UnknownS2CPacket extends HeypixelCheckPacket { 20 | 21 | 22 | public UUID uuid; 23 | public Long field_9461; 24 | 25 | public UnknownS2CPacket(PacketByteBuf friendlyByteBuf) { 26 | try { 27 | DataBufferProcessor processor = DataBufferUtils.create(helper.readByteArray(friendlyByteBuf)); 28 | DataRetriever obj = processor.readObject(); 29 | DataRetriever obj1 = processor.readObject(); 30 | this.uuid = UUID.fromString(obj.retrieveBytesData().toString()); 31 | this.field_9461 = obj1.retrieveLongNumber().getLong(); 32 | new EncryptDataC2SPacket(getPacketId()).m(manager).sendCheckPacket(); 33 | processor.close(); 34 | } catch (IOException e) { 35 | throw new RuntimeException(e); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataArrCollection.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.AbstractCollection; 7 | import java.util.Iterator; 8 | 9 | public class ObjectDataArrCollection extends AbstractCollection { 10 | public T[] dataArr; 11 | 12 | public ObjectDataArrCollection(T[] objectDataArr) { 13 | this.dataArr = objectDataArr; 14 | } 15 | 16 | @Override 17 | public int size() { 18 | return this.dataArr.length / 2; 19 | } 20 | 21 | @Override 22 | public Iterator iterator() { 23 | return new ObjectDataIterator<>(this.dataArr, 1); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataArrMap.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.AbstractMap; 7 | import java.util.Map; 8 | import java.util.Set; 9 | 10 | public class ObjectDataArrMap extends AbstractMap { 11 | public T[] arr; 12 | 13 | public ObjectDataArrMap(T[] objectDataArr) { 14 | this.arr = objectDataArr; 15 | } 16 | 17 | @Override 18 | public Set> entrySet() { 19 | return new ObjectDataEntrySet<>(this.arr); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataEntryIterator.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.AbstractMap; 7 | import java.util.Iterator; 8 | import java.util.Map; 9 | import java.util.NoSuchElementException; 10 | 11 | public class ObjectDataEntryIterator implements Iterator> { 12 | public T[] arr; 13 | public int index = 0; 14 | 15 | public ObjectDataEntryIterator(T[] objectDataArr) { 16 | this.arr = objectDataArr; 17 | } 18 | 19 | @Override 20 | public boolean hasNext() { 21 | return this.index < this.arr.length; 22 | } 23 | 24 | public Map.Entry next0() { 25 | if (this.index >= this.arr.length) { 26 | throw new NoSuchElementException(); 27 | } 28 | T objectData = this.arr[this.index]; 29 | T[] objectDataArr = this.arr; 30 | int i = this.index; 31 | Map.Entry simpleImmutableEntry = new AbstractMap.SimpleImmutableEntry<>( 32 | objectData, 33 | objectDataArr[(i | 1) + ((1 | ((-i) - 1)) - ((-i) - 1))] 34 | ); 35 | int i2 = this.index; 36 | this.index = (i2 | 2) + ((2 | ((-i2) - 1)) - ((-i2) - 1)); 37 | return simpleImmutableEntry; 38 | } 39 | 40 | @Override 41 | public void remove() { 42 | throw new UnsupportedOperationException(); 43 | } 44 | 45 | @Override 46 | public Map.Entry next() { 47 | return next0(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataEntrySet.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.AbstractSet; 7 | import java.util.Iterator; 8 | import java.util.Map; 9 | 10 | public class ObjectDataEntrySet extends AbstractSet> { 11 | public T[] arr; 12 | 13 | public ObjectDataEntrySet(T[] objectDataArr) { 14 | this.arr = objectDataArr; 15 | } 16 | 17 | 18 | public Iterator> iterator() { 19 | return new ObjectDataEntryIterator<>(this.arr); 20 | } 21 | 22 | public int size() { 23 | return this.arr.length / 2; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataIterator.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.Iterator; 7 | import java.util.NoSuchElementException; 8 | 9 | public class ObjectDataIterator implements Iterator { 10 | public T[] arr; 11 | public int index; 12 | 13 | 14 | public ObjectDataIterator(T[] objectDataArr, int i) { 15 | this.arr = objectDataArr; 16 | this.index = i; 17 | } 18 | 19 | public T next0() { 20 | int i = this.index; 21 | if (i >= this.arr.length) { 22 | throw new NoSuchElementException(); 23 | } 24 | this.index = i + 2; 25 | return this.arr[i]; 26 | } 27 | 28 | @Override 29 | public void remove() { 30 | throw new UnsupportedOperationException(); 31 | } 32 | 33 | @Override 34 | public boolean hasNext() { 35 | return this.index < this.arr.length; 36 | } 37 | 38 | @Override 39 | public T next() { 40 | return next0(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataIterator1.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.Iterator; 8 | import java.util.NoSuchElementException; 9 | 10 | public class ObjectDataIterator1 implements Iterator { 11 | public ObjectData[] arr; 12 | public int index = 0; 13 | 14 | 15 | public ObjectDataIterator1(ObjectData[] objectDataArr) { 16 | this.arr = objectDataArr; 17 | } 18 | 19 | public ObjectData next0() { 20 | int i = this.index; 21 | if (i >= this.arr.length) { 22 | throw new NoSuchElementException(); 23 | } 24 | this.index = ((i | 1) & ((-2) | ((-i) - 1))) + (((1 | ((-i) - 1)) - ((-i) - 1)) * 2); 25 | return this.arr[i]; 26 | } 27 | 28 | @Override 29 | public ObjectData next() { 30 | return next0(); 31 | } 32 | 33 | @Override 34 | public boolean hasNext() { 35 | return this.index != this.arr.length; 36 | } 37 | 38 | @Override 39 | public void remove() { 40 | throw new UnsupportedOperationException(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataList.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.AbstractList; 8 | 9 | public class ObjectDataList extends AbstractList { 10 | public ObjectData[] arr; 11 | 12 | public ObjectDataList(ObjectData[] objectDataArr) { 13 | this.arr = objectDataArr; 14 | } 15 | 16 | public int size() { 17 | return this.arr.length; 18 | } 19 | 20 | 21 | @Override 22 | public ObjectData get(int i) { 23 | return find(i); 24 | } 25 | 26 | public ObjectData find(int i) { 27 | return this.arr[i]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataMap.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.MapRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.util.LinkedHashMap; 11 | import java.util.Map; 12 | 13 | public class ObjectDataMap { 14 | public Map map = new LinkedHashMap<>(); 15 | 16 | public MapRetriever toMapData() { 17 | return DataFactory.ofMap(this.map); 18 | } 19 | 20 | public ObjectDataMap put(ObjectData objectData, ObjectData unMapped72) { 21 | this.map.put(objectData, unMapped72); 22 | return this; 23 | } 24 | 25 | 26 | public ObjectDataMap put(Map.Entry entry) { 27 | put(entry.getKey(), entry.getValue()); 28 | return this; 29 | } 30 | 31 | 32 | public ObjectDataMap putAll(Map map) { 33 | for (Map.Entry objectDataObjectDataEntry : map.entrySet()) { 34 | put(objectDataObjectDataEntry); 35 | } 36 | return this; 37 | } 38 | 39 | 40 | public ObjectDataMap putAll(Iterable> iterable) { 41 | for (var o : iterable) { 42 | put(o.getKey(), o.getValue()); 43 | } 44 | return this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /heypixel/collections/ObjectDataSet.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.util.AbstractSet; 7 | import java.util.Iterator; 8 | 9 | public class ObjectDataSet extends AbstractSet { 10 | public T[] arr; 11 | 12 | public ObjectDataSet(T[] objectDataArr) { 13 | this.arr = objectDataArr; 14 | } 15 | 16 | public int size() { 17 | return this.arr.length / 2; 18 | } 19 | 20 | public Iterator iterator() { 21 | return new ObjectDataIterator<>(this.arr, 0); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /heypixel/collections/StringSet.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.collections; 2 | 3 | import java.util.HashSet; 4 | 5 | public class StringSet extends HashSet { 6 | public String data; 7 | 8 | public StringSet(String str) { 9 | this.data = str; 10 | add("Error Name " + this.data); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/BooleanData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.io.IOException; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class BooleanData extends AbstractDataRetriever implements IBoolData { 16 | public static IBoolData TRUE = new BooleanData(true); 17 | public static IBoolData FALSE = new BooleanData(false); 18 | public boolean value; 19 | 20 | 21 | public BooleanData(boolean z) { 22 | this.value = z; 23 | } 24 | 25 | @Override 26 | public boolean isDoubleType() { 27 | return super.isDoubleType(); 28 | } 29 | 30 | public IBoolData Method6887() { 31 | return this; 32 | } 33 | 34 | @Override 35 | public IHexBytesData retrieveByteArrayData() { 36 | return super.retrieveByteArrayData(); 37 | } 38 | 39 | @Override 40 | public ILongNumberData retrieveLongNumber() { 41 | return super.retrieveLongNumber(); 42 | } 43 | 44 | @Override 45 | public IInstantBytes retrieveInstantData() { 46 | return super.retrieveInstantData(); 47 | } 48 | 49 | @Override 50 | public boolean isListType() { 51 | return super.isListType(); 52 | } 53 | 54 | @Override 55 | public IDoubleData retrieveDoubleData() { 56 | return super.retrieveDoubleData(); 57 | } 58 | 59 | public String getDataAsString() { 60 | return Boolean.toString(this.value); 61 | } 62 | 63 | public DataTypes getValueType() { 64 | return DataTypes.BOOLEAN; 65 | } 66 | 67 | @Override 68 | public boolean isNullable() { 69 | return super.isNullable(); 70 | } 71 | 72 | @Override 73 | public ObjectRetriever getRetriever() { 74 | return super.getRetriever(); 75 | } 76 | 77 | @Override 78 | public IBoolData retrieveBoolean() { 79 | return this; 80 | } 81 | 82 | 83 | @Override 84 | public IDataList retrieveListData() { 85 | return super.retrieveListData(); 86 | } 87 | 88 | 89 | @Override 90 | public boolean isBytesBufType() { 91 | return super.isBytesBufType(); 92 | } 93 | 94 | 95 | public String toString() { 96 | return getDataAsString(); 97 | } 98 | 99 | 100 | @Override 101 | public boolean isInstant1Type() { 102 | return super.isInstant1Type(); 103 | } 104 | 105 | 106 | public DataRetriever getValue() { 107 | return Method6887(); 108 | } 109 | 110 | 111 | @Override 112 | public boolean isMapType() { 113 | return super.isMapType(); 114 | } 115 | 116 | 117 | public void write(MessageBuffer buf) throws IOException { 118 | buf.writeBoolean(this.value); 119 | } 120 | 121 | 122 | @Override 123 | public IBytesData getDefaultType() { 124 | return super.getDefaultType(); 125 | } 126 | 127 | 128 | @Override 129 | public boolean equals(Object obj) { 130 | if (obj == this) { 131 | return true; 132 | } 133 | if (!(obj instanceof ObjectData objectData)) { 134 | return false; 135 | } 136 | return objectData.isBooleanType() && this.value == objectData.getAsBool().getBoolean(); 137 | } 138 | 139 | 140 | @Override 141 | public IBufferData retrieveBytesData() { 142 | return super.retrieveBytesData(); 143 | } 144 | 145 | 146 | @Override 147 | public BytesDataRetriever retrieveBytes() { 148 | return super.retrieveBytes(); 149 | } 150 | 151 | 152 | @Override 153 | public INullData retrieveNullData() { 154 | return super.retrieveNullData(); 155 | } 156 | 157 | 158 | @Override 159 | public boolean isBooleanType() { 160 | return super.isBooleanType(); 161 | } 162 | 163 | 164 | @Override 165 | public IMapData retrieveMapData() { 166 | return super.retrieveMapData(); 167 | } 168 | 169 | 170 | @Override 171 | public boolean isLongType() { 172 | return super.isLongType(); 173 | } 174 | 175 | 176 | @Override 177 | public boolean isInstantType() { 178 | return super.isInstantType(); 179 | } 180 | 181 | 182 | @Override 183 | public boolean isNullType() { 184 | return super.isNullType(); 185 | } 186 | 187 | 188 | @Override 189 | public boolean isVariableLength() { 190 | return super.isVariableLength(); 191 | } 192 | 193 | public boolean getBoolean() { 194 | return this.value; 195 | } 196 | 197 | 198 | @Override 199 | public boolean isBytesType() { 200 | return super.isBytesType(); 201 | } 202 | 203 | 204 | @Override 205 | public BoolRetriever getAsBool() { 206 | return retrieveBoolean(); 207 | } 208 | 209 | public int hashCode() { 210 | return this.value ? 1231 : 1237; 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /heypixel/data/BufferData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.hex.HexEncodedData; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IBufferData; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.ByteBufRetriever; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 8 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 9 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 10 | import tech.skidonion.obfuscator.annotations.StringEncryption; 11 | 12 | import java.io.IOException; 13 | import java.util.Arrays; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class BufferData extends HexEncodedData implements IBufferData { 19 | 20 | public BufferData(byte[] bArr) { 21 | super(bArr); 22 | } 23 | 24 | public BufferData(String str) { 25 | super(str); 26 | } 27 | 28 | public void write(MessageBuffer buf) throws IOException { 29 | buf.writeDirectInt(this.data.length); 30 | buf.writeBytes(this.data); 31 | } 32 | 33 | public int hashCode() { 34 | return Arrays.hashCode(this.data); 35 | } 36 | 37 | public IBufferData getData() { 38 | return this; 39 | } 40 | 41 | @Override 42 | public IBufferData retrieveBytesData() { 43 | return this; 44 | } 45 | 46 | 47 | public DataRetriever getValue() { 48 | return getData(); 49 | } 50 | 51 | 52 | @Override 53 | public ByteBufRetriever getAsBytesBuf() { 54 | return this.retrieveBytesData(); 55 | } 56 | 57 | 58 | @Override 59 | public boolean equals(Object obj) { 60 | if (this == obj) { 61 | return true; 62 | } 63 | if (!(obj instanceof ObjectData objectData)) { 64 | return false; 65 | } 66 | if (!objectData.isBytesBufType()) { 67 | return false; 68 | } 69 | if (!(objectData instanceof BufferData)) { 70 | return Arrays.equals(this.data, objectData.getAsBytesBuf().getBytes()); 71 | } 72 | return Arrays.equals(this.data, ((BufferData) objectData).data); 73 | } 74 | 75 | public DataTypes getValueType() { 76 | return DataTypes.BYTES_BUF; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /heypixel/data/BytesDataProvider.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.nio.ByteBuffer; 8 | 9 | 10 | @StringEncryption 11 | @ControlFlowObfuscation 12 | public interface BytesDataProvider extends ObjectData { 13 | ByteBuffer getByteBuffer(); 14 | 15 | String toString(); 16 | 17 | String getString(); 18 | 19 | byte[] getBytes(); 20 | } 21 | -------------------------------------------------------------------------------- /heypixel/data/DataTypes.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | 8 | @StringEncryption 9 | @ControlFlowObfuscation 10 | public enum DataTypes { 11 | NULL(false, false), 12 | BOOLEAN(false, false), 13 | LONG(true, false), 14 | DOUBLE(true, false), 15 | BYTES_BUF(false, true), 16 | BYTES(false, true), 17 | LIST(false, false), 18 | MAP(false, false), 19 | INSTANT(false, false); 20 | 21 | public boolean isNullable; 22 | public boolean isVariableLength; 23 | 24 | DataTypes(boolean z, boolean z2) { 25 | this.isVariableLength = z; 26 | this.isNullable = z2; 27 | } 28 | 29 | public boolean isBytesBuf() { 30 | return this == BYTES_BUF; 31 | } 32 | 33 | public boolean isMap() { 34 | return this == MAP; 35 | } 36 | 37 | public boolean isInstant() { 38 | return this == INSTANT; 39 | } 40 | 41 | public boolean isBytes() { 42 | return this == BYTES; 43 | } 44 | 45 | public boolean isBoolean() { 46 | return this == BOOLEAN; 47 | } 48 | 49 | public boolean isList() { 50 | return this == LIST; 51 | } 52 | 53 | public boolean isNull() { 54 | return this == NULL; 55 | } 56 | 57 | public boolean isNullable() { 58 | return this.isNullable; 59 | } 60 | 61 | public boolean isLong() { 62 | return this == LONG; 63 | } 64 | 65 | public boolean isDouble() { 66 | return this == DOUBLE; 67 | } 68 | 69 | public boolean isVariableLength() { 70 | return this.isVariableLength; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /heypixel/data/DoubleData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.*; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.io.IOException; 11 | import java.math.BigDecimal; 12 | import java.math.BigInteger; 13 | 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public class DoubleData extends AbstractDataRetriever implements IDoubleData { 18 | 19 | 20 | public double value; 21 | 22 | 23 | public DoubleData(double d) { 24 | this.value = d; 25 | } 26 | 27 | public String toString() { 28 | return Double.toString(this.value); 29 | } 30 | 31 | public long getLong() { 32 | return (long) this.value; 33 | } 34 | 35 | public DataTypes getValueType() { 36 | return DataTypes.DOUBLE; 37 | } 38 | 39 | @Override 40 | public boolean isMapType() { 41 | return super.isMapType(); 42 | } 43 | 44 | @Override 45 | public IBytesData getDefaultType() { 46 | return super.getDefaultType(); 47 | } 48 | 49 | @Override 50 | public boolean isNullType() { 51 | return super.isNullType(); 52 | } 53 | 54 | @Override 55 | public boolean isBytesBufType() { 56 | return super.isBytesBufType(); 57 | } 58 | 59 | public DataRetriever getValue() { 60 | return self(); 61 | } 62 | 63 | @Override 64 | public boolean isListType() { 65 | return super.isListType(); 66 | } 67 | 68 | public String getDataAsString() { 69 | return (Double.isNaN(this.value) || Double.isInfinite(this.value)) ? "null" : Double.toString(this.value); 70 | } 71 | 72 | @Override 73 | public IHexBytesData retrieveByteArrayData() { 74 | return super.retrieveByteArrayData(); 75 | } 76 | 77 | @Override 78 | public IDoubleData retrieveDoubleData() { 79 | return this; 80 | } 81 | 82 | public int getInteger() { 83 | return (int) this.value; 84 | } 85 | 86 | public BigInteger getBigInteger() { 87 | return new BigDecimal(this.value).toBigInteger(); 88 | } 89 | 90 | @Override 91 | public boolean equals(Object obj) { 92 | if (obj == this) { 93 | return true; 94 | } 95 | if (!(obj instanceof ObjectData objectData)) { 96 | return false; 97 | } 98 | return objectData.isDoubleType() && this.value == objectData.getAsDouble().getDouble(); 99 | } 100 | 101 | @Override 102 | public DoubleRetriever getAsDouble() { 103 | return retrieveDoubleData(); 104 | } 105 | 106 | public double getDouble() { 107 | return this.value; 108 | } 109 | 110 | @Override 111 | public IMapData retrieveMapData() { 112 | return super.retrieveMapData(); 113 | } 114 | 115 | @Override 116 | public IDataList retrieveListData() { 117 | return super.retrieveListData(); 118 | } 119 | 120 | @Override 121 | public boolean isNullable() { 122 | return super.isNullable(); 123 | } 124 | 125 | public DoubleData self() { 126 | return this; 127 | } 128 | 129 | public int hashCode() { 130 | return Double.hashCode(this.value); 131 | } 132 | 133 | @Override 134 | public ILongNumberData retrieveLongNumber() { 135 | return super.retrieveLongNumber(); 136 | } 137 | 138 | @Override 139 | public boolean isBooleanType() { 140 | return super.isBooleanType(); 141 | } 142 | 143 | 144 | @Override 145 | public boolean isDoubleType() { 146 | return super.isDoubleType(); 147 | } 148 | 149 | 150 | @Override 151 | public boolean isInstant1Type() { 152 | return super.isInstant1Type(); 153 | } 154 | 155 | 156 | @Override 157 | public NumberValueRetriever getValueRetriever() { 158 | return getRetriever(); 159 | } 160 | 161 | 162 | @Override 163 | public boolean isLongType() { 164 | return super.isLongType(); 165 | } 166 | 167 | public short getShort() { 168 | return (short) this.value; 169 | } 170 | 171 | 172 | @Override 173 | public boolean isVariableLength() { 174 | return super.isVariableLength(); 175 | } 176 | 177 | 178 | @Override 179 | public boolean isInstantType() { 180 | return super.isInstantType(); 181 | } 182 | 183 | 184 | @Override 185 | public boolean isBytesType() { 186 | return super.isBytesType(); 187 | } 188 | 189 | 190 | @Override 191 | public BytesDataRetriever retrieveBytes() { 192 | return super.retrieveBytes(); 193 | } 194 | 195 | @Override 196 | public ObjectRetriever getRetriever() { 197 | return this; 198 | } 199 | 200 | 201 | public void write(MessageBuffer buf) throws IOException { 202 | buf.writeDoubleLE(this.value); 203 | } 204 | 205 | 206 | @Override 207 | public IBoolData retrieveBoolean() { 208 | return super.retrieveBoolean(); 209 | } 210 | 211 | public float getFloat() { 212 | return (float) this.value; 213 | } 214 | 215 | 216 | @Override 217 | public IInstantBytes retrieveInstantData() { 218 | return super.retrieveInstantData(); 219 | } 220 | 221 | 222 | @Override 223 | public IBufferData retrieveBytesData() { 224 | return super.retrieveBytesData(); 225 | } 226 | 227 | public byte getByte() { 228 | return (byte) this.value; 229 | } 230 | 231 | 232 | @Override 233 | public INullData retrieveNullData() { 234 | return super.retrieveNullData(); 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /heypixel/data/NullData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.*; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.io.IOException; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class NullData extends AbstractDataRetriever implements INullData { 16 | public static INullData NULL = new NullData(); 17 | 18 | public static INullData getNULL() { 19 | return NULL; 20 | } 21 | 22 | public DataRetriever getValue() { 23 | return get(); 24 | } 25 | 26 | @Override 27 | public boolean isInstantType() { 28 | return super.isInstantType(); 29 | } 30 | 31 | public void write(MessageBuffer buf) throws IOException { 32 | buf.writeNull(); 33 | } 34 | 35 | @Override 36 | public IMapData retrieveMapData() { 37 | return super.retrieveMapData(); 38 | } 39 | 40 | public INullData get() { 41 | return this; 42 | } 43 | 44 | public int hashCode() { 45 | return 0; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object obj) { 50 | if (obj == this) { 51 | return true; 52 | } 53 | if (obj instanceof ObjectData) { 54 | return ((ObjectData) obj).isNullType(); 55 | } 56 | return false; 57 | } 58 | 59 | @Override 60 | public boolean isListType() { 61 | return super.isListType(); 62 | } 63 | 64 | @Override 65 | public IInstantBytes retrieveInstantData() { 66 | return super.retrieveInstantData(); 67 | } 68 | 69 | public String toString() { 70 | return getDataAsString(); 71 | } 72 | 73 | @Override 74 | public IDataList retrieveListData() { 75 | return super.retrieveListData(); 76 | } 77 | 78 | @Override 79 | public boolean isMapType() { 80 | return super.isMapType(); 81 | } 82 | 83 | @Override 84 | public IBoolData retrieveBoolean() { 85 | return super.retrieveBoolean(); 86 | } 87 | 88 | @Override 89 | public boolean isInstant1Type() { 90 | return super.isInstant1Type(); 91 | } 92 | 93 | @Override 94 | public boolean isBooleanType() { 95 | return super.isBooleanType(); 96 | } 97 | 98 | @Override 99 | public ILongNumberData retrieveLongNumber() { 100 | return super.retrieveLongNumber(); 101 | } 102 | 103 | @Override 104 | public BytesDataRetriever retrieveBytes() { 105 | return super.retrieveBytes(); 106 | } 107 | 108 | @Override 109 | public IHexBytesData retrieveByteArrayData() { 110 | return super.retrieveByteArrayData(); 111 | } 112 | 113 | @Override 114 | public boolean isBytesType() { 115 | return super.isBytesType(); 116 | } 117 | 118 | @Override 119 | public NullRetriever getAsNull() { 120 | return this.retrieveNullData(); 121 | } 122 | 123 | @Override 124 | public INullData retrieveNullData() { 125 | return this; 126 | } 127 | 128 | @Override 129 | public boolean isNullable() { 130 | return super.isNullable(); 131 | } 132 | 133 | @Override 134 | public IDoubleData retrieveDoubleData() { 135 | return super.retrieveDoubleData(); 136 | } 137 | 138 | @Override 139 | public ObjectRetriever getRetriever() { 140 | return super.getRetriever(); 141 | } 142 | 143 | @Override 144 | public boolean isNullType() { 145 | return super.isNullType(); 146 | } 147 | 148 | @Override 149 | public boolean isLongType() { 150 | return super.isLongType(); 151 | } 152 | 153 | @Override 154 | public boolean isBytesBufType() { 155 | return super.isBytesBufType(); 156 | } 157 | 158 | public String getDataAsString() { 159 | return "null"; 160 | } 161 | 162 | @Override 163 | public boolean isDoubleType() { 164 | return super.isDoubleType(); 165 | } 166 | 167 | public DataTypes getValueType() { 168 | return DataTypes.NULL; 169 | } 170 | 171 | 172 | @Override 173 | public IBufferData retrieveBytesData() { 174 | return super.retrieveBytesData(); 175 | } 176 | 177 | 178 | @Override 179 | public boolean isVariableLength() { 180 | return super.isVariableLength(); 181 | } 182 | 183 | 184 | @Override 185 | public IBytesData getDefaultType() { 186 | return super.getDefaultType(); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /heypixel/data/ObjectData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.io.IOException; 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public interface ObjectData { 15 | DataRetriever getValue(); 16 | 17 | PayloadRetriever getAsPayload(); 18 | 19 | boolean isInstant1Type(); 20 | 21 | InstantRetriever getAsInstant(); 22 | 23 | BytesRetriever getAsByteArr(); 24 | 25 | boolean isNullType(); 26 | 27 | DataTypes getValueType(); 28 | 29 | BytesDataProvider getAsBytes(); 30 | 31 | boolean isMapType(); 32 | 33 | MapRetriever getAsMap(); 34 | 35 | boolean isBytesType(); 36 | 37 | DataListRetriever getAsList(); 38 | 39 | boolean isVariableLength(); 40 | 41 | boolean isNullable(); 42 | 43 | void write(MessageBuffer buf) throws IOException; 44 | 45 | LongNumberRetriever getAsLong(); 46 | 47 | boolean equals(Object obj); 48 | 49 | NullRetriever getAsNull(); 50 | 51 | boolean isListType(); 52 | 53 | boolean isDoubleType(); 54 | 55 | NumberValueRetriever getValueRetriever(); 56 | 57 | DoubleRetriever getAsDouble(); 58 | 59 | boolean isLongType(); 60 | 61 | boolean isBooleanType(); 62 | 63 | String getDataAsString(); 64 | 65 | BoolRetriever getAsBool(); 66 | 67 | boolean isInstantType(); 68 | 69 | ByteBufRetriever getAsBytesBuf(); 70 | 71 | boolean isBytesBufType(); 72 | } 73 | -------------------------------------------------------------------------------- /heypixel/data/PayloadData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.*; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.io.IOException; 11 | import java.util.Arrays; 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class PayloadData extends AbstractDataRetriever implements IBytesData { 17 | public byte[] dataBytes; 18 | public byte dataType; 19 | 20 | public PayloadData(byte b, byte[] bArr) { 21 | this.dataType = b; 22 | this.dataBytes = bArr; 23 | } 24 | 25 | @Override 26 | public boolean isMapType() { 27 | return super.isMapType(); 28 | } 29 | 30 | public DataRetriever getValue() { 31 | return get(); 32 | } 33 | 34 | public IBytesData get() { 35 | return this; 36 | } 37 | 38 | @Override 39 | public ILongNumberData retrieveLongNumber() { 40 | return super.retrieveLongNumber(); 41 | } 42 | 43 | @Override 44 | public IDataList retrieveListData() { 45 | return super.retrieveListData(); 46 | } 47 | 48 | public byte[] getDataBytes() { 49 | return this.dataBytes; 50 | } 51 | 52 | @Override 53 | public boolean isBooleanType() { 54 | return super.isBooleanType(); 55 | } 56 | 57 | @Override 58 | public boolean equals(Object obj) { 59 | if (obj == this) { 60 | return true; 61 | } 62 | if (!(obj instanceof ObjectData objectData)) { 63 | return false; 64 | } 65 | if (!objectData.isInstant1Type()) { 66 | return false; 67 | } 68 | PayloadRetriever payload = objectData.getAsPayload(); 69 | return this.dataType == payload.getDataType() && Arrays.equals(this.dataBytes, payload.getDataBytes()); 70 | } 71 | 72 | @Override 73 | public IHexBytesData retrieveByteArrayData() { 74 | return super.retrieveByteArrayData(); 75 | } 76 | 77 | @Override 78 | public IInstantBytes retrieveInstantData() { 79 | return super.retrieveInstantData(); 80 | } 81 | 82 | @Override 83 | public ObjectRetriever getRetriever() { 84 | return super.getRetriever(); 85 | } 86 | 87 | @Override 88 | public boolean isLongType() { 89 | return super.isLongType(); 90 | } 91 | 92 | public byte getDataType() { 93 | return this.dataType; 94 | } 95 | 96 | @Override 97 | public PayloadRetriever getAsPayload() { 98 | return getDefaultType(); 99 | } 100 | 101 | @Override 102 | public boolean isListType() { 103 | return super.isListType(); 104 | } 105 | 106 | @Override 107 | public IBytesData getDefaultType() { 108 | return this; 109 | } 110 | 111 | public void write(MessageBuffer buf) throws IOException { 112 | buf.writeSizePrefixedBytes(this.dataType, this.dataBytes.length); 113 | buf.writeBytes(this.dataBytes); 114 | } 115 | 116 | @Override 117 | public boolean isInstant1Type() { 118 | return super.isInstant1Type(); 119 | } 120 | 121 | @Override 122 | public boolean isInstantType() { 123 | return super.isInstantType(); 124 | } 125 | 126 | @Override 127 | public BytesDataRetriever retrieveBytes() { 128 | return super.retrieveBytes(); 129 | } 130 | 131 | @Override 132 | public boolean isNullable() { 133 | return super.isNullable(); 134 | } 135 | 136 | @Override 137 | public boolean isVariableLength() { 138 | return super.isVariableLength(); 139 | } 140 | 141 | public DataTypes getValueType() { 142 | return DataTypes.INSTANT; 143 | } 144 | 145 | @Override 146 | public IMapData retrieveMapData() { 147 | return super.retrieveMapData(); 148 | } 149 | 150 | @Override 151 | public IBufferData retrieveBytesData() { 152 | return super.retrieveBytesData(); 153 | } 154 | 155 | public int hashCode() { 156 | byte b = this.dataType; 157 | int i = (31 | b) + (b | (-32)) + 32; 158 | for (byte b2 : this.dataBytes) { 159 | int i2 = 31 * i; 160 | i = (i2 | b2) + ((b2 | ((-i2) - 1)) - ((-i2) - 1)); 161 | } 162 | return i; 163 | } 164 | 165 | @Override 166 | public IDoubleData retrieveDoubleData() { 167 | return super.retrieveDoubleData(); 168 | } 169 | 170 | @Override 171 | public boolean isBytesBufType() { 172 | return super.isBytesBufType(); 173 | } 174 | 175 | @Override 176 | public boolean isBytesType() { 177 | return super.isBytesType(); 178 | } 179 | 180 | @Override 181 | public IBoolData retrieveBoolean() { 182 | return super.retrieveBoolean(); 183 | } 184 | 185 | public String toString() { 186 | StringBuilder sb = new StringBuilder(); 187 | sb.append('('); 188 | sb.append(this.dataType); 189 | sb.append(",0x"); 190 | for (byte b : this.dataBytes) { 191 | sb.append(Integer.toString(b, 16)); 192 | } 193 | sb.append(")"); 194 | return sb.toString(); 195 | } 196 | 197 | @Override 198 | public boolean isNullType() { 199 | return super.isNullType(); 200 | } 201 | 202 | 203 | @Override 204 | public INullData retrieveNullData() { 205 | return super.retrieveNullData(); 206 | } 207 | 208 | 209 | public String getDataAsString() { 210 | StringBuilder sb = new StringBuilder(); 211 | sb.append('['); 212 | sb.append(this.dataType); 213 | sb.append(",\""); 214 | for (byte b : this.dataBytes) { 215 | sb.append(Integer.toString(b, 16)); 216 | } 217 | sb.append("\"]"); 218 | return sb.toString(); 219 | } 220 | 221 | 222 | @Override 223 | public boolean isDoubleType() { 224 | return super.isDoubleType(); 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /heypixel/data/hex/HexBytesData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.hex; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IHexBytesData; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BytesRetriever; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.*; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | import java.util.Arrays; 15 | 16 | 17 | 18 | @StringEncryption 19 | @ControlFlowObfuscation 20 | public class HexBytesData extends HexEncodedData implements IHexBytesData { 21 | public HexBytesData(byte[] bArr) { 22 | super(bArr); 23 | } 24 | 25 | @Override 26 | public IHexBytesData retrieveByteArrayData() { 27 | return this; 28 | } 29 | 30 | public DataTypes getValueType() { 31 | return DataTypes.BYTES; 32 | } 33 | 34 | @Override 35 | public boolean equals(Object obj) { 36 | if (this == obj) { 37 | return true; 38 | } 39 | if (!(obj instanceof ObjectData objectData)) { 40 | return false; 41 | } 42 | if (!objectData.isBytesType()) { 43 | return false; 44 | } 45 | if (!(objectData instanceof HexBytesData)) { 46 | return Arrays.equals(this.data, objectData.getAsByteArr().getBytes()); 47 | } 48 | return Arrays.equals(this.data, ((HexBytesData) objectData).data); 49 | } 50 | 51 | public DataRetriever getValue() { 52 | return get(); 53 | } 54 | 55 | public void write(MessageBuffer buf) throws IOException { 56 | buf.writeVarInt(this.data.length); 57 | buf.writeBytes(this.data); 58 | } 59 | 60 | public int hashCode() { 61 | return Arrays.hashCode(this.data); 62 | } 63 | 64 | public IHexBytesData get() { 65 | return this; 66 | } 67 | 68 | 69 | @Override 70 | public BytesRetriever getAsByteArr() { 71 | return this.retrieveByteArrayData(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IBoolData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BoolRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IBoolData extends DataRetriever, BoolRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IBufferData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.ByteBufRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BytesDataRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IBufferData extends BytesDataRetriever, ByteBufRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IBytesData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.PayloadRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IBytesData extends PayloadRetriever, DataRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IDataList.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataListRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.util.Iterator; 10 | import java.util.List; 11 | 12 | 13 | 14 | public interface IDataList extends DataRetriever, DataListRetriever { 15 | List getObjectDataList(); 16 | 17 | @Override 18 | Iterator iterator(); 19 | } 20 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IDoubleData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DoubleRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.ObjectRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IDoubleData extends ObjectRetriever, DoubleRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IHexBytesData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BytesDataRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BytesRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IHexBytesData extends BytesDataRetriever, BytesRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IInstantBytes.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.InstantRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface IInstantBytes extends DataRetriever, InstantRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/ILongNumberData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.LongNumberRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.ObjectRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface ILongNumberData extends ObjectRetriever, LongNumberRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/IMapData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.MapRetriever; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | 11 | 12 | public interface IMapData extends DataRetriever, MapRetriever { 13 | } 14 | -------------------------------------------------------------------------------- /heypixel/data/interfaces/INullData.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.NullRetriever; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface INullData extends DataRetriever, NullRetriever { 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/AbstractDataRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | 11 | @StringEncryption 12 | @ControlFlowObfuscation 13 | public abstract class AbstractDataRetriever implements DataRetriever { 14 | 15 | @Override 16 | public ByteBufRetriever getAsBytesBuf() { 17 | return retrieveBytesData(); 18 | } 19 | 20 | 21 | public boolean isBytesBufType() { 22 | return getValueType().isBytesBuf(); 23 | } 24 | 25 | 26 | public boolean isListType() { 27 | return getValueType().isList(); 28 | } 29 | 30 | 31 | @Override 32 | public BytesRetriever getAsByteArr() { 33 | return retrieveByteArrayData(); 34 | } 35 | 36 | 37 | public NumberValueRetriever getValueRetriever() { 38 | return getRetriever(); 39 | } 40 | 41 | 42 | public PayloadRetriever getAsPayload() { 43 | return getDefaultType(); 44 | } 45 | 46 | 47 | public IHexBytesData retrieveByteArrayData() { 48 | throw new RuntimeException(); 49 | } 50 | 51 | 52 | public ObjectRetriever getRetriever() { 53 | throw new RuntimeException(); 54 | } 55 | 56 | 57 | public IBufferData retrieveBytesData() { 58 | throw new RuntimeException(); 59 | } 60 | 61 | 62 | public IDataList retrieveListData() { 63 | throw new RuntimeException(); 64 | } 65 | 66 | 67 | public IBoolData retrieveBoolean() { 68 | throw new RuntimeException(); 69 | } 70 | 71 | 72 | public IMapData retrieveMapData() { 73 | throw new RuntimeException(); 74 | } 75 | 76 | public boolean isInstantType() { 77 | return false; 78 | } 79 | 80 | 81 | public boolean isBooleanType() { 82 | return getValueType().isBoolean(); 83 | } 84 | 85 | 86 | public ILongNumberData retrieveLongNumber() { 87 | throw new RuntimeException(); 88 | } 89 | 90 | 91 | public boolean isLongType() { 92 | return getValueType().isLong(); 93 | } 94 | 95 | 96 | public boolean isInstant1Type() { 97 | return getValueType().isInstant(); 98 | } 99 | 100 | 101 | @Override 102 | public NullRetriever getAsNull() { 103 | return retrieveNullData(); 104 | } 105 | 106 | 107 | @Override 108 | public LongNumberRetriever getAsLong() { 109 | return retrieveLongNumber(); 110 | } 111 | 112 | 113 | @Override 114 | public DataListRetriever getAsList() { 115 | return retrieveListData(); 116 | } 117 | 118 | 119 | public boolean isBytesType() { 120 | return getValueType().isBytes(); 121 | } 122 | 123 | 124 | public boolean isVariableLength() { 125 | return getValueType().isVariableLength(); 126 | } 127 | 128 | 129 | @Override 130 | public MapRetriever getAsMap() { 131 | return retrieveMapData(); 132 | } 133 | 134 | 135 | public boolean isDoubleType() { 136 | return getValueType().isDouble(); 137 | } 138 | 139 | 140 | @Override 141 | public DoubleRetriever getAsDouble() { 142 | return retrieveDoubleData(); 143 | } 144 | 145 | 146 | public boolean isNullType() { 147 | return getValueType().isNull(); 148 | } 149 | 150 | public boolean isMapType() { 151 | return getValueType().isMap(); 152 | } 153 | 154 | 155 | public IBytesData getDefaultType() { 156 | throw new RuntimeException(); 157 | } 158 | 159 | 160 | @Override 161 | public BoolRetriever getAsBool() { 162 | return retrieveBoolean(); 163 | } 164 | 165 | 166 | @Override 167 | public BytesDataProvider getAsBytes() { 168 | return retrieveBytes(); 169 | } 170 | 171 | 172 | public BytesDataRetriever retrieveBytes() { 173 | throw new RuntimeException(); 174 | } 175 | 176 | 177 | public IInstantBytes retrieveInstantData() { 178 | throw new RuntimeException(); 179 | } 180 | 181 | 182 | public boolean isNullable() { 183 | return getValueType().isNullable(); 184 | } 185 | 186 | 187 | public IDoubleData retrieveDoubleData() { 188 | throw new RuntimeException(); 189 | } 190 | 191 | 192 | @Override 193 | public InstantRetriever getAsInstant() { 194 | return retrieveInstantData(); 195 | } 196 | 197 | 198 | public INullData retrieveNullData() { 199 | throw new RuntimeException(); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/BoolRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface BoolRetriever extends ObjectData { 11 | boolean getBoolean(); 12 | } 13 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/ByteBufRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface ByteBufRetriever extends BytesDataProvider { 11 | } 12 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/BytesDataRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface BytesDataRetriever extends DataRetriever, BytesDataProvider { 11 | } 12 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/BytesRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface BytesRetriever extends BytesDataProvider { 11 | } 12 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/DataListRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.Iterator; 8 | import java.util.List; 9 | 10 | 11 | 12 | public interface DataListRetriever extends ObjectData, Iterable { 13 | int size(); 14 | 15 | @Override 16 | Iterator iterator(); 17 | 18 | List getObjectDataList(); 19 | 20 | ObjectData get(int i); 21 | 22 | ObjectData getNullable(int i); 23 | } 24 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/DataRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.*; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | 11 | 12 | public interface DataRetriever extends ObjectData { 13 | 14 | default LongNumberRetriever getAsLong() { 15 | return retrieveLongNumber(); 16 | } 17 | 18 | ILongNumberData retrieveLongNumber(); 19 | 20 | 21 | default BytesRetriever getAsByteArr() { 22 | return retrieveByteArrayData(); 23 | } 24 | 25 | IHexBytesData retrieveByteArrayData(); 26 | 27 | BytesDataRetriever retrieveBytes(); 28 | 29 | 30 | default BoolRetriever getAsBool() { 31 | return retrieveBoolean(); 32 | } 33 | 34 | 35 | default DataListRetriever getAsList() { 36 | return retrieveListData(); 37 | } 38 | 39 | IBufferData retrieveBytesData(); 40 | 41 | 42 | default MapRetriever getAsMap() { 43 | return retrieveMapData(); 44 | } 45 | 46 | IInstantBytes retrieveInstantData(); 47 | 48 | IBoolData retrieveBoolean(); 49 | 50 | IDataList retrieveListData(); 51 | 52 | INullData retrieveNullData(); 53 | 54 | IMapData retrieveMapData(); 55 | 56 | 57 | default BytesDataProvider getAsBytes() { 58 | return retrieveBytes(); 59 | } 60 | 61 | 62 | default NullRetriever getAsNull() { 63 | return retrieveNullData(); 64 | } 65 | 66 | 67 | default InstantRetriever getAsInstant() { 68 | return retrieveInstantData(); 69 | } 70 | 71 | IDoubleData retrieveDoubleData(); 72 | 73 | 74 | default ByteBufRetriever getAsBytesBuf() { 75 | return retrieveBytesData(); 76 | } 77 | 78 | 79 | default DoubleRetriever getAsDouble() { 80 | return retrieveDoubleData(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/DoubleRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | 7 | 8 | public interface DoubleRetriever extends NumberValueRetriever { 9 | } 10 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/InstantRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.time.Instant; 7 | 8 | 9 | 10 | public interface InstantRetriever extends PayloadRetriever { 11 | int getNano(); 12 | 13 | long getEpochMilli(); 14 | 15 | Instant getInstant(); 16 | 17 | long getEpochSecond(); 18 | } 19 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/LongNumberRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.ValueTypeEnum; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.math.BigInteger; 8 | 9 | 10 | 11 | public interface LongNumberRetriever extends NumberValueRetriever { 12 | long toLong(); 13 | 14 | boolean isLong(); 15 | 16 | boolean isByte(); 17 | 18 | boolean isInt(); 19 | 20 | ValueTypeEnum getValueTypeI(); 21 | 22 | boolean isShort(); 23 | 24 | int toInt(); 25 | 26 | BigInteger toBigInteger(); 27 | 28 | short toShort(); 29 | 30 | byte toByte(); 31 | } 32 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/MapRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.util.Collection; 8 | import java.util.Map; 9 | import java.util.Set; 10 | 11 | 12 | 13 | public interface MapRetriever extends ObjectData { 14 | int size(); 15 | 16 | Collection getCollection(); 17 | 18 | Set> entrySet(); 19 | 20 | Map getMap(); 21 | 22 | Set keySet(); 23 | 24 | T[] getArray(); 25 | } 26 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/NullRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface NullRetriever extends ObjectData { 11 | } 12 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/NumberValueRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import java.math.BigInteger; 8 | 9 | 10 | 11 | public interface NumberValueRetriever extends ObjectData { 12 | byte getByte(); 13 | 14 | BigInteger getBigInteger(); 15 | 16 | int getInteger(); 17 | 18 | float getFloat(); 19 | 20 | double getDouble(); 21 | 22 | long getLong(); 23 | 24 | short getShort(); 25 | } 26 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/ObjectRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | 7 | 8 | public interface ObjectRetriever extends DataRetriever, NumberValueRetriever { 9 | } 10 | -------------------------------------------------------------------------------- /heypixel/data/retrievers/PayloadRetriever.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | 10 | public interface PayloadRetriever extends ObjectData { 11 | byte getDataType(); 12 | 13 | byte[] getDataBytes(); 14 | } 15 | -------------------------------------------------------------------------------- /heypixel/exceptions/BigIntgerException.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.exceptions; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.math.BigInteger; 7 | 8 | public class BigIntgerException extends RuntimeException { 9 | public BigInteger bigInteger; 10 | 11 | 12 | public BigIntgerException(long data) { 13 | this(BigInteger.valueOf(data)); 14 | } 15 | 16 | public BigIntgerException(BigInteger bigInteger) { 17 | this.bigInteger = bigInteger; 18 | } 19 | 20 | public BigIntgerException(String str, BigInteger bigInteger) { 21 | super(str); 22 | this.bigInteger = bigInteger; 23 | } 24 | 25 | public String getString() { 26 | return this.bigInteger.toString(); 27 | } 28 | 29 | public BigInteger getBigInter() { 30 | return this.bigInteger; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /heypixel/exceptions/CharacterCodingFailedException.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.exceptions; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | import java.nio.charset.CharacterCodingException; 7 | 8 | public class CharacterCodingFailedException extends RuntimeException { 9 | public CharacterCodingFailedException(CharacterCodingException characterCodingException) { 10 | super(characterCodingException); 11 | } 12 | 13 | 14 | public CharacterCodingFailedException(String str, CharacterCodingException characterCodingException) { 15 | super(str, characterCodingException); 16 | } 17 | 18 | public CharacterCodingException cause() { 19 | return (CharacterCodingException) super.getCause(); 20 | } 21 | 22 | public Throwable getThrowable() { 23 | return cause(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /heypixel/exceptions/ProcessorException.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.exceptions; 2 | 3 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 4 | import tech.skidonion.obfuscator.annotations.StringEncryption; 5 | 6 | public class ProcessorException extends RuntimeException { 7 | public long val; 8 | 9 | public ProcessorException(String str, long j) { 10 | super(str); 11 | this.val = j; 12 | } 13 | 14 | public ProcessorException(long j) { 15 | this.val = j; 16 | } 17 | 18 | public long Method17867() { 19 | return this.val; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /heypixel/utils/ChiperUtils.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelSessionManager; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import javax.crypto.Cipher; 9 | import javax.crypto.NoSuchPaddingException; 10 | import java.security.NoSuchAlgorithmException; 11 | 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class ChiperUtils { 17 | 18 | @NativeObfuscation.Inline 19 | public static Cipher getServerCipher2(HeypixelSessionManager manager) throws NoSuchPaddingException, NoSuchAlgorithmException { 20 | return HeypixelCipher.get(manager.convertBytesToString(manager.encryptMode1)); 21 | } 22 | 23 | 24 | @NativeObfuscation.Inline 25 | public static ProtocolKeyGenerator Method5165(HeypixelSessionManager manager) throws NoSuchAlgorithmException { 26 | return ProtocolKeyGenerator.fromString(manager.convertBytesToString(manager.encryptMode1)); 27 | } 28 | 29 | @NativeObfuscation.Inline 30 | public static Cipher getServerChipher(HeypixelSessionManager manager) throws NoSuchPaddingException, NoSuchAlgorithmException { 31 | return HeypixelCipher.get(manager.convertBytesToString(manager.encryptMode)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /heypixel/utils/DataBufferUtils.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.ValueTypeEnum; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.*; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.io.InputStream; 10 | import java.io.OutputStream; 11 | import java.nio.ByteBuffer; 12 | import java.nio.channels.ReadableByteChannel; 13 | import java.nio.channels.WritableByteChannel; 14 | import java.nio.charset.Charset; 15 | import java.nio.charset.StandardCharsets; 16 | 17 | 18 | @StringEncryption 19 | @ControlFlowObfuscation 20 | public class DataBufferUtils { 21 | public static byte field_10355 = -1; 22 | public static byte field_10367 = -32; 23 | public static byte field_10199 = -33; 24 | public static byte field_10313 = -34; 25 | public static byte field_10181 = -35; 26 | public static byte field_10193 = -36; 27 | public static byte field_10379 = -37; 28 | public static byte field_10283 = -38; 29 | public static byte field_10253 = -39; 30 | public static byte field_10175 = -40; 31 | public static byte field_10277 = -41; 32 | public static byte field_10247 = -42; 33 | public static byte field_10217 = -43; 34 | public static byte field_10265 = -44; 35 | public static byte field_10331 = -45; 36 | public static byte field_10385 = -46; 37 | public static byte field_10259 = -47; 38 | public static byte field_10301 = -48; 39 | public static byte field_10295 = -49; 40 | public static byte field_10319 = -50; 41 | public static byte field_10307 = -51; 42 | public static byte field_10211 = -52; 43 | public static byte field_10229 = -53; 44 | public static byte field_10289 = -54; 45 | public static byte field_10397 = -55; 46 | public static byte field_10169 = -56; 47 | public static byte field_10391 = -57; 48 | public static byte field_10373 = -58; 49 | public static byte field_10241 = -59; 50 | public static byte field_10205 = -60; 51 | public static byte field_10187 = -61; 52 | public static byte field_10271 = -62; 53 | public static byte field_10163 = -63; 54 | public static byte field_10325 = -64; 55 | public static byte field_10223 = -96; 56 | public static byte field_10235 = -112; 57 | public static byte MIN_BYTE = Byte.MIN_VALUE; 58 | public static byte field_10403 = Byte.MIN_VALUE; 59 | 60 | 61 | public static Charset charset = StandardCharsets.UTF_8; 62 | public static BufferConfiguration configuration = new BufferConfiguration(); 63 | public static ProcessorBuilder builder = new ProcessorBuilder(); 64 | public static ValueTypeEnum[] valueFormats = new ValueTypeEnum[256]; 65 | 66 | public static boolean Method10409(byte b) { 67 | return ((-16) | (-b - 1)) - (-b - 1) == -128; 68 | } 69 | 70 | public static boolean Method10415(byte b) { 71 | return (((-16) | ((-b) - 1)) + b) + 1 == -112; 72 | } 73 | 74 | public static boolean Method10433(byte b) { 75 | int i = (255 | ((-b) - 1)) - ((-b) - 1); 76 | return i <= 127 || i >= 224; 77 | } 78 | 79 | public static boolean Method10469(byte b) { 80 | return ((-128) | ((-b) - 1)) - ((-b) - 1) == 0; 81 | } 82 | 83 | public static boolean Method10481(byte b) { 84 | return (((-32) | ((-b) - 1)) + b) + 1 == -96; 85 | } 86 | 87 | public static boolean Method10487(byte b) { 88 | return ((-32) | ((-b) - 1)) - ((-b) - 1) == -96; 89 | } 90 | 91 | public static boolean Method10505(byte b) { 92 | return ((-32) | ((-b) - 1)) - ((-b) - 1) == -32; 93 | } 94 | 95 | 96 | public static DataBufferProcessor create(ReadableByteChannel readableByteChannel) { 97 | return builder.createDataBufferProcessorFromChannel(readableByteChannel); 98 | } 99 | 100 | 101 | public static MessageBuffer createMessageBuffer(BufferedOutput bufferedOutput) { 102 | return configuration.createMessageBuffer(bufferedOutput); 103 | } 104 | 105 | 106 | public static DataBuffer createBuffer() { 107 | return configuration.createBuffer(); 108 | } 109 | 110 | 111 | public static DataBufferProcessor create(byte[] bArr) { 112 | return builder.createFromBytes(bArr); 113 | } 114 | 115 | 116 | public static DataBufferProcessor create(InputStream inputStream) { 117 | return builder.createFromStream(inputStream); 118 | } 119 | 120 | 121 | public static DataBufferProcessor createProcessor(ILBuffer iLBuffer) { 122 | return builder.createProcessor(iLBuffer); 123 | } 124 | 125 | 126 | public static MessageBuffer create(WritableByteChannel writableByteChannel) { 127 | return configuration.createMessageBufferFromChannel(writableByteChannel); 128 | } 129 | 130 | 131 | public static DataBufferProcessor create(byte[] bArr, int i, int i2) { 132 | return builder.createFromBytes(bArr, i, i2); 133 | } 134 | 135 | 136 | public static DataBufferProcessor create(ByteBuffer byteBuffer) { 137 | return builder.createFromByteBuffer(byteBuffer); 138 | } 139 | 140 | 141 | public static MessageBuffer create(OutputStream outputStream) { 142 | return configuration.createMessageBufferFromStream(outputStream); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /heypixel/utils/EncryptionUtils.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.check.HeypixelSessionManager; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | import javax.crypto.BadPaddingException; 9 | import javax.crypto.Cipher; 10 | import javax.crypto.IllegalBlockSizeException; 11 | import javax.crypto.NoSuchPaddingException; 12 | import java.io.UnsupportedEncodingException; 13 | import java.nio.charset.StandardCharsets; 14 | import java.security.*; 15 | import java.security.spec.InvalidKeySpecException; 16 | import java.security.spec.PKCS8EncodedKeySpec; 17 | import java.security.spec.X509EncodedKeySpec; 18 | import java.util.Base64; 19 | 20 | 21 | @StringEncryption 22 | @NativeObfuscation 23 | @ControlFlowObfuscation 24 | public class EncryptionUtils { 25 | 26 | 27 | @NativeObfuscation.Inline 28 | public static String decodeBase64(HeypixelSessionManager manager, String str) throws NoSuchPaddingException, IllegalBlockSizeException, UnsupportedEncodingException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, InvalidKeySpecException { 29 | return decryptBytes(manager, Base64.getDecoder().decode(str)); 30 | } 31 | 32 | 33 | @NativeObfuscation.Inline 34 | public static PublicKey generatePublicKey(HeypixelSessionManager manager, byte[] bArr) throws NoSuchAlgorithmException, InvalidKeySpecException { 35 | var mode = manager.convertBytesToString(manager.encryptMode); 36 | //System.out.println(mode); 37 | return KeyFactory.getInstance(mode).generatePublic(new X509EncodedKeySpec(bArr)); 38 | } 39 | 40 | 41 | @NativeObfuscation.Inline 42 | public static String encryptString(HeypixelSessionManager manager, String str) throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidKeySpecException { 43 | PublicKey generatePublicKey = generatePublicKey(manager, manager.key2); 44 | Cipher serverChipher = ChiperUtils.getServerChipher(manager); 45 | serverChipher.init(1, generatePublicKey); 46 | return Base64.getEncoder().encodeToString(serverChipher.doFinal(str.getBytes())); 47 | } 48 | 49 | 50 | @NativeObfuscation.Inline 51 | public static PrivateKey generatePrivateKey(HeypixelSessionManager manager, byte[] bArr) throws NoSuchAlgorithmException, InvalidKeySpecException { 52 | return KeyFactory.getInstance(manager.convertBytesToString(manager.encryptMode)).generatePrivate(new PKCS8EncodedKeySpec(bArr)); 53 | } 54 | 55 | 56 | @NativeObfuscation.Inline 57 | public static String decryptBytes(HeypixelSessionManager manager, byte[] bArr) throws NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, UnsupportedEncodingException, InvalidKeySpecException { 58 | PrivateKey generatePrivateKey = generatePrivateKey(manager, manager.key3); 59 | Cipher serverChipher = ChiperUtils.getServerChipher(manager); 60 | serverChipher.init(2, generatePrivateKey); 61 | return new String(serverChipher.doFinal(bArr), StandardCharsets.UTF_8); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /heypixel/utils/HeypixelCipher.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import javax.crypto.Cipher; 8 | import javax.crypto.CipherSpi; 9 | import javax.crypto.NoSuchPaddingException; 10 | import java.security.NoSuchAlgorithmException; 11 | import java.security.Provider; 12 | 13 | 14 | @StringEncryption 15 | @ControlFlowObfuscation 16 | public class HeypixelCipher extends Cipher { 17 | public HeypixelCipher(CipherSpi cipherSpi, Provider provider, String str) { 18 | super(cipherSpi, provider, str); 19 | } 20 | 21 | 22 | @NativeObfuscation.Inline 23 | public static Cipher get(String str) throws NoSuchPaddingException, NoSuchAlgorithmException { 24 | return getInstance(str); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /heypixel/utils/HeypixelVarUtils.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | @StringEncryption 10 | @NativeObfuscation 11 | @ControlFlowObfuscation 12 | public class HeypixelVarUtils { 13 | 14 | public HeypixelVarUtils() { 15 | throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); 16 | } 17 | 18 | public static void writeVarInt(ByteBuf byteBuf, int i) { 19 | encodeVarLong(byteBuf, (((long) i << 1) ^ (i >> 31)) & 4294967295L); 20 | } 21 | 22 | public static void writeVarLong(ByteBuf byteBuf, long j) { 23 | encodeVarLong(byteBuf, j); 24 | } 25 | 26 | public static int readVarInt(ByteBuf byteBuf) { 27 | return (int) decodeVarLong(byteBuf, 32); 28 | } 29 | 30 | public static int readZigZagInt(ByteBuf byteBuf) { 31 | int decodeVarLong = (int) decodeVarLong(byteBuf, 32); 32 | int i = decodeVarLong >>> 1; 33 | int i2 = -((1 | ((-decodeVarLong) - 1)) - ((-decodeVarLong) - 1)); 34 | return (i | i2) - ((i2 | ((-i) - 1)) - ((-i) - 1)); 35 | } 36 | 37 | public static void encodeVarLong(ByteBuf byteBuf, long j) { 38 | if ((j & (-128)) == 0) { 39 | byteBuf.writeByte((byte) j); 40 | } else if ((j & (-16384)) == 0) { 41 | byteBuf.writeShort((int) ((((j & 127) | 128) << 8) | (j >>> 7))); 42 | } else { 43 | writeVarLongExtended(byteBuf, j); 44 | } 45 | } 46 | 47 | @NativeObfuscation.Inline 48 | public static void writeVarLongExtended(ByteBuf byteBuf, long j) { 49 | if ((j & (-128)) == 0) { 50 | byteBuf.writeByte((byte) j); 51 | return; 52 | } 53 | if ((j & (-16384)) == 0) { 54 | byteBuf.writeShort((int) ((((j & 127) | 128) << 8) | (j >>> 7))); 55 | return; 56 | } 57 | if ((j & (-2097152)) == 0) { 58 | byteBuf.writeMedium((int) ((((j & 127) | 128) << 16) | ((((j >>> 7) & 127) | 128) << 8) | (j >>> 14))); 59 | return; 60 | } 61 | if ((j & (-268435456)) == 0) { 62 | byteBuf.writeInt((int) ((((j & 127) | 128) << 24) | ((((j >>> 7) & 127) | 128) << 16) | ((((j >>> 14) & 127) | 128) << 8) | (j >>> 21))); 63 | return; 64 | } 65 | if ((j & (-34359738368L)) == 0) { 66 | byteBuf.writeInt((int) ((((j & 127) | 128) << 24) | ((((j >>> 7) & 127) | 128) << 16) | ((((j >>> 14) & 127) | 128) << 8) | ((j >>> 21) & 127) | 128)); 67 | byteBuf.writeByte((int) (j >>> 28)); 68 | return; 69 | } 70 | if ((j & (-4398046511104L)) == 0) { 71 | byteBuf.writeInt((int) ((((j & 127) | 128) << 24) | ((((j >>> 7) & 127) | 128) << 16) | ((((j >>> 14) & 127) | 128) << 8) | ((j >>> 21) & 127) | 128)); 72 | byteBuf.writeShort((int) (((((j >>> 28) & 127) | 128) << 8) | (j >>> 35))); 73 | return; 74 | } 75 | if ((j & (-562949953421312L)) == 0) { 76 | byteBuf.writeInt((int) ((((j & 127) | 128) << 24) | ((((j >>> 7) & 127) | 128) << 16) | ((((j >>> 14) & 127) | 128) << 8) | ((j >>> 21) & 127) | 128)); 77 | byteBuf.writeMedium((int) (((((j >>> 28) & 127) | 128) << 16) | ((((j >>> 35) & 127) | 128) << 8) | (j >>> 42))); 78 | return; 79 | } 80 | if ((j & (-72057594037927936L)) == 0) { 81 | byteBuf.writeLong((((j & 127) | 128) << 56) | ((((j >>> 7) & 127) | 128) << 48) | ((((j >>> 14) & 127) | 128) << 40) | ((((j >>> 21) & 127) | 128) << 32) | ((((j >>> 28) & 127) | 128) << 24) | ((((j >>> 35) & 127) | 128) << 16) | ((((j >>> 42) & 127) | 128) << 8) | (j >>> 49)); 82 | return; 83 | } 84 | if ((j & Long.MIN_VALUE) == 0) { 85 | byteBuf.writeLong((((j & 127) | 128) << 56) | ((((j >>> 7) & 127) | 128) << 48) | ((((j >>> 14) & 127) | 128) << 40) | ((((j >>> 21) & 127) | 128) << 32) | ((((j >>> 28) & 127) | 128) << 24) | ((((j >>> 35) & 127) | 128) << 16) | ((((j >>> 42) & 127) | 128) << 8) | ((j >>> 49) & 127) | 128); 86 | byteBuf.writeByte((byte) (j >>> 56)); 87 | } else { 88 | byteBuf.writeLong((((j & 127) | 128) << 56) | ((((j >>> 7) & 127) | 128) << 48) | ((((j >>> 14) & 127) | 128) << 40) | ((((j >>> 21) & 127) | 128) << 32) | ((((j >>> 28) & 127) | 128) << 24) | ((((j >>> 35) & 127) | 128) << 16) | ((((j >>> 42) & 127) | 128) << 8) | ((j >>> 49) & 127) | 128); 89 | byteBuf.writeShort((int) (((((j >>> 56) & 127) | 128) << 8) | (j >>> 63))); 90 | } 91 | } 92 | 93 | public static long decodeVarLong(ByteBuf byteBuf, int i) { 94 | long j = 0; 95 | for (int i2 = 0; i2 < i; i2 += 7) { 96 | byte readByte = byteBuf.readByte(); 97 | j |= (long) (readByte & 127) << i2; 98 | if ((128 | ((-readByte) - 1)) - ((-readByte) - 1) == 0) { 99 | return j; 100 | } 101 | } 102 | throw new ArithmeticException("Ints Error#1"); 103 | } 104 | 105 | public static void writeUnsignedInt(ByteBuf byteBuf, int i) { 106 | encodeVarLong(byteBuf, i & 4294967295L); 107 | } 108 | 109 | public static long readZigZagLong(ByteBuf byteBuf) { 110 | long decodeVarLong = decodeVarLong(byteBuf, 64); 111 | return (decodeVarLong >>> 1) ^ (-(decodeVarLong & 1)); 112 | } 113 | 114 | public static long readUnsignedLong(ByteBuf byteBuf) { 115 | return decodeVarLong(byteBuf, 64); 116 | } 117 | 118 | public static void writeZigZagLong(ByteBuf byteBuf, long j) { 119 | encodeVarLong(byteBuf, (j << 1) ^ (j >> 63)); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /heypixel/utils/MsgUtils.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.IDKAnnotation; 4 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 5 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 6 | import tech.skidonion.obfuscator.annotations.StringEncryption; 7 | 8 | 9 | @StringEncryption 10 | @ControlFlowObfuscation 11 | public class MsgUtils { 12 | 13 | @NativeObfuscation.Inline 14 | public static String formatMessage(String str, @IDKAnnotation Object... objArr) { 15 | int indexOf; 16 | String valueOf = String.valueOf(str); 17 | StringBuilder sb = new StringBuilder(valueOf.length() + (16 * objArr.length)); 18 | int i = 0; 19 | int i2 = 0; 20 | while (i2 < objArr.length && (indexOf = valueOf.indexOf("%s", i)) != -1) { 21 | sb.append(valueOf, i, indexOf); 22 | int i3 = i2; 23 | i2++; 24 | sb.append(objArr[i3]); 25 | i = (indexOf | 2) + ((2 | ((-indexOf) - 1)) - ((-indexOf) - 1)); 26 | } 27 | sb.append(valueOf.substring(i)); 28 | if (i2 < objArr.length) { 29 | sb.append(" ["); 30 | int i4 = i2; 31 | int i5 = i2 + 1; 32 | StringBuilder append = sb.append(objArr[i4]); 33 | while (i5 < objArr.length) { 34 | sb.append(", "); 35 | int i6 = i5; 36 | i5++; 37 | append = sb.append(objArr[i6]); 38 | } 39 | sb.append(']'); 40 | } 41 | return sb.toString(); 42 | } 43 | 44 | 45 | @NativeObfuscation.Inline 46 | public static Object requireNonNull(Object obj, @IDKAnnotation Object obj2) { 47 | if (obj == null) { 48 | throw new NullPointerException(String.valueOf(obj2)); 49 | } 50 | return obj; 51 | } 52 | 53 | 54 | @NativeObfuscation.Inline 55 | public static String validateRange(int i, int i2, String str) { 56 | if (i < 0) { 57 | return formatMessage("%s (%s) 不能为负数", str, Integer.valueOf(i)); 58 | } 59 | if (i2 < 0) { 60 | throw new IllegalArgumentException("负数大小: " + i2); 61 | } 62 | return formatMessage("%s (%s) 必须大于 (%s)", str, Integer.valueOf(i), Integer.valueOf(i2)); 63 | } 64 | 65 | 66 | public static int checkIndexBounds(int i, int i2, @IDKAnnotation String str) { 67 | if (i < 0 || i > i2) { 68 | throw new IndexOutOfBoundsException(validateRange(i, i2, str)); 69 | } 70 | return i; 71 | } 72 | 73 | 74 | public static int checkIndexInclusiveBounds(int i, int i2, @IDKAnnotation String str) { 75 | if (i < 0 || i >= i2) { 76 | throw new IndexOutOfBoundsException(validateLowerBound(i, i2, str)); 77 | } 78 | return i; 79 | } 80 | 81 | 82 | public static void checkState(boolean z) { 83 | if (!z) { 84 | throw new IllegalStateException(); 85 | } 86 | } 87 | 88 | 89 | public static void checkArgument(boolean z) { 90 | if (!z) { 91 | throw new IllegalArgumentException(); 92 | } 93 | } 94 | 95 | 96 | @NativeObfuscation.Inline 97 | public static String validateLowerBound(int i, int i2, String str) { 98 | if (i < 0) { 99 | return formatMessage("%s (%s) 不能为负", str, Integer.valueOf(i)); 100 | } 101 | if (i2 < 0) { 102 | throw new IllegalArgumentException("负数大小: " + i2); 103 | } 104 | return formatMessage("%s (%s) 必须小于 (%s)", str, Integer.valueOf(i), Integer.valueOf(i2)); 105 | } 106 | 107 | 108 | public static void checkArgumentWithMessage(boolean z, @IDKAnnotation Object obj) { 109 | if (!z) { 110 | throw new IllegalArgumentException(String.valueOf(obj)); 111 | } 112 | } 113 | 114 | 115 | public static void checkArgumentWithFormattedMessage(boolean z, @IDKAnnotation String str, @IDKAnnotation Object... objArr) { 116 | if (!z) { 117 | throw new IllegalArgumentException(formatMessage(str, objArr)); 118 | } 119 | } 120 | 121 | 122 | public static int checkIndex(int i, int i2) { 123 | return checkIndexBounds(i, i2, "index"); 124 | } 125 | 126 | 127 | public static void checkStateWithMessage(boolean condition, @IDKAnnotation String format, @IDKAnnotation Object... args) { 128 | if (!condition) { 129 | throw new IllegalStateException(formatMessage(format, args)); 130 | } 131 | } 132 | 133 | 134 | public static Object requireNonNullWithMessage(Object obj, @IDKAnnotation String str, @IDKAnnotation Object... objArr) { 135 | if (obj == null) { 136 | throw new NullPointerException(formatMessage(str, objArr)); 137 | } 138 | return obj; 139 | } 140 | 141 | 142 | @NativeObfuscation.Inline 143 | public static String validateIndexRange(int i, int i2, int i3) { 144 | return (i < 0 || i > i3) ? validateRange(i, i3, "start index") : (i2 < 0 || i2 > i3) ? validateRange(i2, i3, "end index") : formatMessage("搞鸡毛? 最终下标 (%s) 必须要小于起始下标 (%s)", Integer.valueOf(i2), Integer.valueOf(i)); 145 | } 146 | 147 | 148 | public static int checkIndexInclusive(int i, int i2) { 149 | return checkIndexInclusiveBounds(i, i2, "index"); 150 | } 151 | 152 | 153 | public static Object requireNonNullStrict(Object obj) { 154 | if (obj == null) { 155 | throw new NullPointerException(); 156 | } 157 | return obj; 158 | } 159 | 160 | 161 | public static void checkRangeBounds(int i, int i2, int i3) { 162 | if (i < 0 || i2 < i || i2 > i3) { 163 | throw new IndexOutOfBoundsException(validateIndexRange(i, i2, i3)); 164 | } 165 | } 166 | 167 | 168 | public static void checkStateStrict(boolean condition, @IDKAnnotation Object errorMessage) { 169 | if (!condition) { 170 | throw new IllegalStateException(String.valueOf(errorMessage)); 171 | } 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /heypixel/utils/ProtocolKeyGenerator.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.utils; 2 | 3 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | import javax.crypto.KeyGenerator; 8 | import javax.crypto.KeyGeneratorSpi; 9 | import java.security.NoSuchAlgorithmException; 10 | import java.security.Provider; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public class ProtocolKeyGenerator extends KeyGenerator { 16 | 17 | public ProtocolKeyGenerator(KeyGeneratorSpi keyGeneratorSpi, Provider provider, String str) { 18 | super(keyGeneratorSpi, provider, str); 19 | } 20 | 21 | 22 | @NativeObfuscation.Inline 23 | public static ProtocolKeyGenerator fromString(String str) throws NoSuchAlgorithmException { 24 | return (ProtocolKeyGenerator) KeyGenerator.getInstance(str); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /heypixel/value/AbstractValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.*; 7 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 8 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 9 | import tech.skidonion.obfuscator.annotations.StringEncryption; 10 | 11 | 12 | @StringEncryption 13 | @ControlFlowObfuscation 14 | public abstract class AbstractValue implements ObjectData { 15 | public Value value; 16 | 17 | public AbstractValue(Value value) { 18 | this.value = value; 19 | } 20 | 21 | public boolean isDoubleType() { 22 | return getValueType().isDouble(); 23 | } 24 | 25 | public NullRetriever getAsNull() { 26 | throw new RuntimeException(); 27 | } 28 | 29 | public LongNumberRetriever getAsLong() { 30 | throw new RuntimeException(); 31 | } 32 | 33 | public String toString() { 34 | return this.value.toString(); 35 | } 36 | 37 | public int hashCode() { 38 | return this.value.hashCode(); 39 | } 40 | 41 | public boolean isListType() { 42 | return getValueType().isList(); 43 | } 44 | 45 | public ByteBufRetriever getAsBytesBuf() { 46 | throw new RuntimeException(); 47 | } 48 | 49 | public boolean isNullType() { 50 | return getValueType().isNull(); 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | return this.value.equals(obj); 56 | } 57 | 58 | public boolean isMapType() { 59 | return getValueType().isMap(); 60 | } 61 | 62 | public MapRetriever getAsMap() { 63 | throw new RuntimeException(); 64 | } 65 | 66 | public BoolRetriever getAsBool() { 67 | throw new RuntimeException(); 68 | } 69 | 70 | public DoubleRetriever getAsDouble() { 71 | throw new RuntimeException(); 72 | } 73 | 74 | public PayloadRetriever getAsPayload() { 75 | throw new RuntimeException(); 76 | } 77 | 78 | public boolean isBytesBufType() { 79 | return getValueType().isBytesBuf(); 80 | } 81 | 82 | public InstantRetriever getAsInstant() { 83 | throw new RuntimeException(); 84 | } 85 | 86 | public boolean isInstantType() { 87 | return false; 88 | } 89 | 90 | public NumberValueRetriever getValueRetriever() { 91 | throw new RuntimeException(); 92 | } 93 | 94 | public BytesDataProvider getAsBytes() { 95 | throw new RuntimeException(); 96 | } 97 | 98 | public BytesRetriever getAsByteArr() { 99 | throw new RuntimeException(); 100 | } 101 | 102 | public boolean isNullable() { 103 | return getValueType().isNullable(); 104 | } 105 | 106 | public boolean isBooleanType() { 107 | return getValueType().isBoolean(); 108 | } 109 | 110 | 111 | public boolean isVariableLength() { 112 | return getValueType().isVariableLength(); 113 | } 114 | 115 | 116 | public boolean isBytesType() { 117 | return getValueType().isBytes(); 118 | } 119 | 120 | 121 | public boolean isLongType() { 122 | return getValueType().isLong(); 123 | } 124 | 125 | 126 | public DataListRetriever getAsList() { 127 | throw new RuntimeException(); 128 | } 129 | 130 | 131 | public boolean isInstant1Type() { 132 | return getValueType().isInstant(); 133 | } 134 | 135 | 136 | public String getDataAsString() { 137 | return this.value.getDataAsString(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /heypixel/value/BoolValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IBoolData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BoolRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class BoolValue extends AbstractValue implements BoolRetriever { 19 | public Value data; 20 | 21 | public BoolValue(Value value) { 22 | super(value); 23 | this.data = value; 24 | } 25 | 26 | public void write(MessageBuffer buf) throws IOException { 27 | buf.writeBoolean(this.data.longValue == 1); 28 | } 29 | 30 | public IBoolData Method14165() { 31 | return DataFactory.ofBool(getBoolean()); 32 | } 33 | 34 | public boolean getBoolean() { 35 | return this.data.longValue == 1; 36 | } 37 | 38 | public DataTypes getValueType() { 39 | return DataTypes.BOOLEAN; 40 | } 41 | 42 | public DataRetriever getValue() { 43 | return Method14165(); 44 | } 45 | 46 | @Override 47 | public BoolRetriever getAsBool() { 48 | return this; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /heypixel/value/ByteBufValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BytesDataProvider; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.exceptions.CharacterCodingFailedException; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.utils.DataBufferUtils; 6 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 7 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 8 | import tech.skidonion.obfuscator.annotations.StringEncryption; 9 | 10 | import java.nio.ByteBuffer; 11 | import java.nio.charset.CharacterCodingException; 12 | import java.nio.charset.CodingErrorAction; 13 | 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public abstract class ByteBufValue extends AbstractValue implements BytesDataProvider { 18 | public Value value; 19 | 20 | 21 | public ByteBufValue(Value value) { 22 | super(value); 23 | this.value = value; 24 | } 25 | 26 | public String getString() { 27 | try { 28 | return DataBufferUtils.charset.newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPORT).decode(ByteBuffer.wrap((byte[]) this.value.data)).toString(); 29 | } catch (CharacterCodingException e) { 30 | throw new CharacterCodingFailedException(e); 31 | } 32 | } 33 | 34 | @Override 35 | public BytesDataProvider getAsBytes() { 36 | return this; 37 | } 38 | 39 | public ByteBuffer getByteBuffer() { 40 | return ByteBuffer.wrap(getBytes()); 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | byte[] bArr = (byte[]) this.value.data; 46 | try { 47 | return DataBufferUtils.charset.newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE).decode(ByteBuffer.wrap(bArr)).toString(); 48 | } catch (CharacterCodingException e) { 49 | throw new CharacterCodingFailedException(e); 50 | } 51 | } 52 | 53 | public byte[] getBytes() { 54 | return (byte[]) this.value.data; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /heypixel/value/BytesBufValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IBufferData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.ByteBufRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class BytesBufValue extends ByteBufValue implements ByteBufRetriever { 19 | public Value data; 20 | 21 | 22 | public BytesBufValue(Value value) { 23 | super(value); 24 | this.data = value; 25 | } 26 | 27 | 28 | public void write(MessageBuffer buf) throws IOException { 29 | byte[] bArr = (byte[]) this.data.data; 30 | buf.writeDirectInt(bArr.length); 31 | buf.writeBytes(bArr); 32 | } 33 | 34 | public DataTypes getValueType() { 35 | return DataTypes.BYTES_BUF; 36 | } 37 | 38 | 39 | public DataRetriever getValue() { 40 | return wrapByteArray(); 41 | } 42 | 43 | 44 | public IBufferData wrapByteArray() { 45 | return DataFactory.ofBuffer((byte[]) this.data.data); 46 | } 47 | 48 | @Override 49 | public ByteBufRetriever getAsBytesBuf() { 50 | return this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /heypixel/value/BytesValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IHexBytesData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.BytesRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class BytesValue extends ByteBufValue implements BytesRetriever { 19 | public Value data; 20 | 21 | 22 | public BytesValue(Value value) { 23 | super(value); 24 | this.data = value; 25 | } 26 | 27 | public void write(MessageBuffer buf) throws IOException { 28 | byte[] bArr = (byte[]) this.data.data; 29 | buf.writeVarInt(bArr.length); 30 | buf.writeBytes(bArr); 31 | } 32 | 33 | public DataRetriever getValue() { 34 | return Method11135(); 35 | } 36 | 37 | public DataTypes getValueType() { 38 | return DataTypes.BYTES; 39 | } 40 | 41 | 42 | public IHexBytesData Method11135() { 43 | return DataFactory.ofHex(getBytes()); 44 | } 45 | 46 | @Override 47 | public BytesRetriever getAsByteArr() { 48 | return this; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /heypixel/value/DoubleValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IDoubleData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DoubleRetriever; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class DoubleValue extends NumberValue implements DoubleRetriever { 19 | public Value data; 20 | 21 | 22 | public DoubleValue(Value value) { 23 | super(value); 24 | this.data = value; 25 | } 26 | 27 | public IDoubleData get() { 28 | return DataFactory.ofDouble(this.data.doubleValue); 29 | } 30 | 31 | public DataTypes getValueType() { 32 | return DataTypes.DOUBLE; 33 | } 34 | 35 | @Override 36 | public DoubleRetriever getAsDouble() { 37 | return this; 38 | } 39 | 40 | public DataRetriever getValue() { 41 | return get(); 42 | } 43 | 44 | 45 | public void write(MessageBuffer buf) throws IOException { 46 | buf.writeDoubleLE(this.data.doubleValue); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /heypixel/value/InstantPayloadValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IBytesData; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.PayloadRetriever; 8 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 9 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 10 | import tech.skidonion.obfuscator.annotations.StringEncryption; 11 | 12 | import java.io.IOException; 13 | 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public class InstantPayloadValue extends AbstractValue implements PayloadRetriever { 18 | public Value data; 19 | 20 | public InstantPayloadValue(Value value) { 21 | super(value); 22 | this.data = value; 23 | } 24 | 25 | public byte getDataType() { 26 | return ((IBytesData) this.data.data).getDataType(); 27 | } 28 | 29 | public void write(MessageBuffer buf) throws IOException { 30 | ((IBytesData) this.data.data).write(buf); 31 | } 32 | 33 | public DataTypes getValueType() { 34 | return DataTypes.INSTANT; 35 | } 36 | 37 | public DataRetriever getValue() { 38 | return getData(); 39 | } 40 | 41 | @Override 42 | public PayloadRetriever getAsPayload() { 43 | return this; 44 | } 45 | 46 | public byte[] getDataBytes() { 47 | return ((IBytesData) this.data.data).getDataBytes(); 48 | } 49 | 50 | public IBytesData getData() { 51 | return (IBytesData) this.data.data; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /heypixel/value/InstantValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IInstantBytes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.InstantRetriever; 8 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 9 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 10 | import tech.skidonion.obfuscator.annotations.StringEncryption; 11 | 12 | import java.io.IOException; 13 | import java.time.Instant; 14 | 15 | 16 | @StringEncryption 17 | @ControlFlowObfuscation 18 | public class InstantValue extends AbstractValue implements InstantRetriever { 19 | public Value data; 20 | 21 | public InstantValue(Value value) { 22 | super(value); 23 | this.data = value; 24 | } 25 | 26 | public void write(MessageBuffer buf) throws IOException { 27 | ((IInstantBytes) this.data.data).write(buf); 28 | } 29 | 30 | 31 | public int getNano() { 32 | return ((IInstantBytes) this.data.data).getNano(); 33 | } 34 | 35 | public IInstantBytes get() { 36 | return (IInstantBytes) this.data.data; 37 | } 38 | 39 | @Override 40 | public InstantRetriever getAsInstant() { 41 | return this; 42 | } 43 | 44 | 45 | public byte[] getDataBytes() { 46 | return ((IInstantBytes) this.data.data).getDataBytes(); 47 | } 48 | 49 | 50 | public Instant getInstant() { 51 | return ((IInstantBytes) this.data.data).getInstant(); 52 | } 53 | 54 | 55 | public DataRetriever getValue() { 56 | return get(); 57 | } 58 | 59 | 60 | public long getEpochSecond() { 61 | return ((IInstantBytes) this.data.data).getEpochSecond(); 62 | } 63 | 64 | 65 | public byte getDataType() { 66 | return ((IInstantBytes) this.data.data).getDataType(); 67 | } 68 | 69 | 70 | public long getEpochMilli() { 71 | return ((IInstantBytes) this.data.data).getEpochMilli(); 72 | } 73 | 74 | @Override 75 | public boolean isInstantType() { 76 | return true; 77 | } 78 | 79 | public DataTypes getValueType() { 80 | return DataTypes.INSTANT; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /heypixel/value/ListValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IDataList; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataListRetriever; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 10 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 11 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 12 | import tech.skidonion.obfuscator.annotations.StringEncryption; 13 | 14 | import java.io.IOException; 15 | import java.util.Arrays; 16 | import java.util.Iterator; 17 | import java.util.List; 18 | 19 | 20 | @StringEncryption 21 | @ControlFlowObfuscation 22 | public class ListValue extends AbstractValue implements DataListRetriever { 23 | public Value data; 24 | 25 | 26 | public ListValue(Value value) { 27 | super(value); 28 | this.data = value; 29 | } 30 | 31 | public void write(MessageBuffer buf) throws IOException { 32 | getList().write(buf); 33 | } 34 | 35 | public IDataList getList() { 36 | return DataFactory.of(getData()); 37 | } 38 | 39 | @Override 40 | public DataListRetriever getAsList() { 41 | return this; 42 | } 43 | 44 | public DataTypes getValueType() { 45 | return DataTypes.LIST; 46 | } 47 | 48 | public ObjectData getNullable(int i) { 49 | ObjectData[] Method3443 = getData(); 50 | return Method3443.length >= i ? Method3443[i] : DataFactory.createNULL(); 51 | } 52 | 53 | public int size() { 54 | return getData().length; 55 | } 56 | 57 | public ObjectData[] getData() { 58 | return (ObjectData[]) this.data.data; 59 | } 60 | 61 | @Override 62 | public Iterator iterator() { 63 | return getObjectDataList().iterator(); 64 | } 65 | 66 | 67 | public DataRetriever getValue() { 68 | return getList(); 69 | } 70 | 71 | 72 | public ObjectData get(int i) { 73 | return getData()[i]; 74 | } 75 | 76 | 77 | public List getObjectDataList() { 78 | return Arrays.asList(getData()); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /heypixel/value/LongValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.ValueDataType; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.ValueTypeEnum; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.BigIntegerData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.ILongNumberData; 10 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 11 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.LongNumberRetriever; 12 | import dev.undefinedteam.gensh1n.protocol.heypixel.exceptions.BigIntgerException; 13 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 14 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 15 | import tech.skidonion.obfuscator.annotations.StringEncryption; 16 | 17 | import java.io.IOException; 18 | import java.math.BigInteger; 19 | 20 | 21 | @StringEncryption 22 | @ControlFlowObfuscation 23 | public class LongValue extends NumberValue implements LongNumberRetriever { 24 | public Value data; 25 | 26 | 27 | public LongValue(Value value) { 28 | super(value); 29 | this.data = value; 30 | } 31 | 32 | public ValueTypeEnum getValueTypeI() { 33 | return BigIntegerData.getBigIntegerType(this); 34 | } 35 | 36 | public boolean isShort() { 37 | return this.data.valueType != ValueDataType.BIGINTEGER_LONG_TYPE && -32768 <= this.data.longValue && this.data.longValue <= 32767; 38 | } 39 | 40 | public BigInteger toBigInteger() { 41 | return this.data.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? (BigInteger) this.data.data : BigInteger.valueOf(this.data.longValue); 42 | } 43 | 44 | public DataTypes getValueType() { 45 | return DataTypes.LONG; 46 | } 47 | 48 | public ILongNumberData getNumData() { 49 | return this.data.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? DataFactory.ofBigInteger((BigInteger) this.data.data) : DataFactory.ofLong(this.data.longValue); 50 | } 51 | 52 | public short toShort() { 53 | if (isByte()) { 54 | return (short) this.data.longValue; 55 | } 56 | throw new BigIntgerException(this.data.longValue); 57 | } 58 | 59 | public int toInt() { 60 | if (isInt()) { 61 | return (int) this.data.longValue; 62 | } 63 | throw new BigIntgerException(this.data.longValue); 64 | } 65 | 66 | public boolean isInt() { 67 | return this.data.valueType != ValueDataType.BIGINTEGER_LONG_TYPE && -2147483648L <= this.data.longValue && this.data.longValue <= 2147483647L; 68 | } 69 | 70 | public boolean isLong() { 71 | return this.data.valueType != ValueDataType.BIGINTEGER_LONG_TYPE; 72 | } 73 | 74 | @Override 75 | public LongNumberRetriever getAsLong() { 76 | return this; 77 | } 78 | 79 | 80 | public byte toByte() { 81 | if (isByte()) { 82 | return (byte) this.data.longValue; 83 | } 84 | throw new BigIntgerException(this.data.longValue); 85 | } 86 | 87 | 88 | public void write(MessageBuffer buf) throws IOException { 89 | if (this.data.valueType == ValueDataType.BIGINTEGER_LONG_TYPE) { 90 | buf.writeBigInteger((BigInteger) this.data.data); 91 | } else { 92 | buf.writeSignedValue(this.data.longValue); 93 | } 94 | } 95 | 96 | 97 | public long toLong() { 98 | if (isLong()) { 99 | return this.data.longValue; 100 | } 101 | throw new BigIntgerException(this.data.longValue); 102 | } 103 | 104 | 105 | public DataRetriever getValue() { 106 | return getNumData(); 107 | } 108 | 109 | public boolean isByte() { 110 | return this.data.valueType != ValueDataType.BIGINTEGER_LONG_TYPE && -128 <= this.data.longValue && this.data.longValue <= 127; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /heypixel/value/MapValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.ObjectData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.IMapData; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 9 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.MapRetriever; 10 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 11 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 12 | import tech.skidonion.obfuscator.annotations.StringEncryption; 13 | 14 | import java.io.IOException; 15 | import java.util.Collection; 16 | import java.util.Map; 17 | import java.util.Set; 18 | 19 | 20 | @StringEncryption 21 | @ControlFlowObfuscation 22 | public class MapValue extends AbstractValue implements MapRetriever { 23 | public Value data; 24 | 25 | public MapValue(Value value) { 26 | super(value); 27 | this.data = value; 28 | } 29 | 30 | public IMapData get() { 31 | return DataFactory.ofArray(getArray()); 32 | } 33 | 34 | public Set keySet() { 35 | return get().keySet(); 36 | } 37 | 38 | public Map getMap() { 39 | return get().getMap(); 40 | } 41 | 42 | public DataRetriever getValue() { 43 | return get(); 44 | } 45 | 46 | public DataTypes getValueType() { 47 | return DataTypes.MAP; 48 | } 49 | 50 | public void write(MessageBuffer buf) throws IOException { 51 | get().write(buf); 52 | } 53 | 54 | public int size() { 55 | return getArray().length / 2; 56 | } 57 | 58 | public Set> entrySet() { 59 | return get().entrySet(); 60 | } 61 | 62 | public ObjectData[] getArray() { 63 | return (ObjectData[]) this.data.data; 64 | } 65 | 66 | public Collection getCollection() { 67 | return get().getCollection(); 68 | } 69 | 70 | @Override 71 | public MapRetriever getAsMap() { 72 | return this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /heypixel/value/NullValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.buffer.MessageBuffer; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataFactory; 5 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.DataTypes; 6 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.interfaces.INullData; 7 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.DataRetriever; 8 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.NullRetriever; 9 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 10 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 11 | import tech.skidonion.obfuscator.annotations.StringEncryption; 12 | 13 | import java.io.IOException; 14 | 15 | @StringEncryption 16 | @ControlFlowObfuscation 17 | public class NullValue extends AbstractValue implements NullRetriever { 18 | 19 | public Value data; 20 | 21 | public NullValue(Value value) { 22 | super(value); 23 | this.data = value; 24 | } 25 | 26 | public DataTypes getValueType() { 27 | return DataTypes.NULL; 28 | } 29 | 30 | public INullData get() { 31 | return DataFactory.createNULL(); 32 | } 33 | 34 | public void write(MessageBuffer buf) throws IOException { 35 | buf.writeNull(); 36 | } 37 | 38 | public DataRetriever getValue() { 39 | return get(); 40 | } 41 | 42 | @Override 43 | public NullRetriever getAsNull() { 44 | return this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /heypixel/value/NumberValue.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.heypixel.value; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.heypixel.ValueDataType; 4 | import dev.undefinedteam.gensh1n.protocol.heypixel.data.retrievers.NumberValueRetriever; 5 | import tech.skidonion.obfuscator.annotations.ControlFlowObfuscation; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.math.BigDecimal; 10 | import java.math.BigInteger; 11 | 12 | 13 | @StringEncryption 14 | @ControlFlowObfuscation 15 | public abstract class NumberValue extends AbstractValue implements NumberValueRetriever { 16 | public Value val; 17 | 18 | public NumberValue(Value value) { 19 | super(value); 20 | this.val = value; 21 | } 22 | 23 | @Override 24 | public NumberValueRetriever getValueRetriever() { 25 | return this; 26 | } 27 | 28 | public long getLong() { 29 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).longValue() : this.val.longValue; 30 | } 31 | 32 | public float getFloat() { 33 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).floatValue() : this.val.valueType == ValueDataType.DOUBLE_TYPE ? (float) this.val.doubleValue : (float) this.val.longValue; 34 | } 35 | 36 | public double getDouble() { 37 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).doubleValue() : this.val.valueType == ValueDataType.DOUBLE_TYPE ? this.val.doubleValue : this.val.longValue; 38 | } 39 | 40 | public int getInteger() { 41 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).intValue() : (int) this.val.longValue; 42 | } 43 | 44 | public short getShort() { 45 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).shortValue() : (short) this.val.longValue; 46 | } 47 | 48 | public BigInteger getBigInteger() { 49 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? (BigInteger) this.val.data : this.val.valueType == ValueDataType.DOUBLE_TYPE ? new BigDecimal(this.val.doubleValue).toBigInteger() : BigInteger.valueOf(this.val.longValue); 50 | } 51 | 52 | public byte getByte() { 53 | return this.val.valueType == ValueDataType.BIGINTEGER_LONG_TYPE ? ((BigInteger) this.val.data).byteValue() : (byte) this.val.longValue; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /nel/GameSessionProvider.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.nel; 2 | 3 | import dev.undefinedteam.gensh1n.protocol.nel.myth.MythSessionsProvider; 4 | import dev.undefinedteam.gensh1n.protocol.nel.zone.ZoneSessionsProvider; 5 | import dev.undefinedteam.gensh1n.system.modules.misc.Protocol; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | 10 | 11 | public interface GameSessionProvider { 12 | void refresh(); 13 | 14 | String getPlayerUUID(int port); 15 | String getUserId(int port); 16 | String getToken(int port); 17 | 18 | static GameSessionProvider get() { 19 | return switch (Protocol.getNEL()) { 20 | case Zone -> ZoneSessionsProvider.get(); 21 | case Myth -> MythSessionsProvider.get(); 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /nel/zone/ZoneSessionInfo.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.nel.zone; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 5 | import tech.skidonion.obfuscator.annotations.StringEncryption; 6 | 7 | public class ZoneSessionInfo { 8 | @SerializedName("port") 9 | public int port; 10 | @SerializedName("entityId") 11 | public String entityId; 12 | @SerializedName("roleId") 13 | public String username; 14 | @SerializedName("dToken") 15 | public String token; 16 | @SerializedName("playerUuid") 17 | public String playerUuid; 18 | @SerializedName("playerGameUuid") 19 | public String playerGameUuid = ""; 20 | @SerializedName("serverEntityId") 21 | public String serverEntityId; 22 | } 23 | -------------------------------------------------------------------------------- /nel/zone/ZoneSessionsProvider.java: -------------------------------------------------------------------------------- 1 | package dev.undefinedteam.gensh1n.protocol.nel.zone; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | import dev.undefinedteam.gensh1n.protocol.nel.GameSessionProvider; 5 | import dev.undefinedteam.gensh1n.utils.network.Http; 6 | import tech.skidonion.obfuscator.annotations.NativeObfuscation; 7 | import tech.skidonion.obfuscator.annotations.StringEncryption; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class ZoneSessionsProvider implements GameSessionProvider { 13 | public final List sessions = new ArrayList<>(); 14 | 15 | private static ZoneSessionsProvider sInstance; 16 | 17 | public static ZoneSessionsProvider get() { 18 | if (sInstance == null) { 19 | sInstance = new ZoneSessionsProvider(); 20 | } 21 | return sInstance; 22 | } 23 | 24 | @Override 25 | public void refresh() { 26 | try { 27 | ZoneResponse response = Http.get("http://127.0.0.1:54188/") 28 | .sendJson(ZoneResponse.class); 29 | 30 | sessions.clear(); 31 | sessions.addAll(response.data); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | @Override 38 | public String getPlayerUUID(int port) { 39 | return sessions.stream().filter(s -> s.port == port).findFirst().orElse(new ZoneSessionInfo()).playerGameUuid; 40 | } 41 | 42 | @Override 43 | public String getUserId(int port) { 44 | return sessions.stream().filter(s -> s.port == port).findFirst().orElse(new ZoneSessionInfo()).entityId; 45 | } 46 | 47 | @Override 48 | public String getToken(int port) { 49 | return sessions.stream().filter(s -> s.port == port).findFirst().orElse(new ZoneSessionInfo()).token; 50 | } 51 | 52 | public static class ZoneResponse { 53 | @SerializedName("code") 54 | public int code; 55 | @SerializedName("msg") 56 | public String msg; 57 | @SerializedName("count") 58 | public int count; 59 | @SerializedName("total") 60 | public int total; 61 | @SerializedName("data") 62 | public List data; 63 | } 64 | } 65 | --------------------------------------------------------------------------------