Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Merge pull request #1797 from KennyTV/packetids
Print protocol and packet type when erroring
Dieser Commit ist enthalten in:
Commit
67993364b4
@ -406,15 +406,36 @@ public abstract class Protocol<C1 extends ClientboundPacketType, C2 extends Clie
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write packet id
|
// Write packet id
|
||||||
int newID = direction == Direction.OUTGOING ? protocolPacket.getNewID() : protocolPacket.getOldID();
|
int oldId = packetWrapper.getId();
|
||||||
packetWrapper.setId(newID);
|
int newId = direction == Direction.OUTGOING ? protocolPacket.getNewID() : protocolPacket.getOldID();
|
||||||
// remap
|
packetWrapper.setId(newId);
|
||||||
if (protocolPacket.getRemapper() != null) {
|
if (protocolPacket.getRemapper() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remap
|
||||||
|
try {
|
||||||
protocolPacket.getRemapper().remap(packetWrapper);
|
protocolPacket.getRemapper().remap(packetWrapper);
|
||||||
if (packetWrapper.isCancelled()) {
|
} catch (Exception e) {
|
||||||
throw Via.getManager().isDebug() ? new CancelException() : CancelException.CACHED;
|
if (e instanceof CancelException) {
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Class<? extends PacketType> packetTypeClass = direction == Direction.OUTGOING ? oldClientboundPacketEnum : newServerboundPacketEnum;
|
||||||
|
if (packetTypeClass != null) {
|
||||||
|
PacketType[] enumConstants = packetTypeClass.getEnumConstants();
|
||||||
|
PacketType packetType = oldId < enumConstants.length && oldId >= 0 ? enumConstants[oldId] : null;
|
||||||
|
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName() + " IN REMAP OF " + packetType + " (" + oldId + ")");
|
||||||
|
} else {
|
||||||
|
Via.getPlatform().getLogger().warning("ERROR IN " + getClass().getSimpleName()
|
||||||
|
+ " IN REMAP OF 0x" + Integer.toHexString(oldId) + "->0x" + Integer.toHexString(newId));
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packetWrapper.isCancelled()) {
|
||||||
|
throw Via.getManager().isDebug() ? new CancelException() : CancelException.CACHED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren