
You want your character to stay on the server overnight: next to a farm, holding your spot, or just online. Then you shut down the PC and the server logs you out. That is not a setting you missed. The game on your PC is your player's connection to the server, so when the game closes, the connection goes with it. Staying AFK with the PC off means another machine has to hold that connection open, and the server has to allow it.
Quick answer: With your PC off, Minecraft is off, so something else has to stay connected for you. There are three honest ways: leave a spare PC or old laptop running the game, run a text bot client such as Minecraft Console Client or a Mineflayer script on a Linux VPS (Java Edition only, and only on servers that allow bots), or run your own server, where player-idle-timeout=0 means idle players are never kicked. Read the server's rules first: many forbid AFK farming and bots, and Aternos forbids bots that keep a server online. Sign in only with the Microsoft code your own bot shows you, never with your password.
First: Check Whether the Server Allows AFK
Many large servers do not want accounts online without a person behind them. Two examples, checked on 29 October 2026:
- Wynncraft's game rules say "Do not AFK farm" (rule 19) and "No In Game Bots" (rule 20), and define a bot as "an account left online that performs actions and/or collects information without player input."
- CubeCraft's rules ask players to avoid AFK farming and using alternative accounts to gain an advantage.
Minecraft Console Client's own disclaimer warns that "you may get banned by your server for using this program." If the rules say nothing, ask the staff before you connect a bot. And if a server kicks idle players, its owner chose that on purpose, so don't fake activity to dodge it. In Wynncraft's words: "You (not an object, software, etc.) must be inputting actions to receive rewards."
Option 1: Leave a Spare PC or Laptop Running
This is the free way. It works on any server that allows AFK, on Java and Bedrock alike, as long as the machine stays awake. On Windows 11, open Settings > System > Power & battery > Screen, sleep, & hibernate timeouts. Turn my screen off after can stay as it is, since a dark screen does not disconnect you. Set Make my device sleep after so the PC stays awake while you are away. There are separate choices for plugged in and on battery, so keep a laptop on the charger.
You don't need to lower the graphics either. Mojang's patch notes for Java Edition 1.21.2 say the game limits its own frame rate when you are AFK: 30 FPS after a minute without input, then 10 FPS after nine more minutes, by default.
The downsides: the PC draws power all night, a crash or power cut logs you out, and the server's idle kick still applies.
Option 2: Run a Bot Client on a VPS
A bot client signs in with your account and joins a server like the game does, but without a game window, so it runs on a Linux server with no screen or graphics card. Two open-source tools do this for Java Edition: Minecraft Console Client (MCC), a text client that lets you "connect to any Minecraft Java server, send commands and receive text messages" without writing code, and Mineflayer, a JavaScript library for writing your own bot.
Check the server's version first. On 29 October 2026, MCC supports 1.4.6 through 26.1 and Mineflayer 1.8 through 26.1, while Mojang's version manifest lists 26.3, out since 15 September 2026, as the newest release. A server on 26.2 or 26.3 may not accept these tools until they catch up.
Our VPS for Minecraft bots is KVM with full root access in an EU data center, so you can run every command below, all written for Ubuntu 24.04 and Debian 12.
Prepare the VPS
Run these as root or with sudo. On Debian 12 without sudo, log in as root and leave the word out.
sudo apt update && sudo apt install -y curl screen nano
For MCC, add the system libraries it needs. Its releases are self-contained single files (built with --self-contained=true), and Microsoft's docs say such an app needs no .NET runtime, only .NET's native dependencies. These are Microsoft's lists. MCC's own VPS guide installs the full .NET 10 SDK instead, which brings them along.
# Ubuntu 24.04
sudo apt install -y ca-certificates libc6 libgcc-s1 libgssapi-krb5-2 libicu74 libssl3t64 libstdc++6 tzdata zlib1g
# Debian 12
sudo apt install -y ca-certificates libc6 libgcc-s1 libgssapi-krb5-2 libicu72 libssl3 libstdc++6 tzdata
Then give the bot its own user, as MCC's guide does "for security reasons". adduser asks for a password. If you log in with an SSH key, the two install lines copy it to the new user:
sudo adduser afkbot
sudo install -d -m 700 -o afkbot -g afkbot /home/afkbot/.ssh
sudo install -m 600 -o afkbot -g afkbot ~/.ssh/authorized_keys /home/afkbot/.ssh/
Log out and, from your own computer, log in again as that user with ssh afkbot@your-vps-address, the way MCC's guide does it. Work as afkbot from here on. Both tools keep your sign-in tokens in this user's home folder, so make it private:
chmod 700 ~
Route A: Minecraft Console Client
The install script downloads one file, MinecraftClient, built for your processor. MCC's docs link the script, so you can read it before piping it into sh.
mkdir ~/mcc && cd ~/mcc
curl -fsSL https://mccteam.github.io/install.sh | sh
screen -S mcc
./MinecraftClient you@example.com "" play.example.com
Put your Microsoft email first and the server address last, as you would type it in the game. The empty quotes stand for the password, which MCC does not need because it uses "the OAuth 2.0 device code flow": it shows a code and a link, you open the link on your phone or PC, sign in (two-step verification works) and enter the code. MCC then joins the server. By default it saves the session on disk, so you don't sign in on every start.
Press Ctrl+A and then D to detach and leave MCC running. To stop it, reattach with screen -r mcc and type /quit.
Route B: Mineflayer
Mineflayer 4.39.0, the current release, needs Node.js 22 or newer (its README still says 18). Install it with nvm the way nodejs.org shows it. Node.js 22 is supported until 30 April 2027.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.8/install.sh | bash
\. "$HOME/.nvm/nvm.sh"
nvm install 22
mkdir ~/afk-bot && cd ~/afk-bot
npm install mineflayer
nano bot.js
Paste this into bot.js with your server's address, save with Ctrl+O and Enter, and close nano with Ctrl+X:
const mineflayer = require('mineflayer')
const bot = mineflayer.createBot({
host: 'play.example.com', // the server address (add port: 12345 if it does not use 25565)
auth: 'microsoft',
username: 'main' // with Microsoft sign-in this only names the saved login
})
bot.on('spawn', () => console.log('In the world'))
bot.on('messagestr', (message) => console.log(message))
bot.on('kicked', (reason) => console.log('Kicked:', reason))
bot.on('end', (reason) => console.log('Disconnected:', reason))
bot.on('error', (err) => console.log(err))
Start it inside screen:
screen -S bot
node bot.js
On the first start it prints [msa] First time signing in. Please authenticate now: and a line starting "To sign in, use a web browser to open the page", with a Microsoft link and a code. Sign in with that code on your own phone or PC. Mineflayer saves the tokens, by default in ~/.minecraft/nmp-cache, so later starts skip this. Detach with Ctrl+A and then D.
The script only holds the connection and prints chat, kicks and errors. The bot stands where you last logged out, and MCC's disclaimer warns that on a survival server "you can die if you log in in an unsafe place", so log out somewhere safe first.
Coming Back Later
Log in as afkbot and reattach with screen -r mcc or screen -r bot. screen -ls lists your sessions, and screen -d mcc detaches one that was still attached when SSH closed. A reboot ends the session and the bot, so start it again afterwards, as MCC's guide notes. Stop the bot before you play on that account yourself: it is signed in as you.
Option 3: Run Your Own Server and Set the Rules
If the real goal is your world rather than your character, online for friends or with farms running, you need a server, and on your own server you make the rules. One line in server.properties stops idle kicks:
player-idle-timeout=0
In the PaperMC docs' words: "If non-zero, players are kicked from the server if they are idle for more than that many minutes." Zero is the default, so check that nobody changed it. The server.properties generator explains the other settings.
What a Server Does With Nobody Online
A running server does not mean your farms run. Mojang's patch notes list three changes that decide it:
- 1.21.2 added
pause-when-empty-seconds, default 60. "When set to a positive value, causes the server to pause when no player has been online for that many seconds." Nothing in the world runs during the pause. Paper ships with -1, which turns it off, because pausing "is incompatible with what plugins expect". - 1.21.5 changed random ticks. Chunks loaded without a player nearby, for example by an Ender Pearl, now get random ticks, so crops can grow there. But "Mob spawning, Lava spreading fire, and Lightning strikes still occur in the previous radius of 8 chunks around players."
- 1.21.9 removed spawn chunks. With no player in a dimension, only force-loaded chunks (the
/forceloadcommand), active portals and Ender Pearls in flight keep it processing chunks and entities.
So on an empty vanilla server, a crop farm in a force-loaded chunk keeps growing once you set pause-when-empty-seconds=0, but a mob farm needs a player within 8 chunks. On your own server, that player can be the bot from Option 2. The simulation distance guide explains how far a player's presence reaches.
Aternos Is the Exception
Free Aternos forbids keeping players or servers online this way. Its terms (§5) forbid getting around the "idle timeout" by "modifying the setting which defines the time after which a player connection is terminated for inactivity", by "automatically or repeatedly reconnecting to a server" or by "faking player activity", and keeping empty servers from stopping by "using fake players, e.g. bots". Breaking them "can result in deletion or suspension of your account and all related servers and data." For a server that stays online when nobody plays, see our Aternos alternative.
Keep Your Microsoft Account Safe
Both tools sign in through Microsoft's own page with a one-time code, so your password never goes into the bot. Never give your Microsoft password to a bot or any tool you don't trust. As MCC's disclaimer puts it: "If you don't trust it, don't use it or check & compile from the source code."
Only enter a code your own bot just printed in your own terminal. Microsoft's security team has documented device code phishing, where the attacker "generates a legitimate device code request and tricks the target into entering it" and keeps access "so long as the tokens remain valid." A code someone else sends you in a chat is how that attack starts.
The saved tokens work like your login. MCC's docs say its on-disk session cache, the default, "can be a bit of a security risk if someone else has access to your folder where you have MCC installed". That is why the bot has its own user with a private home folder. Microsoft's account security tips also include its Authenticator app, which "adds another security layer to your Microsoft account".
If you think someone has your tokens, delete the saved sign-in (rm -rf ~/.minecraft/nmp-cache for Mineflayer, rm ~/mcc/SessionCache.db for MCC). Then open Advanced security options in your Microsoft account and select Sign out under Sign out everywhere. Microsoft says this "may take up to 24 hours" and does not cover an Xbox console, which you sign out of separately.
If It Still Fails
- The bot cannot join a newer server. MCC and Mineflayer go up to 26.1 on 29 October 2026; if a 26.2 or 26.3 server refuses them, wait for a tool update.
- The Microsoft sign-in hangs. MCC's VPS guide says fetching the keys "can take some time, try giving it a minute or two", then suggests pressing a few keys, restarting, or tmux instead of screen. If Microsoft refuses a sign-in from the VPS, the guide suggests checking the Security center of your account and approving the login from the VPS there.
- The bot is kicked right after it joins. Read the reason in the console. A whitelist, a ban or a rule against bots is an answer, not a bug, and Aternos forbids scripting automatic reconnects.
- The bot is gone in the morning. A reboot or server restart ends the session: check
screen -lsand start it again.
FAQ
Can you AFK in Minecraft with your PC turned off? Not with the game itself, because the game is your connection. Something else has to stay connected: a second PC running the game, a bot client on a VPS, or your own server if what you want is your world online.
Will I get banned for using an AFK bot? That depends on the server. Many large servers forbid AFK farming and bots, and MCC's disclaimer says you "may get banned by your server for using this program." Only run a bot where the rules allow it.
Can I keep my Aternos server online with a bot? No. Aternos's terms forbid bots that keep a server from stopping and getting around its idle timeout, and breaking them can get your account and servers deleted or suspended. The options that do stay online are compared in Aternos Paid Version: Is There Aternos Premium?
Does this work on Bedrock, consoles or phones? Option 1 does: the device running the game has to stay on. MCC and Mineflayer are for Java Edition only. For Bedrock, PrismarineJS publishes a separate protocol library, bedrock-protocol, which we have not tested.
Do my farms keep working while I am AFK? Only near a player. Mobs spawn within 8 chunks of a player, so an AFK mob farm needs you or your bot standing at it. On your own server, crops in force-loaded chunks keep growing with nobody online while the empty-server pause is off.
How powerful does the VPS need to be? MCC's guide says it "can run on basically any hardware", and Mineflayer publishes no figure. We have not measured either tool, so we won't give you a number.
Sources
All opened on 29 October 2026:
- Mojang: Java Edition patch notes from the Minecraft Launcher feed for 1.21.2, 1.21.5 and 1.21.9, and the version manifest
- PaperMC: server.properties reference and the Paper 1.21.3 announcement
- Minecraft Console Client: README, guide and disclaimer, installation, usage, configuration, release workflow, project file and session cache code
- Mineflayer: README, API reference and npm registry entry; node-minecraft-protocol microsoftAuth.js; prismarine-auth README, MicrosoftAuthFlow.js and LiveTokenManager.js; minecraft-folder-path; bedrock-protocol
- Node.js: download page and release schedule
- Microsoft Learn: Install .NET on Ubuntu, Install .NET on Debian and .NET application publishing overview
- Microsoft Support: How to adjust power and sleep settings in Windows, How to sign out of your Microsoft account everywhere and How to help keep your Microsoft account secure
- Microsoft Security Blog: Storm-2372 conducts device code phishing campaign, 13 February 2025
- Server rules: Aternos terms of service (§5), Wynncraft game rules and CubeCraft rules
- Ubuntu 24.04 manual pages: screen(1), adduser(8), install(1) and nano(1); Debian 12 packages: screen, libicu72 and libssl3
Minecraft is a trademark of Mojang. Space-Node is not affiliated with Mojang or Microsoft, or with the makers of Minecraft Console Client and Mineflayer.