3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Merge pull request #1189 from creeper123123321/master

Fix duplicate packet registering
Dieser Commit ist enthalten in:
Myles 2019-02-10 16:41:39 +00:00 committet von GitHub
Commit 102c1f99a7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 14 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -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);
}
/**

Datei anzeigen

@ -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

Datei anzeigen

@ -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