Authentication & Limbo Core
BharatMC ka login engine Velocity proxy ke andar ek ultra-fast In-Process Netty Virtual Limbo chalata hai. Isse external auth lobbies ka kharcha aur lag completely 0 ho jata hai.
⚡ Core Engine Features
1. Centralized Redis Connection Pool & Provider API
Multiple Velocity plugins ke bich duplicate Redis connections ko khatam karne ke liye bharatmc-login ek master Lettuce + Apache Commons Pool2 connection pool host karta hai:
- Doosre plugins (
BharatMCSocial,BharatMCVoteVelocity) ko public static API provide karta hai:BharatLoginAPI.get().withRedis(...)aurBharatLoginAPI.get().runRedis(...). - Zero Socket Waste: Sabhi plugins alag se Redis instances create karne ke bajaye master pool se connection borrow karte hain aur return kar dete hain.
- PreLogin Thread Safety: High-concurrency joins ke time Redis queries queue hoti hain bina threads ko crash ya clobber kiye.
- Caffeine Fallback Cache: Agar network me temporary issue ho, toh 60-second bounded cache authentication validation sambhal leta hai.
2. In-Process Netty Virtual Limbo
- Velocity proxy ke JVM ke andar hi virtual Minecraft world simulate karta hai.
- Multi-version NBT dimension codecs (
codec_1_16.nbtse lekarcodec_26_2.nbttak) use hote hain taaki 1.16 se 1.21.x tak ka koi bhi player bina packet error ke connect ho sake. - Limbo me player move ya chat nahi kar sakta jab tak password verify na ho.
3. Sticky IP Sessions (session-expiry-hours: 24)
- Login karne par player ka verified session Redis me 24 ghante ke liye cache ho jata hai.
- Agar player disconnect hokar usi verified IP se wapas rejoin kare, toh usse dobara
/loginnahi maangta.
4. 120-Second Fast-Reconnect Grace Period
- Agar gameplay ya PvP ke doran player ka connection time out ya drop ho jaye:
- Uska last connected server (
lifesteal,survival,skyblock) memory me preserve rehta hai. - 120 seconds ke andar reconnect karte hi Velocity bina lobby bheje player ko seedhe uske previous server par reconnect kar deta hai.
- Uska last connected server (
5. Hybrid Bedrock, Cracked & Mojang Premium
- Bedrock (Geyser/Floodgate): Xbox accounts (naam ke aage
*) automatically login ho jate hain bina command run kiye. - Mojang Premium FastLogin (
/premium): Real Minecraft accounts/premiumtype karke Mojang cryptographic authentication enable kar sakte hain. Agli baar se direct login milta hai. - Cracked (
/cracked): Password authentication mode me wapas aane ke liye.
⚙️ Complete Configuration: config.yml
# BharatMC Auth System Configuration
# Debug mode — accepts both: 'debug: true' OR 'debug:\n enabled: true'
debug: false
use-limbo: true
# In-process Netty high-performance auth server running directly inside the Velocity proxy.
# Zero external dependencies, zero latency, seamless routing.
embedded-auth-limbo: true
auth-limbo:
# Name of the Limbo server registered in velocity.toml [servers]
server-name: "auth-limbo"
# Enforces cryptographic secure chat signing (1.19+).
# Set to false to allow offline/cracked and unverified clients without chat errors.
enforces-secure-chat: false
api:
url: "https://api.bharatmc.net"
key: "YOUR_API_KEY"
database:
postgresql:
host: "127.0.0.1"
port: 5432
database: "bharatmc_main"
username: "bharatmc_user"
password: "YOUR_DB_PASSWORD"
redis:
host: "127.0.0.1"
port: 6379
password: "YOUR_REDIS_PASSWORD"
security:
# Max cracked accounts allowed per IP address (registration cap)
max-accounts-per-ip: 3
# Whether to block players from REGISTERING if they exceed the IP limit
block-registrations-over-ip-limit: true
# Whether to block players from LOGGING IN if their IP is over the account limit
block-logins-over-ip-limit: false
# Auto-login players if they rejoin from the same IP (sticky sessions)
sticky-ip-session: true
# Session duration in seconds (default: 86400 = 24 hours)
session-expiry-hours: 24
# Authentication timeout in seconds (kicks player if they do not login/register in time)
auth-timeout: 60
# Automatic Premium Username Hijack Protection
hijack-protection: true
# Cosmetic/Skin UUID support (Lunar Client fix)
cosmetic-uuid-support: true
# ─────────────────────────────────────────────────────────────────────────────
# Analytics & Session Tracking
# ─────────────────────────────────────────────────────────────────────────────
analytics:
# Timezone for all timestamps sent to the backend and written to the database.
# Uses Java ZoneId format. Examples: Asia/Kolkata, UTC, America/New_York, Europe/London
timezone: "Asia/Kolkata"
# How often (in seconds) the proxy sends a server analytics heartbeat to Redis.
# Lower = more real-time dashboard, higher = less load. Min: 5s, Recommended: 30s
heartbeat-interval: 30
# ─────────────────────────────────────────────────────────────────────────────
# Queue System
# ─────────────────────────────────────────────────────────────────────────────
queue:
enabled: true
max-players: 50
# ─────────────────────────────────────────────────────────────────────────────
# Grace Period - Last Server Fast-Reconnect
# ─────────────────────────────────────────────────────────────────────────────
# When a player disconnects, their last server is remembered.
# If they reconnect within 'seconds', they are sent directly back to that server
# instead of going through lobby. Works with dynamic server names via prefix matching.
#
# IP tracking note:
# first_address = IP when the account was first registered (never changes)
# last address = most recent IP (updates every login)
# IP history = full log in user_ips table (all unique IPs with timestamps)
grace-period:
enabled: true
# How many seconds the grace period lasts after disconnect
seconds: 120
# Servers eligible for grace period redirect.
# Use the server name from velocity.toml (or a prefix of it).
# Example: 'lifesteal' will match 'lifesteal', 'lifesteal1', 'lifesteal2', etc.
# Leave empty to allow ALL servers (except excluded ones below).
servers:
- lifesteal
- survival
- skyblock
- prison
- factions
- minigames
- creative
- pvp
- bedwars
- skywars
# Servers that are NEVER eligible for grace period redirect.
# Add hub, lobby, and auth servers here to prevent routing back to them.
excluded-servers:
- lobby
- hub
- auth
- limbo
- proxy
bot-protection:
# Global join rate limit (per second) across all proxies
max-joins-per-second: 10
branding:
prefix: "<gradient:#00C9FF:#92FE9D>✦ BHARAT</gradient> <dark_gray>»</dark_gray> "
error-prefix: "<gradient:#FF416C:#FF4B2B>✕ SYSTEM</gradient> <dark_gray>»</dark_gray> "
messages:
require-ping-kick: "<gradient:#FF416C:#FF4B2B>✕ VERIFICATION REQUIRED</gradient>\n\n<gray>Please refresh your server list to authenticate your connection.</gray>\n<dark_gray>Reason: Anti-Bot Handshake Required</dark_gray>"
ip-blocked: "<gradient:#FF416C:#FF4B2B>✕ ACCESS RESTRICTED</gradient>\n\n<gray>Your IP address has been temporarily rate-limited.</gray>\n<dark_gray>Please wait a few minutes or contact support on Discord.</dark_gray>"
max-accounts-reached: "<gradient:#FF416C:#FF4B2B>✕ REGISTRATION CAP</gradient>\n\n<gray>You have reached the maximum allowed accounts for this IP.</gray>"
login-success: "<gradient:#00C9FF:#92FE9D>✦ BHARAT</gradient> <dark_gray>»</dark_gray> <white>Welcome back to <gradient:#00C9FF:#92FE9D>BharatMC</gradient>!</white>"
already-connected: "<gradient:#FF416C:#FF4B2B>✕ SESSION ACTIVE</gradient>\n\n<gray>You are already connected to this proxy network.</gray>\n<dark_gray>Terminating stale session...</dark_gray>"