mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-23 17:08:00 +01:00
Change keepAlive's initial value to fix Gerrygames/ViaRewind#14
This commit is contained in:
parent
7fbd546d43
commit
2a756616f4
@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@
|
|||||||
package nl.matsv.viabackwards.protocol.protocol1_12_1to1_12_2;
|
package nl.matsv.viabackwards.protocol.protocol1_12_1to1_12_2;
|
||||||
|
|
||||||
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
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.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
@ -36,7 +35,8 @@ public class Protocol1_12_1To1_12_2 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}); // Keep alive
|
});
|
||||||
|
|
||||||
// Incoming
|
// Incoming
|
||||||
// 0xb - Keep alive
|
// 0xb - Keep alive
|
||||||
registerIncoming(State.PLAY, 0xb, 0xb, new PacketRemapper() {
|
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);
|
packetWrapper.write(Type.LONG, realKeepAlive);
|
||||||
// Reset KeepAliveTracker (to prevent sending same valid value in a row causing a timeout)
|
// 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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
2
pom.xml
2
pom.xml
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<description>Allow newer clients to join older server versions.</description>
|
<description>Allow newer clients to join older server versions.</description>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viabackwards-parent</artifactId>
|
<artifactId>viabackwards-parent</artifactId>
|
||||||
<groupId>nl.matsv</groupId>
|
<groupId>nl.matsv</groupId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user