From 151311e7ae498c27e981df692ebf7af7a725c78d Mon Sep 17 00:00:00 2001 From: AoElite <20812471+AoElite@users.noreply.github.com> Date: Fri, 9 Feb 2024 16:35:56 -0500 Subject: [PATCH] don't reset oplevel on dimension changes --- .../ac/grim/grimac/events/packets/PacketPlayerRespawn.java | 2 +- .../grimac/utils/data/packetentity/PacketEntitySelf.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java b/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java index a5ba03634b..0c16965b73 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java @@ -125,7 +125,7 @@ public void onPacketSend(PacketSendEvent event) { player.dimension = respawn.getDimension(); player.compensatedEntities.serverPlayerVehicle = null; // All entities get removed on respawn - player.compensatedEntities.playerEntity = new PacketEntitySelf(player); + player.compensatedEntities.playerEntity = new PacketEntitySelf(player, player.compensatedEntities.playerEntity); player.compensatedEntities.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get()); if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) { // 1.14+ players send a packet for this, listen for it instead diff --git a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java index b88c86d00f..db3b5421a8 100644 --- a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java +++ b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java @@ -23,6 +23,12 @@ public PacketEntitySelf(GrimPlayer player) { this.player = player; } + public PacketEntitySelf(GrimPlayer player, PacketEntitySelf old) { + super(EntityTypes.PLAYER); + this.player = player; + this.opLevel = old.opLevel; + } + public boolean inVehicle() { return getRiding() != null; }