Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Fix duplicate packet registering
Dieser Commit ist enthalten in:
Ursprung
73f6418db3
Commit
ae3434cb89
@ -98,8 +98,14 @@ public abstract class Protocol {
|
||||
* @param packetRemapper The remapper to use for the packet
|
||||
*/
|
||||
public void registerIncoming(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
|
||||
registerIncoming(state, oldPacketID, newPacketID, packetRemapper, false);
|
||||
}
|
||||
|
||||
public void registerIncoming(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
|
||||
ProtocolPacket protocolPacket = new ProtocolPacket(state, oldPacketID, newPacketID, packetRemapper);
|
||||
incoming.put(new Pair<>(state, newPacketID), protocolPacket);
|
||||
Pair<State, Integer> pair = new Pair<>(state, newPacketID);
|
||||
if (!override && incoming.containsKey(pair)) throw new IllegalArgumentException(pair + " already registered");
|
||||
incoming.put(pair, protocolPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,8 +128,14 @@ public abstract class Protocol {
|
||||
* @param packetRemapper The remapper to use for the packet
|
||||
*/
|
||||
public void registerOutgoing(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper) {
|
||||
registerOutgoing(state, oldPacketID, newPacketID, packetRemapper, false);
|
||||
}
|
||||
|
||||
public void registerOutgoing(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
|
||||
ProtocolPacket protocolPacket = new ProtocolPacket(state, oldPacketID, newPacketID, packetRemapper);
|
||||
outgoing.put(new Pair<>(state, oldPacketID), protocolPacket);
|
||||
Pair<State, Integer> pair = new Pair<>(state, oldPacketID);
|
||||
if (!override && outgoing.containsKey(pair)) throw new IllegalArgumentException(pair + " already registered");
|
||||
outgoing.put(pair, protocolPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -344,7 +344,6 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
registerOutgoing(State.PLAY, 0x1B, 0x1C);
|
||||
// New packet 0x1D - NBT Query
|
||||
registerOutgoing(State.PLAY, 0x1C, 0x1E);
|
||||
registerOutgoing(State.PLAY, 0x1D, 0x1F);
|
||||
registerOutgoing(State.PLAY, 0x1E, 0x20);
|
||||
registerOutgoing(State.PLAY, 0x1F, 0x21);
|
||||
// WorldPackets 0x20 -> 0x22
|
||||
|
@ -392,19 +392,6 @@ public class PlayerPackets {
|
||||
|
||||
/* Removed packets */
|
||||
|
||||
// Map Bulk
|
||||
protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Set Compression
|
||||
protocol.registerOutgoing(State.PLAY, 0x46, 0x46, new PacketRemapper() {
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren