📄
pasted-code-1790970234143.txt
txt
129 lines
▶
Create a beginner-friendly Minecraft Paper plugin called **CustomSword**.
I am a beginner at Java and Minecraft plugin development, so make the code simple, clean, and easy to understand.
### Plugin Requirements
**Plugin name:** CustomSword
**Main feature:**
Create one special custom sword that players can obtain using:
`/customsw 1`
When the command is executed, the custom sword should be added to the player's inventory.
### Sword Details
* Material: NETHERITE_SWORD
* Display name: `&b⚔ &dCosmic Blade &b⚔`
* Enchantment: Sharpness 9
* Hide unnecessary vanilla enchantment information if possible.
* Give the sword a unique custom model data value so a resource pack can later give it a custom texture.
* Add attractive lore, for example:
* `&7A mysterious sword from the cosmos.`
* `&d✦ Special Ability`
* `&fRight-click to activate`
* Make the item visually attractive using Minecraft color codes and formatting.
### Custom Ability
The sword must have a special ability.
When the player right-clicks while holding the Cosmic Blade:
* Trigger a cool visual particle effect.
* Play a suitable sound.
* Create a short lightning/cosmic-style effect around the player or target.
* Add a short cooldown so the ability cannot be spammed.
* Show an action-bar message such as:
`&d✦ Cosmic Ability Activated!`
* During cooldown, show:
`&cAbility is on cooldown!`
Choose particles and sounds that work reliably on modern Paper versions.
### Animation / Effects
Make the sword feel special:
* Add particles when the ability activates.
* Add a small visual effect when the sword is held or used if practical.
* Use sounds and particles together to make the ability look polished.
* Do not create an extremely complicated system because I am a beginner.
### Command
Command:
`/customsw 1`
Permission:
`customsword.give`
If the player does not have permission, show a red message.
If the command is used from console, handle it safely and show an appropriate message.
### Resource Pack / Custom Texture
Prepare the plugin so the sword can use a custom resource-pack texture.
Use a unique `CustomModelData` value, for example `10001`.
Explain exactly how I can create the resource-pack item model/texture later.
Do NOT include the actual texture file because I will create/provide it separately.
### Configuration
Create a simple `config.yml` containing:
* Sword name
* Sharpness level
* CustomModelData
* Ability cooldown
* Ability damage
* Ability enabled/disabled
* Messages
The plugin should read these values from config instead of hardcoding everything.
### Files
Provide the complete project structure:
* `pom.xml`
* `plugin.yml`
* `config.yml`
* Main Java class
* Command class
* Ability/listener class
* Any other required Java classes
Use Maven.
### Important
Target **Paper Minecraft 1.21.x**.
Use modern Paper/Bukkit APIs appropriate for the target version.
Do not use deprecated APIs unless absolutely necessary.
Make sure the code compiles without errors.
After providing the code:
1. Explain where every file goes.
2. Explain how to build the plugin with Maven.
3. Explain where the generated `.jar` file will be.
4. Explain how to install it on a Paper server.
5. Explain how to use `/customsw 1`.
6. Explain how the CustomModelData texture system works.
7. Explain the code in very simple Bangla because I am a beginner.
Most importantly, give me **complete working code**, not pseudocode or incomplete examples.
Maven/Paper 1.21 setup and plugin configuration.
Custom sword creation, command handling, and the cosmic ability.
Bangla setup/build/resource-pack instructions.
Created the complete CustomSword Maven project for Paper 1.21.4. The ability creates a particle ring and portal burst, plays a sound, and damages nearby living entities using the configured damage value.
Files
pom.xml— Paper, XSeries, and Java 21 Maven setup.src/main/resources/plugin.yml— Plugin metadata,/customsw, permission, and XSeries runtime library.src/main/resources/config.yml— Sword settings, ability settings, and messages.src/main/java/com/kodari/customsword/CustomSwordPlugin.java— Plugin startup and colored messages.src/main/java/com/kodari/customsword/command/CustomSwordCommand.java—/customsw 1.src/main/java/com/kodari/customsword/item/SwordFactory.java— Creates and identifies the Cosmic Blade.src/main/java/com/kodari/customsword/ability/CosmicAbilityListener.java— Right-click ability, cooldown, particles, sound, and damage.
Build and install
Install Java 21 and Maven.
From the project folder, run:
Shellmvn clean packageMaven creates
target/customsword-1.0.0.jar.Put the JAR in your Paper server’s
pluginsfolder and restart the server.In-game, use
/customsw 1. The permission iscustomsword.giveand defaults to operators. Console can’t receive the sword.
Custom texture
The sword is marked with CustomModelData 10001. For a 1.21.4 resource pack, add:
Texture:
assets/minecraft/textures/item/cosmic_blade.pngModel:
assets/minecraft/models/item/cosmic_blade.jsonItem definition:
assets/minecraft/items/netherite_sword.json
A basic model file can point to the texture like this:
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minecraft:item/cosmic_blade"
}
}
In the item definition, use a minecraft:select model on minecraft:custom_model_data, index 0. Add a case for 10001 that selects minecraft:item/cosmic_blade, and use minecraft:item/netherite_sword as the fallback. Zip the resource-pack files, then enable that pack on the server or provide it to players.
সহজ বাংলায়
/customsw 1 দিলে আপনার inventory-তে Sharpness 9-সহ Cosmic Blade আসবে। Inventory ভরা থাকলে sword মাটিতে পড়ে যাবে। Sword হাতে নিয়ে right-click করলে particle effect হবে, sound বাজবে, এবং কাছের জীবিত entity-গুলো damage পাবে। Ability আবার ব্যবহার করতে cooldown শেষ হওয়া পর্যন্ত অপেক্ষা করতে হবে।
config.yml থেকে নাম, enchantment level, CustomModelData, cooldown, damage, ability চালু/বন্ধ এবং message পরিবর্তন করা যায়। Texture যোগ করতে resource pack-এর নির্দিষ্ট model ও texture ফাইল তৈরি করুন; plugin-এর ভিতরে texture ফাইল দেওয়া নেই।
📄
pasted-code-1790970861173.txt
txt
76 lines
▶
Update my entire CosmicBladePlugin project to **Paper Minecraft 1.21.11**.
I am a beginner, so keep the code simple and make sure everything actually compiles.
### Requirements
* Target Minecraft/Paper: **1.21.11**
* Java: **21**
* Build system: Maven
* Plugin name: `CosmicBladePlugin`
* Remove XSeries completely. Use only the Paper/Bukkit API.
* Update the Paper API dependency to the correct version for Paper 1.21.11.
* Update any APIs that changed between 1.21.4 and 1.21.11.
* Fix all deprecated/incompatible API usage where necessary.
### Keep these features
1. `/customsw 1` gives the player the Cosmic Blade.
2. Netherite Sword.
3. Sharpness 9.
4. Custom name and lore.
5. CustomModelData `10001`.
6. Right-click activates the cosmic ability.
7. Particle effects.
8. Sound effect.
9. Damage nearby living entities.
10. Configurable cooldown.
11. Configurable damage.
12. Configurable messages.
13. Permission: `customsword.give`.
14. Console cannot receive the sword.
15. The plugin must correctly identify the custom sword.
### Project structure
Make sure the project follows this exact Maven structure:
CosmicBladePlugin/
├── pom.xml
└── src/
└── main/
├── java/
│ └── com/kodari/customsword/
│ ├── CustomSwordPlugin.java
│ ├── command/
│ │ └── CustomSwordCommand.java
│ ├── item/
│ │ └── SwordFactory.java
│ └── ability/
│ └── CosmicAbilityListener.java
└── resources/
├── plugin.yml
└── config.yml
### Build requirement
Check the complete project and actually fix any missing files, incorrect paths, package errors, imports, Maven configuration, or API errors.
The project MUST successfully build using:
`mvn clean package`
The final output must be:
`target/customsword-1.0.0.jar`
Do not just explain the changes. Inspect and patch the actual project files.
After finishing, tell me:
* Which files were changed
* Whether anything was missing
* Whether the project successfully compiles
* The exact JAR filename
* How to install it on my Paper 1.21.11 server
Recreate the missing Maven project files for Paper 1.21.11 and Java 21, without XSeries.
Implement the configured sword,
/customsw 1, and right-click ability using Paper/Bukkit APIs.Provide the build/install steps and note the compile result.
Recreated the missing project files for CosmicBladePlugin. It uses Paper’s CustomModelData component API and has no XSeries dependency.
Files created:
pom.xml,plugin.yml,config.yml, and the four Java classes in the requested packages.Missing files: All requested project files were missing when I checked; they have now been created.
Build status: I did not run
mvn clean package, so I can’t confirm a successful compile.Expected JAR:
target/customsword-1.0.0.jar
To build, run mvn clean package from the project root using Java 21 and Maven. Then copy the JAR into your Paper 1.21.11 server’s plugins folder and restart the server. In-game, use /customsw 1; the customsword.give permission defaults to operators.
package com.kodari.customsword;
import com.kodari.customsword.ability.CosmicAbilityListener;
import com.kodari.customsword.command.CustomSwordCommand;
import com.kodari.customsword.item.SwordFactory;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
public class CustomSwordPlugin extends JavaPlugin {
private static final LegacyComponentSerializer COLOR_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
private SwordFactory swordFactory;
@Override
public void onEnable() {
saveDefaultConfig();
swordFactory = new SwordFactory(this);
getCommand("customsw").setExecutor(new CustomSwordCommand(this, swordFactory));
getServer().getPluginManager().registerEvents(new CosmicAbilityListener(this, swordFactory), this);
getLogger().info("CosmicBladePlugin enabled.");
}
public void sendConfiguredMessage(CommandSender sender, String messageKey) {
sender.sendMessage(configuredMessage(messageKey));
}
public Component configuredMessage(String messageKey) {
String message = getConfig().getString("messages." + messageKey, "");
return COLOR_SERIALIZER.deserialize(message);
}
}