Rimon Sk
๐Ÿ“Ž 1 file 4,204 chars
๐Ÿ“„
pasted-code-1794249350389.txt
txt 117 lines
โ–ถ
# Create a Minecraft Custom Music Plugin (1.21+)

I want to develop a fully working Minecraft Java plugin that allows players to play custom songs using Jukeboxes and custom music discs.

**Plugin Name:** CustomMusic  
**Minecraft Version:** 1.21+ (support latest 1.21.x versions)  
**Server Software:** Paper / Purpur  
**Language:** Java  
**Build System:** Maven  
**API:** Paper API

## 1. Main Features

### Custom Music GUI
- Create a GUI menu using `/music`.
- GUI should have a modern inventory design.
- Add a button called "Add YouTube Song".
- Players can submit a YouTube video URL.
- Validate the URL before processing.
- Display song title, duration, and thumbnail if possible.
- Allow players to preview and confirm the song.

### Custom Music Disc System
- After submitting a valid song, generate a custom music disc.
- Each disc should have:
  - Custom display name.
  - Custom lore.
  - Unique song ID.
  - Custom model data or item model.
  - Custom texture support.
- Disc must be usable in Minecraft Jukeboxes.
- Store song information permanently.
- Players can collect, trade, and use custom discs.

### Jukebox Integration
- When a player inserts a custom disc into a jukebox, play the corresponding song.
- Stop the song when the disc is removed.
- Stop playback when the jukebox is broken.
- Support multiple jukeboxes playing different songs simultaneously.
- Handle player movement and playback distance.
- Support normal Minecraft music discs without breaking their functionality.

### YouTube Integration
- Accept YouTube video URLs.
- Extract video information using a suitable backend/library.
- Convert or stream audio through a supported audio playback system.
- Never download copyrighted music without proper authorization.
- Handle unavailable, private, age-restricted and invalid videos.
- Do not block the main server thread during processing.

### Admin Commands
- `/music` - Open music GUI.
- `/music add ` - Add a song.
- `/music remove ` - Remove a song.
- `/music list` - Show all registered songs.
- `/music give  ` - Give a custom disc.
- `/music reload` - Reload configuration.
- `/music stop` - Stop custom music.

### Permissions
- `custommusic.use`
- `custommusic.add`
- `custommusic.admin`
- `custommusic.give`

### Storage
- SQLite database.
- Save song IDs, titles, URLs, owners and metadata.
- Data must persist after server restart.

### Configuration
Create a configurable config.yml with:
- GUI title and layout.
- Maximum song duration.
- Maximum number of songs per player.
- Playback distance.
- Permission settings.
- Database settings.
- Audio backend settings.

## 2. Technical Requirements

- Use Java 21 or the minimum Java version required by the targeted Paper release.
- Use modern Paper API for 1.21+.
- Use clean object-oriented architecture.
- Avoid deprecated APIs.
- Use asynchronous tasks for external requests.
- Include proper error handling.
- Prevent duplicate song registrations.
- Ensure jukebox playback is synchronized.
- Make the plugin compatible with other common SMP plugins.

## 3. Audio Playback

IMPORTANT: Minecraft's normal Bukkit/Paper API does not directly support playing arbitrary YouTube audio as a custom jukebox disc.

Design a reliable audio playback system using a compatible client-side resource pack or another supported audio delivery method.

If external audio streaming requires a companion client mod, clearly explain and implement that architecture rather than pretending vanilla clients can play arbitrary audio directly.

## 4. Deliverables

Generate:
1. Complete Maven project.
2. Full Java source code.
3. plugin.yml.
4. config.yml.
5. Database implementation.
6. GUI implementation.
7. Custom disc implementation.
8. Jukebox event handling.
9. Audio playback backend.
10. Installation guide.
11. Resource pack generation guide.
12. Complete commands and permissions.

Do not provide incomplete pseudocode. Generate all required files with working implementations, explain how to compile the plugin into a JAR, and test it on Paper 1.21+.
Kodari AI
KodariNov 9 at 6:36 pm 1
CustomMusic
A Minecraft Paper plugin enabling players to add YouTube songs via GUI, generating custom music discs with unique IDs, custom model data, and textures. Integrates with jukeboxes for synchronized playback, supports multiple simultaneous songs, and handles disc removal/block breaking. Includes SQLite storage, admin commands, permissions, configurable settings, and async YouTube processing with validation. Features a modern inventory GUI with song preview and confirmation, plus a client-side resource pack system for audio delivery.

The plugin can use a resource pack to play authorized audio, but it cannot play arbitrary YouTube audio directly to vanilla clients. Would you like the plugin to use manually prepared, authorized audio in a resource pack, or do you want a companion client mod for streaming instead?

Kodari can build the plugin, but it cannot generate the resource pack itself.

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code