Skip to content

A PaperMC Java plugin letting server users play minecraft and have an LLM baked right in!

License

Notifications You must be signed in to change notification settings

domasles/paperchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Sep 22, 2025
d6bb4e9 · · Sep 22, 2025

History

41 Commits
Sep 13, 2025
Sep 15, 2025
Sep 12, 2025
Sep 15, 2025
Sep 12, 2025
Sep 12, 2025
Sep 11, 2025
Sep 13, 2025
Sep 22, 2025
Sep 15, 2025
Sep 12, 2025
Sep 12, 2025

Repository files navigation

PaperChat Logo

PaperChat - AI-Powered Minecraft Plugin

PaperChat is a Minecraft server plugin that integrates AI language models directly into Minecraft. It allows players to send messages to AI assistants and get answers quickly, creating natural conversation experiences powered by Google Gemini and OpenAI models, with the ability to add your own!

Built for PaperMC servers, PaperChat maintains conversation history per player and provides a seamless bridge between Minecraft players and modern AI capabilities.

Official demos

As this project is in its early beta stage, the official demo/beta builds are published here, on GitHub (check Releases and Packages sections) and on Modrinth to be easily accessible by the community.

Using links below you can find the latest builds on both platforms:

Project Philosophy

PaperChat follows the "run it yourself" philosophy. By requiring your own AI API credentials and local deployment, you get:

  • No Rate Limits - Your API keys, your usage quotas
  • Complete Privacy - Player conversations never leave your infrastructure
  • Full Control - Customize AI behavior, system prompts, and response filtering
  • No Dependencies - No external services beyond the AI providers themselves

Features

  • Multi-Provider AI Support: Automatic registration of Google Gemini and OpenAI providers with easy extensibility
  • Persistent Conversation History: Per-player chat sessions with configurable history limits
  • Smart Error Handling: User-friendly error messages with automatic response recovery
  • Configurable System Prompts: Define AI behavior and response formatting rules
  • Input Validation: Character limits
  • Asynchronous Processing: Non-blocking AI requests to maintain server performance
  • Docker Ready: Complete containerized deployment with Minecraft server bundled in

Quick Start

Docker Deployment (Recommended)

  1. Clone the repository:
git clone https://github.com/yourusername/paperchat.git

cd paperchat
  1. Configure environment variables:
# Create environment file
cp .env.example .envv

NOTE: Edit the .env file to set your desired settings.

  1. Start with Docker Compose:
# Run the cloud container
docker-compose up --build



# Or build yours and then run
docker-compose up --buildd

Local Build & Installationtion

Prerequisites

  • Java 21 or higher
  • Gradle 9.0 or higher
  • PaperMC server 1.21+

Building from Source

  1. Configure and build the plugin:
gradle wrapper --gradle-version 9.0
./gradlew clean buildd
  1. Copy to server:
cp build/libs/paperchat-*.jar /path/to/your/minecraft/server/plugins/
  1. Configure environment variables:
export PAPERCHAT_API_KEY="your-api-key-here"

export PAPERCHAT_PROVIDER="google"

export PAPERCHAT_MODEL="gemini-2.5-flash"
  1. Start your Minecraft server

Available Providers

Configuration

PaperChat is configured through either environment variables:

Variable Description Value
PAPERCHAT_API_KEY Your AI provider API key your-api-key (required only by your provider. If an AI provider does not require an API key, you can leave this blank)
PAPERCHAT_MAX_HISTORY Max number of past requests to be saved per player Conversation history limit
PAPERCHAT_PROVIDER One of the available AI providers AI provider (see more at Available Providers)
PAPERCHAT_MODEL Any LLM that a provider provides Model to use (required only by your provider. If an AI provider does not require a model to be set, you can leave this blank)
PAPERCHAT_TEMPERATURE Response creativity (0.0-1.0) 0.7
PAPERCHAT_TIMEOUT Request timeout in seconds 30
PAPERCHAT_MAX_INPUT_CHARACTERS Maximum input message length 100
PAPERCHAT_MAX_OUTPUT_TOKENS Maximum response length 4096
PAPERCHAT_SYSTEM_PROMPT Custom system prompt for AI behavior Your custom prompt (leaving empty uses default system prompt)

Or config.yml file located in the data/plugins/PaperChat/ directory:

ai:
   api-key: ""  # You can leave it empty if your provider does NOT require an API key
   provider: "google"
   model: "gemini-2.5-flash"  # You can leave it empty if your provider does NOT require a model parameter. However, at the moment this is only true for HackClub provider
   temperature: 0.7
   timeout: 30
   max-output-tokens: 4096
   system-prompt: ""  # Include your custom system prompt here


# NOTE: setting a system prompt here will overwrite the current prompt

# If left empty, the default system prompt will be used


# Chat Configuration

chat:
   max-history: 5
   max-input-characters: 100

Configuration in config.yml matches the environment variables. If both are set, the environment takes precedence.

Usage

Basic Commands

Send a message to AI:

/paperchat 

Available options:

 - /paperchat  : Ask a question to the AI
 - /paperchat history : View your conversation history
 - /paperchat clear : Clear your conversation history
story
y

Permissions

  • paperchat.use - Allows players to use the /paperchat command

Response Flow

  1. Player sends command with target message
  2. AI processes the message with conversation history context
  3. Response is formatted and sent to the sender
  4. Both the original message and AI response are stored in conversation history

Architecture

PaperChat follows clean architecture principles:

src/main/java/lt/domax/paperchat/
├── domain/
│   ├── ai/            # AI provider abstractions and registry
│   ├── chat/          # Chat services and session management
│   ├── config/        # Configuration management
│   └── player/        # Player data management
├── infrastructure/
│   └── commands/      # Minecraft command implementations
├── resources/
│   ├── plugin.yml     # Plugin metadata
│   └── META-INF       # Java metadata
│       └── services/  # Service provider configurations
└── PaperChat.java     # Main plugin class
lugin class

AI Provider System

  • Abstract Provider Class: Base for all AI implementations
  • Service Provider Interface: Automatic registration using Java SPI
  • Registry Pattern: Centralized provider management
  • Graceful Fallback: Automatic error recovery and user-friendly messages

Development

Adding New AI Providers

  1. Create provider class:
@AIProvider("yourprovider")

public class YourProvider extends Provider {
     // Implementation
}}
  1. Add to service registry: Add your provider class name to::
src/main/resources/META-INF/services/lt.domax.paperchat.domain.ai.Provider

API Credentials Setup

Google Gemini

  1. Visit Google AI Studio
  2. Create a new API key
  3. Set PAPERCHAT_API_KEY to your key
  4. Set PAPERCHAT_PROVIDER to google
  5. Set PAPERCHAT_MODEL to your desired Gemini model (e.g., gemini-2.5-flash)

OpenAI

  1. Visit OpenAI API
  2. Create a new API key
  3. Set PAPERCHAT_API_KEY to your key
  4. Set PAPERCHAT_PROVIDER to openai
  5. Set PAPERCHAT_MODEL to your desired OpenAI model (e.g., gpt-5)

Hack Club's OpenAI

  1. Visit Hack Club's AI
  2. Set PAPERCHAT_API_KEY to be empty (any other value will simply be ignored)
  3. Set PAPERCHAT_PROVIDER to hackclub

Troubleshooting

Common Issues

Plugin fails to load or compile:

  • Check Java version (requires 21+)
  • Verify API key and/or model is set correctly
  • Check server logs for detailed error messages

AI responses not working:

  • Verify API key has sufficient credits/quota
  • Check network connectivity from server
  • Review timeout settings

Performance issues:

  • Reduce PAPERCHAT_MAX_HISTORY value
  • Increase PAPERCHAT_TIMEOUT for slow networks
  • Monitor API usage and rate limits

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes following the existing architecture
  4. Submit a pull request

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Security

  • API keys are never logged or exposed
  • All AI requests use HTTPS
  • Player data is stored locally only
  • No external data transmission beyond AI providers

Support

For issues, feature requests, or questions:

  • Open an issue on GitHub
  • Review configuration options

Built with modern Java practices for reliable Minecraft server integration. Happy chatting!