From b43466a7930f3af54e42e8f0bcdfb3383f0edb93 Mon Sep 17 00:00:00 2001 From: LoJoSho Date: Sun, 29 Dec 2024 17:18:21 -0600 Subject: [PATCH] clean: remove old ProtocolLib code --- .../listener/PlayerGameListener.java | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java index f2e754d5..9cec8163 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java @@ -70,10 +70,6 @@ public PlayerGameListener() { registerEntityUseListener(); registerSlotChangeListener(); registerPassengerSetListener(); - - //registerLookMovement(); - //registerMoveListener(); - //registerTeleportMovement(); } @EventHandler(priority = EventPriority.LOW) @@ -708,58 +704,6 @@ public void onPacketReceiving(PacketEvent event) { }); } - private void registerLookMovement() { - ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.LOOK) { - @Override - public void onPacketReceiving(PacketEvent event) { - // TODO: Finish - MessagesUtil.sendDebugMessages("Look Packet "); - Player player = event.getPlayer(); - if (event.getPlayer() == null) return; - CosmeticUser user = CosmeticUsers.getUser(player); - if (user == null) return; - if (user.isBackpackSpawned()) { - user.getUserBackpackManager().getEntityManager().setRotation(Math.round(event.getPacket().getFloat().read(0))); - } - } - }); - } - - private void registerMoveListener() { - ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.POSITION) { - @Override - public void onPacketReceiving(PacketEvent event) { - // TODO: Finish - MessagesUtil.sendDebugMessages("Position Packet "); - Player player = event.getPlayer(); - if (event.getPlayer() == null) return; - CosmeticUser user = CosmeticUsers.getUser(player); - if (user == null) return; - if (user.isBackpackSpawned()) { - // The yaw follows the head, which makes it look weird and do weird things when moving around - user.getUserBackpackManager().getEntityManager().teleport(new Location(player.getWorld(), event.getPacket().getDoubles().read(0), event.getPacket().getDoubles().read(1), event.getPacket().getDoubles().read(2), event.getPacket().getFloat().read(0), event.getPacket().getFloat().read(1))); - } - } - }); - } - - private void registerTeleportMovement() { - ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(HMCCosmeticsPlugin.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Client.POSITION_LOOK) { - @Override - public void onPacketReceiving(PacketEvent event) { - // TODO: Finish - MessagesUtil.sendDebugMessages("Teleport Packet "); - Player player = event.getPlayer(); - if (event.getPlayer() == null) return; - CosmeticUser user = CosmeticUsers.getUser(player); - if (user == null) return; - if (user.isBackpackSpawned()) { - Bukkit.getScheduler().runTask(HMCCosmeticsPlugin.getInstance(), () -> user.updateCosmetic(CosmeticSlot.BACKPACK)); - } - } - }); - } - @Nullable private EquipmentSlot getArmorSlot(final Material material) { for (final EquipmentSlot slot : EquipmentSlot.values()) {