mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-25 12:45:35 +01:00
Change keepAlive's initial value to fix Gerrygames/ViaRewind#14
This commit is contained in:
parent
c7159721cb
commit
d484545bef
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user