📄
pasted-code-1787238173024.txt
txt
207 lines
▶
Create a complete Minecraft plugin from scratch called **ChaosCore**.
### ENVIRONMENT
* Minecraft: **1.20.1**
* Server software: **Paper**
* Language: **Java**
* Java: **JDK 21**
* Build system: **Maven**
* The plugin must work without Skript.
* Do not use unnecessary external plugins or addons.
* The code should be clean, stable, and easy to expand in the future.
### MAIN GOAL
ChaosCore should be a system of random events (“Chaos Events”) on a Minecraft server.
The plugin should automatically start random events at set intervals. An administrator should also be able to start events manually.
### COMMAND
Add the main command:
`/chaos`
Subcommands:
`/chaos start `
`/chaos stop`
`/chaos list`
`/chaos info`
`/chaos reload`
Add the appropriate permissions:
`chaos.admin`
`chaos.use`
### FIRST EVENTS
#### 1. Meteor Shower
The event lasts for a configurable number of seconds.
During the event:
* meteors fall in random locations,
* fire and explosion effects appear,
* players receive appropriate messages,
* the event should not destroy the entire map,
* meteors should spawn at a safe distance from players,
* a message appears when the event ends.
#### 2. Blood Moon
During the event:
* set the time to night,
* increase mob spawning,
* strengthen selected mobs,
* add red effects/particles,
* notify all players when the event starts.
#### 3. Thunder Chaos
During the event:
* lightning strikes randomly,
* lightning should not instantly kill players,
* add visual and sound effects,
* the event automatically ends after a configurable amount of time.
#### 4. Chaos Chest
A special chest appears in a random safe location.
The chest:
* has a custom name,
* contains random rewards,
* can only be opened during the event,
* disappears when the event ends.
### AUTOMATIC EVENT SYSTEM
Add a scheduler that:
* counts down to the next event,
* randomly selects an event,
* starts it automatically,
* displays a countdown to players,
* prevents two events from running at the same time,
* allows automatic events to be disabled in `config.yml`.
### MESSAGES
Use Minecraft color codes and make all messages configurable through `config.yml`.
Example:
`&8[&5ChaosCore&8] &d⚡ Chaos is starting!`
Add:
* event start message,
* event end message,
* countdown message,
* error message,
* no-permission message.
### TITLES AND SOUNDS
When an event starts:
* show players a Title,
* show a Subtitle,
* play an appropriate sound.
When an event ends:
* show a separate Title,
* play an ending sound.
### CONFIG.YML
Create a detailed `config.yml` where the following can be configured:
* time between events,
* duration of each event,
* automatic event activation,
* enabling/disabling individual events,
* messages,
* titles,
* sounds,
* rewards,
* event radius,
* worlds where events can occur.
### ARCHITECTURE
Separate the code into classes, for example:
`ChaosCore.java`
`commands/ChaosCommand.java`
`events/ChaosEvent.java`
`events/MeteorShowerEvent.java`
`events/BloodMoonEvent.java`
`events/ThunderChaosEvent.java`
`events/ChaosChestEvent.java`
`managers/EventManager.java`
`managers/ConfigManager.java`
`utils/MessageUtils.java`
You may adjust the structure if you have a better architecture.
### SAFETY
The plugin must not:
* crash the server,
* create infinite tasks,
* leave active schedulers running after the plugin is disabled,
* destroy the entire map,
* cause severe server lag.
All Bukkit/Paper tasks must be properly cancelled when the plugin is disabled.
### MAVEN
Generate a complete `pom.xml` for Paper 1.20.1 and Java 21.
Also generate a complete `plugin.yml`.
The plugin must have a correct main class, commands, permissions, and all required dependencies.
### IMPORTANT
Do not provide pseudocode.
Generate the **complete, working code for every file**.
For each file, provide its exact path, for example:
`src/main/java/.../ChaosCore.java`
Then provide the complete contents of that file.
At the end, explain step by step:
1. how to create the project in IntelliJ IDEA,
2. where to paste each file,
3. how to build the plugin using Maven,
4. where the `.jar` file will be located,
5. how to install it on a Paper 1.20.1 server,
6. how to launch and test ChaosCore.
The code should be prepared for someone who **does not know how to program**, so the instructions must be very detailed and should not skip any steps.
Create the Maven/Paper project metadata and default configuration.
Implement the core plugin, configuration, messaging, command, and event manager layers.
Implement all four configurable chaos events with cleanup and safety handling.
Add plugin registration and provide build/install/test instructions.
Implemented the complete ChaosCore Maven project.
Included files
pom.xmlsrc/main/resources/plugin.ymlsrc/main/resources/config.ymlsrc/main/java/com/kodari/chaoscore/ChaosCore.javasrc/main/java/com/kodari/chaoscore/commands/ChaosCommand.javasrc/main/java/com/kodari/chaoscore/managers/ConfigManager.javasrc/main/java/com/kodari/chaoscore/managers/EventManager.javasrc/main/java/com/kodari/chaoscore/events/ChaosEvent.javasrc/main/java/com/kodari/chaoscore/events/MeteorShowerEvent.javasrc/main/java/com/kodari/chaoscore/events/BloodMoonEvent.javasrc/main/java/com/kodari/chaoscore/events/ThunderChaosEvent.javasrc/main/java/com/kodari/chaoscore/events/ChaosChestEvent.javasrc/main/java/com/kodari/chaoscore/utils/MessageUtils.java
Features implemented
/chaos start <event>/chaos stop/chaos list/chaos info [event]/chaos reloadchaos.useandchaos.adminpermissionsAutomatic random event scheduling
Event countdown messages
Configurable event durations
Configurable event enable/disable settings
Configurable worlds and event radius
Meteor showers with controlled explosions
Blood Moon with night-time effects and strengthened mobs
Thunder Chaos with visual lightning effects
Chaos Chest with configurable random rewards
Titles, subtitles, sounds, and messages
Cleanup of scheduled tasks and active events on shutdown
Java 21 and Paper 1.20.1 Maven configuration
Build instructions
Install JDK 21.
Install Maven.
Create a folder named
ChaosCore.Reproduce the generated file structure inside that folder.
Open the folder in IntelliJ IDEA.
Select File → Open and choose the
ChaosCorefolder.Allow IntelliJ IDEA to import the Maven project.
Open a terminal in the project folder.
Run:
mvn clean package
The compiled plugin will be located at:
target/ChaosCore.jar
Installation
Stop the Paper 1.20.1 server.
Copy
target/ChaosCore.jarinto the server’s:
plugins/
Start the server.
Edit the generated configuration at:
plugins/ChaosCore/config.yml
Apply configuration changes with:
/chaos reload
Testing
Use:
/chaos list
Then start an event:
/chaos start meteor-shower
/chaos start blood-moon
/chaos start thunder-chaos
/chaos start chaos-chest
Stop the active event with:
/chaos stop
Automatic events are enabled by default and will begin according to settings.automatic.interval-seconds in config.yml.
package com.kodari.chaoscore;
import com.kodari.chaoscore.commands.ChaosCommand;
import com.kodari.chaoscore.managers.ConfigManager;
import com.kodari.chaoscore.managers.EventManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class ChaosCore extends JavaPlugin {
private ConfigManager configManager;
private EventManager eventManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.configManager.load();
this.eventManager = new EventManager(this);
ChaosCommand command = new ChaosCommand(this);
if (getCommand("chaos") != null) {
getCommand("chaos").setExecutor(command);
getCommand("chaos").setTabCompleter(command);
}
this.eventManager.startAutomaticScheduler();
getLogger().info("ChaosCore enabled with " + eventManager.getEventIds().size() + " chaos events.");
}
@Override
public void onDisable() {
if (eventManager != null) {
eventManager.shutdown();
}
}
public ConfigManager getConfigManager() {
return configManager;
}
public EventManager getEventManager() {
return eventManager;
}
}