Skip to content

Commit

Permalink
Merge remote-tracking branch 'Laiff/feature/level-maintainer-terminal…
Browse files Browse the repository at this point in the history
…' into dev
  • Loading branch information
Dream-Master committed Oct 17, 2023
2 parents 8153021 + 4570d46 commit 87a4047
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ public void fromBytes(ByteBuf buf) {
int numEntries = buf.readInt();

for (int i = 0; i < numEntries; ++i) {
if (buf.readableBytes() == 0) {
try {
PacketType type = PacketType.values()[buf.readByte()];

switch (type) {
case ADD -> this.commands.add(new PacketAdd(buf));
case REMOVE -> this.commands.add(new PacketRemove(buf));
case OVERWRITE -> this.commands.add(new PacketOverwrite(buf));
case RENAME -> this.commands.add(new PacketRename(buf));
default -> throw new IOException("Unknown packet type received of index " + type);
}
} catch (Exception e) {
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
AELog.info(
"Corrupted packet commands: (" + i
Expand All @@ -62,19 +72,6 @@ public void fromBytes(ByteBuf buf) {
.collect(Collectors.groupingBy(String::new, Collectors.counting())));
AELog.info("Parsed content: -> " + this.commands);
}
return;
}
PacketType type = PacketType.values()[buf.readByte()];

try {
switch (type) {
case ADD -> this.commands.add(new PacketAdd(buf));
case REMOVE -> this.commands.add(new PacketRemove(buf));
case OVERWRITE -> this.commands.add(new PacketOverwrite(buf));
case RENAME -> this.commands.add(new PacketRename(buf));
default -> throw new IOException("Unknown packet type received of index " + type);
}
} catch (Exception e) {
AELog.debug(e);
return;
}
Expand Down

0 comments on commit 87a4047

Please sign in to comment.