package xyz.tbvns.rogue_block.Events;

import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import xyz.tbvns.rogue_block.Managers.WorldManager;
import xyz.tbvns.rogue_block.Utils;

public class PlayerJoinEvents implements ServerPlayConnectionEvents.Join {
    @Override
    public void onPlayReady(ServerPlayNetworkHandler serverPlayNetworkHandler, PacketSender packetSender, MinecraftServer minecraftServer) {

        //Delay the tp to prevent issues
        Utils.delay(1000, () -> WorldManager.teleportToLobbyWorld(serverPlayNetworkHandler.player));
    }
}
