3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-10-03 08:51:05 +02:00

Change keepAlive's initial value to fix Gerrygames/ViaRewind#14

Dieser Commit ist enthalten in:
Matsv 2018-02-05 20:51:34 +01:00 committet von Myles
Ursprung c7159721cb
Commit d484545bef
3 geänderte Dateien mit 31 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,28 @@
/*
* Copyright (c) 2016 Matsv
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package nl.matsv.viabackwards.protocol.protocol1_12_1to1_12_2;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
@Getter
@Setter
@ToString
public class KeepAliveTracker extends StoredObject {
private long keepAlive = Integer.MAX_VALUE;
public KeepAliveTracker(UserConnection user) {
super(user);
}
}

Datei anzeigen

@ -11,7 +11,6 @@
package nl.matsv.viabackwards.protocol.protocol1_12_1to1_12_2;
import nl.matsv.viabackwards.api.BackwardsProtocol;
import nl.matsv.viabackwards.protocol.protocol1_12to1_12_1.KeepAliveTracker;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketHandler;
@ -36,7 +35,8 @@ public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
}
});
}
}); // Keep alive
});
// Incoming
// 0xb - Keep alive
registerIncoming(State.PLAY, 0xb, 0xb, new PacketRemapper() {
@ -53,7 +53,7 @@ public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
}
packetWrapper.write(Type.LONG, realKeepAlive);
// Reset KeepAliveTracker (to prevent sending same valid value in a row causing a timeout)
packetWrapper.user().get(KeepAliveTracker.class).setKeepAlive(Long.MIN_VALUE);
packetWrapper.user().get(KeepAliveTracker.class).setKeepAlive(Integer.MAX_VALUE);
}
});
}

Datei anzeigen

@ -1,18 +0,0 @@
package nl.matsv.viabackwards.protocol.protocol1_12to1_12_1;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import us.myles.ViaVersion.api.data.StoredObject;
import us.myles.ViaVersion.api.data.UserConnection;
@Getter
@Setter
@ToString
public class KeepAliveTracker extends StoredObject {
private long keepAlive;
public KeepAliveTracker(UserConnection user) {
super(user);
}
}