Moved to new package for client to server packets. Renamed ClientInputPacket to InputPacket.

This commit is contained in:
2022-06-05 13:34:51 +01:00
parent ceff99c81c
commit 452b772127

View File

@ -1,26 +1,27 @@
package dev.micle.loginprotection.network;
package dev.micle.loginprotection.network.client;
import dev.micle.loginprotection.data.ProtectedPlayer;
import dev.micle.loginprotection.data.ProtectedPlayerManager;
import dev.micle.loginprotection.network.NetworkManager;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.NetworkEvent;
import java.util.function.Supplier;
public class ClientInputPacket {
public ClientInputPacket() {}
public class InputPacket {
public InputPacket() {}
public static void encode(final ClientInputPacket packet, final FriendlyByteBuf buffer) {
public static void encode(final InputPacket packet, final FriendlyByteBuf buffer) {
NetworkManager.writeVersionInfo(buffer, false);
}
public static ClientInputPacket decode(final FriendlyByteBuf buffer) {
public static InputPacket decode(final FriendlyByteBuf buffer) {
NetworkManager.checkVersion(buffer);
return new ClientInputPacket();
return new InputPacket();
}
public static void handle(final ClientInputPacket packet, final Supplier<NetworkEvent.Context> contextSupplier) {
public static void handle(final InputPacket packet, final Supplier<NetworkEvent.Context> contextSupplier) {
final NetworkEvent.Context context = contextSupplier.get();
context.enqueueWork(() -> {
// Get sender