light21zox

Create a Minecraft Java Edition server plugin called ServerBot24/7.

Main Goal

The plugin should add an NPC/bot player to the server that can automatically join and stay online 24/7, helping keep the server active.

Features

  • Command: "/bot start" — spawn/start the bot.
  • Command: "/bot stop" — remove/stop the bot.
  • Command: "/bot status" — show whether the bot is online.
  • Command: "/bot restart" — restart the bot.
  • Command: "/bot setname <name>" — change the bot's username.
  • Command: "/bot setspawn" — save the bot's spawn location.
  • Bot automatically reconnects if it gets disconnected.
  • Bot should automatically start when the server starts.
  • Config option to enable/disable auto-start.
  • Configurable bot name.
  • Configurable spawn location.
  • Bot should remain AFK without causing unnecessary server lag.
  • Bot should not attack players or interfere with gameplay.
  • Add a configurable AFK movement option so the server does not consider it completely idle.
  • Add console messages for bot join, disconnect, reconnect, and errors.
  • Add permission: "serverbot.admin".
  • Only operators or players with permission can use bot commands.
  • Store all settings in "config.yml".

Compatibility

  • Use Java.
  • Use the appropriate API for the target Minecraft server version.
  • Keep the code clean, optimized, and easy to compile.
  • Do not use unnecessary external dependencies.
  • Include "plugin.yml".
  • Include complete source code and build configuration.
  • Include installation instructions and example "config.yml".

Important

The bot must reconnect automatically after crashes/disconnections, but it must not bypass hosting-provider limits, AFK restrictions, or server-provider rules. The plugin should only keep the bot connected while the Minecraft server itself is running.

Kodari AI
KodariAug 20 at 10:03 am 2
ServerBot247
ServerBot247 is a Minecraft Bukkit/Spigot plugin that spawns and manages an automated NPC bot player, keeping the server active 24/7. It provides commands to start, stop, restart, check status, set the bot's name, and set its spawn location. The bot auto-reconnects after disconnections and auto-starts with the server if enabled. Configurable via config.yml for bot name, spawn location, auto-start toggle, and AFK movement simulation to prevent idle detection. The bot remains passive, never attacks players, and operates only while the Minecraft server runs. Requires the serverbot.admin permission for command usage. Console messages log join, disconnect, reconnect, and errors. Built with Java, using the Bukkit/Spigot API, with no external dependencies beyond the server API. Includes plugin.yml and Maven build configuration.
  1. Create the Maven project and plugin metadata.

  2. Implement the reflective server-side bot manager with auto-start, reconnect, AFK movement, and persistence.

  3. Add bot commands, event handling, configuration, and installation documentation.

  1. Created the Maven-based Paper 1.20.4 plugin project with Java 17 support.

  2. Added /bot start, stop, status, restart, setname, and setspawn.

  3. Implemented automatic startup, reconnect handling, configurable AFK movement, spawn persistence, and console logging.

  4. Added serverbot.admin permission protection and complete plugin.yml.

  5. Added example config.yml, README installation instructions, and hosting-provider compliance notes.

The bot implementation is isolated in NmsBotSpawner and uses server-side reflection because Bukkit/Paper does not expose a public API for creating fake online players.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
9 709
src/main/java/com/serverbot247/ServerBotPlugin.java
package com.serverbot247;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class ServerBotPlugin extends JavaPlugin {
    private BotManager botManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.botManager = new BotManager(this);
        Bukkit.getPluginManager().registerEvents(new BotListener(botManager), this);

        PluginCommand command = getCommand("bot");
        if (command == null) {
            getLogger().severe("The /bot command is missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        BotCommand botCommand = new BotCommand(botManager);
        command.setExecutor(botCommand);
        command.setTabCompleter(botCommand);

        botManager.startWatchdog();
        if (getConfig().getBoolean("auto-start", true)) {
            Bukkit.getScheduler().runTask(this, () -> botManager.start());
        }
    }

    @Override
    public void onDisable() {
        if (botManager != null) {
            botManager.stop();
        }
    }
}