Skip to content

Commit

Permalink
Fix incorrect packet handling
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
ConnorLinfoot committed Apr 13, 2024
1 parent 6acb9ff commit da7897c
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ You can then include the dependency in your project.
<dependency>
<groupId>net.hypixel</groupId>
<artifactId>mod-api</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>
</dependency>
```

```gradle
dependencies {
implementation 'net.hypixel:mod-api:0.3.0'
implementation 'net.hypixel:mod-api:0.3.1'
}
```
6 changes: 3 additions & 3 deletions src/main/java/net/hypixel/modapi/HypixelModAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.hypixel.modapi.error.ErrorReason;
import net.hypixel.modapi.error.ModAPIException;
import net.hypixel.modapi.handler.ClientboundPacketHandler;
import net.hypixel.modapi.packet.HypixelPacket;
import net.hypixel.modapi.packet.ClientboundHypixelPacket;
import net.hypixel.modapi.packet.PacketRegistry;
import net.hypixel.modapi.packet.impl.clientbound.ClientboundLocationPacket;
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPartyInfoPacket;
Expand Down Expand Up @@ -66,9 +66,9 @@ public void handle(String identifier, PacketSerializer serializer) {
throw new ModAPIException(identifier, reason);
}

HypixelPacket packet = registry.createClientboundPacket(identifier, serializer);
ClientboundHypixelPacket packet = registry.createClientboundPacket(identifier, serializer);
for (ClientboundPacketHandler handler : handlers) {
handler.handle(packet);
packet.handle(handler);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPingPacket;
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPlayerInfoPacket;

public interface ClientboundPacketHandler extends PacketHandler {
public interface ClientboundPacketHandler {

default void onPingPacket(ClientboundPingPacket packet) {
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/net/hypixel/modapi/handler/PacketHandler.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void write(PacketSerializer serializer) {

@Override
public void handle(ClientboundPacketHandler handler) {
handler.handle(this);
handler.onLocationPacket(this);
}

public Environment getEnvironment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void write(PacketSerializer serializer) {

@Override
public void handle(ClientboundPacketHandler handler) {
handler.handle(this);
handler.onPartyInfoPacket(this);
}

public boolean isInParty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void write(PacketSerializer serializer) {

@Override
public void handle(ClientboundPacketHandler handler) {
handler.handle(this);
handler.onPingPacket(this);
}

public String getResponse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void write(PacketSerializer serializer) {

@Override
public void handle(ClientboundPacketHandler handler) {
handler.handle(this);
handler.onPlayerInfoPacket(this);
}

public PlayerRank getPlayerRank() {
Expand Down

0 comments on commit da7897c

Please sign in to comment.