Updated RequestLastInputTickPacket.
- Removed unnecessary default constructor. - When handling the packet the client will first check if input is allowed which should update the last input tick if needs be before sending it to the server.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package dev.micle.loginprotection.network.server;
|
||||
|
||||
import dev.micle.loginprotection.events.OnClientInputEventHandler;
|
||||
import dev.micle.loginprotection.network.NetworkManager;
|
||||
import dev.micle.loginprotection.network.client.LastInputTickPacket;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
@ -8,8 +9,6 @@ import net.minecraftforge.network.NetworkEvent;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class RequestLastInputTickPacket {
|
||||
public RequestLastInputTickPacket() {}
|
||||
|
||||
public static void encode(final RequestLastInputTickPacket packet, final FriendlyByteBuf buffer) {
|
||||
NetworkManager.writeVersionInfo(buffer, false);
|
||||
}
|
||||
@ -22,6 +21,9 @@ public class RequestLastInputTickPacket {
|
||||
public static void handle(final RequestLastInputTickPacket packet, final Supplier<NetworkEvent.Context> contextSupplier) {
|
||||
final NetworkEvent.Context context = contextSupplier.get();
|
||||
context.enqueueWork(() -> {
|
||||
// Update last input tick (This works around GLFW forgetting about a repeat key after another one is pressed)
|
||||
OnClientInputEventHandler.checkIfInputIsAllowed();
|
||||
|
||||
// Send last input tick packet back to server
|
||||
NetworkManager.getChannel().sendToServer(new LastInputTickPacket());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user