Bedwars Plugin Documentation
Overview
A modern Bedwars implementation for Minecraft 1.21.4, built with Java 23. This plugin provides team-based gameplay where players protect their bed while attempting to destroy others'.
Technical Requirements
io.papermc.paper paper-api 1.21.4-R0.1-SNAPSHOT provided ``` " data-section-index="10" style="border-radius: 4px; margin: 6px 0px; padding: 4px; position: relative; scroll-margin-bottom: 40px; scroll-margin-top: 40px; color: rgb(204, 204, 204); font-family: "Segoe WPC", "Segoe UI", sans-serif; font-size: 13px; background-color: rgb(24, 24, 24);">
- Reference to dependencies:
- <dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
- Core Features
️ Game Setup
The game setup system allows administrators to create and configure maps with:
- Resource generators (Diamond/Gold)
Reference implementation:
- public void initializeGame() {
// Logic to initialize the game environment, teams, and players
System.out.println("Game setup initialized.");
}
public void createMap(String name) {
// Logic to create a map with the given name
System.out.println("Map created: " + name);
}
public void setSpawnPoint(Player player) {
Block targetBlock = player.getTargetBlock(null, 5);
if (targetBlock != null) {
int x = targetBlock.getX();
int y = targetBlock.getY();
int z = targetBlock.getZ();
setSpawnPoint(x, y, z);
System.out.println("Spawn point set at: " + x + ", " + y + ", " + z);
} else {
System.out.println("No target block found.");
}
}
System.out.println("Gold store set at: " + x + ", " + y + ", " + z);
public void setSpawnPoint(int x, int y, int z) {
// Logic to set the spawn point at the given coordinates
System.out.println("Spawn point set at: " + x + ", " + y + ", " + z);
}
Block targetBlock = player.getTargetBlock(null, 5); // 5 is the max distance to check
public void setDiamondSpawn(int x, int y, int z) {
// Logic to set the diamond spawn point at the given coordinates
System.out.println("Diamond spawn set at: " + x + ", " + y + ", " + z);
}
System.out.println("Shop set at: " + x + ", " + y + ", " + z);
public void setGoldStore(int x, int y, int z) {
// Logic to set the gold store point at the given coordinates
System.out.println("Gold store set at: " + x + ", " + y + ", " + z);
}
public void setShop(Player player) {
// Use the player's target block to set the shop location
Block targetBlock = player.getTargetBlock(null, 5); // 5 is the max distance to check
if (targetBlock != null) {
int x = targetBlock.getX();
int y = targetBlock.getY();
int z = targetBlock.getZ();
System.out.println("Shop set at: " + x + ", " + y + ", " + z);
} else {
System.out.println("No target block found.");
}
}
public void setBedBlock(int x, int y, int z) {
// Logic to set the bed block location at the given coordinates
System.out.println("Bed block set at: " + x + ", " + y + ", " + z);
}
Shop System
The shop system features:
- Item purchase verification
Current available items and prices:
- public Shop() {
prices.put("Sword", 10);
prices.put("Armor", 20);
prices.put("Bow", 15);
}
Statistics Tracking
Player statistics are tracked including:
Implementation details:
private final Map<String, Integer> wins = new HashMap<>();
private final Map<String, Integer> losses = new HashMap<>();
private final Map<String, Integer> kills = new HashMap<>();
Commands
Admin Commands
| Command | Description | Usage |
|---------|-------------|--------|
` |" data-section-index="47" style="border-radius: 4px; margin: 6px 0px; padding: 4px; position: relative; scroll-margin-bottom: 40px; scroll-margin-top: 40px; color: rgb(204, 204, 204); font-family: "Segoe WPC", "Segoe UI", sans-serif; font-size: 13px; background-color: rgb(24, 24, 24);">| /mapcreate | Creates a new map | /mapcreate <name> |
| /mapsetspawn | Sets team spawn location | /mapsetspawn |
| /mapsetshop | Sets shop location | /mapsetshop |
Reference implementation:
switch (command.getName().toLowerCase()) {
case "mapcreate":
if (args.length > 0) {
gameSetup.createMap(args[0]);
player.sendMessage("Map created: " + args[0]);
} else {
player.sendMessage("Please provide a map name.");
}
break;
case "mapsetspawn":
gameSetup.setSpawnPoint(player);
player.sendMessage("Spawn point set.");
break;
case "mapsetshop":
gameSetup.setShop(player);
player.sendMessage("Shop location set.");
break;
// Add more commands as needed
default:
player.sendMessage("Unknown command.");
break;
}
Player Commands
| Command | Description | Usage |
|---------|-------------|--------|
| /stats | View personal statistics | /stats |
Stats command implementation:
player.sendMessage("Your Stats:");
player.sendMessage("Wins: " + wins);
player.sendMessage("Losses: " + losses);
player.sendMessage("Kills: " + kills);
Game Management
The game is managed through the GameManager class which handles:
Reference:
public void startGame() {
// Logic to start a new Bedwars game
System.out.println("Game started!");
gameLogic.manageGameplay();
}
public void stopGame() {
// Logic to stop the current Bedwars game
System.out.println("Game stopped!");
}
public void manageGameState() {
// Logic to manage the ongoing game state
System.out.println("Managing game state...");
}
Plugin Configuration
The plugin configuration is handled through the plugin.yml:
name: Bedwars Project
version: '1.21.4'
main: org.bedwars.BedwarsProject
api-version: 1.21.4
authors: DaaanielTV
description: Bedwars Plugin
Development
Building the Project
The project uses Maven for dependency management and building. To build:
- Ensure Java 23 is installed
- Find the compiled jar in target/
Maven configuration reference:
<properties>
<java.version>23</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Adding New Features
When adding new features:
- Create appropriate classes in the org.bedwars.bedwarsproject package
- Register commands in plugin.yml
- Initialize components in the main class:
@Override
public void onEnable() {
// Plugin startup logic
gameManager = new GameManager();
gameManager.startGame();
}