AI Chatbots in Minecraft
An AI chat plugin can answer player questions in natural language, give NPCs conversations, and help moderators review chat. This guide covers the provider choice and configuration, then how to test the integration before players depend on it.
The short version:
- Write a system prompt with your server's real rules, commands, and economy.
- Set a per-player cooldown and a billing alert before you open it to players.
- Ask 20-30 typical player questions by hand and check the answers.
- Connect 10-50 bots that ask questions at the same time, and measure response times, failed answers, and TPS.
- Repeat the question list after every prompt or model change.
Run the bot tests on a server that you own or have permission to test.
Choosing an LLM Provider
First decide where the model runs. The trade-offs are cost, quality, and privacy, and the number of players who use it decides which one matters most.
For public servers with many players, use a small, low-cost model or a local model through Ollama. With hundreds of players asking questions every day, the cost of a large model adds up quickly, and a small model can answer "how do I claim land?" just as well.
For smaller or private servers, a larger model can be affordable. With 10-30 active players, the cost per question stays low, and larger models are usually better at NPC roleplay where staying in character matters.
OpenAI's small models are a common choice for public servers. Check the model list for current models and prices, and start with the smallest model that answers your test questions well.
You send player chat to OpenAI's servers, which may matter depending on your server's privacy stance. You'll also need an API key and a stable internet connection.
public class GPTChatBot {
private static final String API_URL = "https://api.openai.com/v1/chat/completions";
public String askGPT(String question) {
JSONObject requestBody = new JSONObject();
requestBody.put("model", "gpt-4.1-mini");
JSONArray messages = new JSONArray();
messages.put(new JSONObject()
.put("role", "system")
.put("content", "You are a helpful Minecraft server assistant.")
);
messages.put(new JSONObject()
.put("role", "user")
.put("content", question)
);
requestBody.put("messages", messages);
// Send HTTP request async, parse response
}
}Learn more: OpenAI API documentation
Plugin Configuration
Most AI chat plugins use the same parts: a trigger keyword, a system prompt, a rate limit, and the provider connection. The example below shows those parts. Key names differ between plugins, so check your plugin's documentation.
provider: "ollama" # or "openai", "claude"
ollama:
url: "http://localhost:11434"
model: "gpt-oss:20b"
timeout: 30
trigger: "@ai" # Players type "@ai question here"
system-prompt: |
You are a helpful assistant on a Minecraft server.
Answer questions about the server, game mechanics, and help players.
Keep responses concise (1-3 sentences).
Be friendly and encouraging.
use-context: true
context-messages: 5 # Remember last 5 messages per player
cooldown: 10 # seconds between requests per player
content-filter:
enabled: true
response: "I'm here to help with server questions only!"The system prompt decides most of the answer quality. A specific prompt that includes your server's IP, rules, economy system, and custom commands produces useful answers. A generic "You are a helpful assistant" prompt produces generic answers.
Crafting System Prompts
Server assistant example:
system-prompt: |
You are Steve, the helpful server assistant bot.
Server info:
- IP: play.example.com
- Type: Survival with economy
- Rules: No griefing, cheating, or toxicity
- Currency: Coins earned by playing
- Claiming: /claim command, costs 10 coins per chunk
Guidelines:
- Be friendly and concise (1-3 sentences)
- Direct complex questions to staff (/helpop command)
- If you don't know an answer, say "I'm not sure, please ask staff with /helpop"Roleplay NPC example:
entities:
wizard_npc:
system-prompt: |
You are Eldrin, an ancient wizard who runs the magic shop.
Personality: Wise, slightly mysterious, occasionally cryptic.
Background: 500 years old, studied at the Arcane Academy.
Speech patterns:
- Start sentences with "Ah," or "Indeed,"
- Reference "the old ways" occasionally
- Speak in slightly formal English
If asked to do something you can't: "That is beyond even my considerable powers..."For NPC interactions, mods like CreatureChat (Fabric/Forge) let you assign AI personalities to individual mobs and entities, each with their own context and behavior constraints.
AI-Assisted Moderation
AI can also help moderators. Players get around keyword filters easily, and a model can flag messages that a filter misses:
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
String message = event.getMessage();
// Your own method that asks the LLM for a JSON verdict like
// { "toxic": false, "spam": false, "scam": false, "confidence": 0.95 }
ModerationResult analysis = analyzeChatMessage(message);
if (analysis.toxic() && analysis.confidence() > 0.8) {
event.setCancelled(true);
player.sendMessage("Please keep chat respectful!");
logToModerators(player, message, "Toxic language detected");
}
}For example, "nice base, would be a shame if something happened to it" is a grief threat that no keyword filter would flag. A model can also flag scams, spam, and toxic messages in several languages without long word lists.
AI moderation should flag and log, not auto-ban. Let staff make the final call on serious actions. False positives are inevitable, especially early on.
Testing AI Chat Integration
Functional Testing
Start with the basics: does the AI respond at all, and are the responses useful?
- Trigger recognition: Send
@ai helloand make sure a response arrives within a reasonable window (under 5 seconds for cloud, under 10 for self-hosted). - Response quality: Ask server-specific questions ("How do I claim land?", "What's the server IP?") and check that the answers match your system prompt's knowledge.
- Context persistence: Send a multi-turn conversation and see if follow-up questions reference previous answers correctly. Ask "What biomes are near spawn?", then "Which has the best resources?" The AI should connect these.
- Multi-language: If your server is international, confirm the AI responds in the player's language.
If any of these fail, check the system prompt and the provider configuration first.
Safety and Rate Limiting
Without rate limiting, a single player can burn through your entire API budget in minutes. If you're using a cloud LLM, set this up before anything else.
- Cooldown enforcement: Send two queries back-to-back. The second should get blocked with a cooldown message. Wait the configured interval, then confirm the next query goes through.
- Content filtering: Send queries that should be rejected and make sure the AI declines gracefully rather than engaging.
- Conversation isolation: Have two players ask questions at the same time and check that their responses don't get mixed up.
Load Testing with Bots
Functional testing tells you it works. It doesn't tell you what happens when 50 players all ask questions during a server event.
What to measure:
Connect 10-50 bots with SoulFire and have them ask questions at the same time. SoulFire's Auto chat plugin repeats configured messages after a delay, so fill it with your trigger keyword and test questions. For questions that depend on earlier answers, use a visual script with On Chat and Send Chat nodes. Watch the server chat with the Chat logger plugin, and track:
- Response time distribution: Average, median, 95th percentile, and maximum. Target under 5 seconds average, under 10 for 95th percentile.
- Success rate: What percentage of questions get an answer? Anything below 95% means you've got a queueing or timeout problem.
- Server TPS impact: AI processing shouldn't drag down server performance. If TPS drops below 18 during the test, the plugin is likely doing synchronous work on the main thread.
- AI service resource usage: Monitor CPU and RAM on whatever's running your LLM. If Ollama hits 85%+ CPU during load tests, you'll need to scale or queue more aggressively before a real event.
Interpreting results:
If all queries are answered but response times climb linearly with bot count, the system is queueing properly but may need a faster model or additional capacity. If queries start timing out entirely, check whether the plugin has a proper request queue or is dropping requests under load.
Regression Testing
Every time you change the system prompt, the model, or the plugin version, run your tests again. Models rarely give the same answer twice, so check for consistent quality, not identical text. Keep a list of 20-30 representative questions and spot-check the answers after each change.
Production Considerations
Check these points before you open the feature to players:
- Fallback behavior: What happens when your LLM provider is down? The plugin should either queue requests or tell the player to try again later. Silent failures are the worst outcome here.
- Conversation logging: Log AI interactions for debugging and prompt improvement, but be transparent with players about it.
- Cost monitoring: For cloud LLMs, set up billing alerts. A popular server can generate thousands of queries per day.
- Prompt iteration: Your first system prompt won't be your best. Review logs regularly and refine based on what players ask and how the AI answers.
Next steps
- Collect 20-30 real questions from your Discord or help channel and use them as your test list.
- Set the cooldown and billing alert, then run the functional and safety checks above.
- Run the bot load test with SoulFire, following the staged load test.
- After launch, review the logs and update the prompt with the questions it answered badly.
SoulFire bots can also use AI themselves. The AI features guide covers that setup.