MinigamesAPI serves as a robust foundation for building custom Minecraft minigames. Instead of reinventing the wheel for every new minigame project, developers can leverage this API to handle common minigame functionality such as:
- Game state management (waiting, playing, ending phases)
- Team system with automatic player distribution
- World management with SlimeWorldManager integration
- Player data persistence with database support (MySQL/MongoDB)
- Scoreboard system for real-time game information
- Custom inventory management with snapshot support
- Event-driven game phases with custom listeners
- GUI system for interactive menus
- Custom item framework for special game items
- Clean, well-documented API with extensive JavaDocs
- Type-safe method signatures preventing common errors
- Builder patterns for complex object creation
- Event-driven architecture for maximum flexibility
- Comprehensive logging for debugging
- Lightweight architecture that minimizes server overhead
- Efficient memory management with optimized data structures
- Asynchronous world loading to prevent server lag
- Thread-safe operations for multi-threaded environments
- Intuitive API design with clear method naming and documentation
- Null-safe implementation preventing common NPE issues
- Extensive type safety using Java generics
- Flexible configuration system with YAML support
- Modular architecture allowing you to use only what you need
MinigamesAPI is perfect for creating:
- Arena-based PvP games (Skywars, Bedwars, UHC)
- Team games (Capture the Flag, Team Deathmatch)
- Survival challenges (Hunger Games, Battle Royale)
- Competitive minigames (TNT Run, Spleef, Parkour)
- Custom game modes with unique mechanics
- Minecraft Version: 1.8.8 (Spigot/Paper)
- Java Version: 17+
- MySQL/MariaDB - Recommended for production
- MongoDB - Alternative NoSQL option
- Automatic schema management - Tables/collections created automatically
- Version migration system - Seamless database updates
- SlimeWorldManager format - Efficient world serialization
- MySQL storage - Store worlds in your database
- MongoDB storage - Alternative cloud storage
- Zstd compression - Reduced storage footprint
- Download the plugin JAR file
- Install ClassModifier (required agent):
- Add -javaagent:MinigamesAPI-CLASSMODIFIER-VERSION.jar to your server startup parameters
- Configure database in your minigame plugin's config
- Restart server and enjoy!
Maven Integration:
XML:
<repositories>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.io/repository/xfedet/</url>
</repository>
</repositories>
<dependency>
<groupId>it.fedet.minigames.api</groupId>
<artifactId>MinigameAPI</artifactId>
<version>VERSION</version> <!-- Replace "VERSION" with the version you choose -->
</dependency>
Gradle Integration:
Code:
repositories {
maven { url 'https://repo.codemc.io/repository/xfedet/' }
}
dependencies {
compileOnly 'it.fedet.minigames.api:MinigameAPI:VERSION' //Replace "VERSION" with the version you choose
}
Java:
public class YourMinigame extends JavaPlugin implements Minigame<YourMinigame> {
private MinigamesAPI api;
@Override
public void onEnable() {
// Get API instance
api = MinigamesProvider.get();
// Register your minigame
api.registerMinigame(this);
}
@Override
public List<MinigameConfig> registerConfigs() {
// Register your config files
return List.of(new YourConfig());
}
@Override
public Map<Class<? extends GameGui<YourMinigame>>, GameGui<YourMinigame>> registerGuis() {
// Register your custom GUIs
return Map.of();
}
@Override
public Map<Class<? extends GameInventory>, GameInventory> registerInventorys() {
// Register game inventories (lobby items, game kits, etc.)
return Map.of();
}
@Override
public Map<Class<? extends GameCommand>, GameCommand> registerCommands() {
// Register your commands
return Map.of();
}
@Override
public TeamProvider registerTeamProvider() {
// Define how teams are created and managed
return new YourTeamProvider();
}
@Override
public MinigamesAPI getMinigamesAPI() {
return api;
}
}
Creating a Game Phase:
Java:
public class WaitingPhase extends MinigamePhase<YourMinigame> {
public WaitingPhase(Game<YourMinigame> game) {
super(game);
}
@Override
public MinigamePhase<YourMinigame> nextPhase() {
return new PlayingPhase(game);
}
@Override
public void tick() {
// Called every server tick
// Check if ready to start game
}
@Override
public GameBoard getScoreboard(Player player) {
// Return scoreboard for this phase
return new WaitingScoreboard(game);
}
@Override
public GameListener<?>[] registerListeners() {
// Register phase-specific event listeners
return new GameListener<?>[] {
new PlayerJoinListener(),
new PlayerQuitListener()
};
}
}
