From 693171b4c23b617f79bdfddf24cf7d4a3f1babcb Mon Sep 17 00:00:00 2001 From: Shyanne Date: Fri, 17 May 2024 11:57:17 -0400 Subject: [PATCH] debugging packets... :knife: --- .../IridiumPacketAdapter.java | 48 +++++++++++++++---- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/utils/ProtocolLibUtils/IridiumPacketAdapter.java b/src/main/java/com/iridium/iridiumskyblock/utils/ProtocolLibUtils/IridiumPacketAdapter.java index 0871f3c93..a321cdf1b 100644 --- a/src/main/java/com/iridium/iridiumskyblock/utils/ProtocolLibUtils/IridiumPacketAdapter.java +++ b/src/main/java/com/iridium/iridiumskyblock/utils/ProtocolLibUtils/IridiumPacketAdapter.java @@ -6,15 +6,15 @@ import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.reflect.StructureModifier; +import com.comphenix.protocol.wrappers.PlayerInfoData; import com.iridium.iridiumskyblock.IridiumSkyblock; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldType; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import java.lang.reflect.Field; +import java.util.List; public class IridiumPacketAdapter extends PacketAdapter { @@ -45,33 +45,61 @@ private void editPacketForHorizon(PacketEvent packetEvent, boolean fallback) { PacketType packetType = packet.getType(); if (!fallback) { - StructureModifier booleans = packet.getBooleans(); // login + // to get all | StructureModifier modifier = packet.getModifier(); + // BOOLEANS | StructureModifier booleans = packet.getBooleans(); // b - [0] hardcore (false) // g - // h - // i - + // ENTITY | StructureModifier entity = packet.getEntityModifier(packetEvent); + // a - + // d - + // e - + // f - + // PLAYER INFO DATA | StructureModifier> playerData = packet.getPlayerInfoDataLists(); + // c - + + // MISSING + // j - + + // Packet Capture + // a=331 // ??? entity type? + // b=false // hardcore mode + // c=[ResourceKey[minecraft:dimension / minecraft:overworld], ResourceKey[minecraft:dimension / minecraft:the_nether], ResourceKey[minecraft:dimension / minecraft:the_end], ResourceKey[minecraft:dimension / minecraft:iridiumskyblock], ResourceKey[minecraft:dimension / minecraft:plugins/iridiumskyblock/regenworlds/iridiumskyblock_regen], ResourceKey[minecraft:dimension / minecraft:iridiumskyblock_nether], ResourceKey[minecraft:dimension / minecraft:plugins/iridiumskyblock/regenworlds/iridiumskyblock_nether_regen], ResourceKey[minecraft:dimension / minecraft:plugins/iridiumskyblock/regenworlds/iridiumskyblock_the_end_regen], ResourceKey[minecraft:dimension / minecraft:iridiumskyblock_the_end]] + // d=20 // probably the amount of health the player has + // e=10 + // f=10 + // g=false + // h=true + // i=false + // j=CommonPlayerSpawnInfo[dimensionType=ResourceKey[minecraft:dimension_type / minecraft:overworld], dimension=ResourceKey[minecraft:dimension / minecraft:iridiumskyblock], seed=8029251825143012118, gameType=CREATIVE, previousGameType=SURVIVAL, isDebug=false, isFlat=false, lastDeathLocation=Optional[ResourceKey[minecraft:dimension / minecraft:iridiumskyblock] BlockPosition{x=1, y=82, z=2}], portalCooldown=0] int flatWorldIndex = 0; if(packetType == PacketType.Play.Server.LOGIN) flatWorldIndex = 4; if(packetType == PacketType.Play.Server.RESPAWN) flatWorldIndex = 1; + StructureModifier commonPlayerSpawnInfo = packet.getModifier(); + + int getCommonPlayerSpawnInfoIndex = 0; + if(packetType == PacketType.Play.Server.LOGIN) getCommonPlayerSpawnInfoIndex = 9; + if(packetType == PacketType.Play.Server.RESPAWN) getCommonPlayerSpawnInfoIndex = 0; + IridiumSkyblock.getInstance().getLogger().info("[DEBUG] =+=+=+=+=+=+=+=+=+=+=+=+="); IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PACKET TYPE: " + packetType); IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PACKET STRUCTURES: " + packet.getStructures()); IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PACKET FIELDS: " + packet.getStructures().getFields()); - IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PACKET BOOLEANS: " + booleans); - for(int i = 0; i < booleans.size(); i++) { - IridiumSkyblock.getInstance().getLogger().info("[DEBUG] MAPPED TO: " + booleans.getField(i).getName()); + IridiumSkyblock.getInstance().getLogger().info("[DEBUG] =+=+=+=+=+=+=+=+=+=+=+=+="); + IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PACKET OBJECT: " + commonPlayerSpawnInfo); + for(int i = 0; i < commonPlayerSpawnInfo.size(); i++) { + IridiumSkyblock.getInstance().getLogger().info("[DEBUG] MAPPED TO: " + commonPlayerSpawnInfo.getField(i).getName()); } - IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PRE-MUTATION VALUES: " + booleans.getValues()); - IridiumSkyblock.getInstance().getLogger().info("[DEBUG] TESTED PACKET FIELD: " + booleans.getField(flatWorldIndex).getName()); - IridiumSkyblock.getInstance().getLogger().info("[DEBUG] TESTED PACKET VALUE: TRUE"); + IridiumSkyblock.getInstance().getLogger().info("[DEBUG] PRE-MUTATION VALUES: " + commonPlayerSpawnInfo.getValues()); IridiumSkyblock.getInstance().getLogger().info("[DEBUG] =+=+=+=+=+=+=+=+=+=+=+=+="); - booleans.write(flatWorldIndex, true); + //booleans.write(flatWorldIndex, true); } else {