Skip to content

Commit

Permalink
clean: remove old ProtocolLib code
Browse files Browse the repository at this point in the history
  • Loading branch information
LoJoSho committed Dec 29, 2024
1 parent 401e617 commit b43466a
Showing 1 changed file with 0 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ public PlayerGameListener() {
registerEntityUseListener();
registerSlotChangeListener();
registerPassengerSetListener();

//registerLookMovement();
//registerMoveListener();
//registerTeleportMovement();
}

@EventHandler(priority = EventPriority.LOW)
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit b43466a

Please sign in to comment.