Skip to content

Commit

Permalink
values() usage removed
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed May 27, 2024
1 parent f0d4fdb commit eac3d72
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extensions/discord/src/arc/discord/DiscordRPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ public String toString(){
}

enum PacketOp{
handshake, frame, close, ping, pong
handshake, frame, close, ping, pong;

public static final PacketOp[] all = values();
}

public static class NoDiscordClientException extends RuntimeException{
Expand Down Expand Up @@ -348,7 +350,7 @@ public Packet read() throws Exception{
if(status == PipeStatus.disconnected) throw new IOException("Disconnected!");
if(status == PipeStatus.closed) return new Packet(PacketOp.close, null);

PacketOp op = PacketOp.values()[Integer.reverseBytes(buffer.getInt())];
PacketOp op = PacketOp.all[Integer.reverseBytes(buffer.getInt())];
byte[] data = new byte[Integer.reverseBytes(buffer.getInt())];
buffer.get(data);

Expand Down Expand Up @@ -392,7 +394,7 @@ public Packet read() throws Exception{
if(status == PipeStatus.disconnected) throw new IOException("Disconnected!");
if(status == PipeStatus.closed) return new Packet(PacketOp.close, null);

PacketOp op = PacketOp.values()[Integer.reverseBytes(file.readInt())];
PacketOp op = PacketOp.all[Integer.reverseBytes(file.readInt())];
int len = Integer.reverseBytes(file.readInt());
byte[] d = new byte[len];

Expand Down

0 comments on commit eac3d72

Please sign in to comment.