CustomDiscs
CustomDiscs 通过 Simple Voice Chat 为 Minecraft 服务器带来自定义的、具有位置感的音乐唱片。你可以将普通的音乐唱片转换为基于本地 MP3、WAV 或 FLAC 文件的自定义唱片,或者从支持 YouTube 或 SoundCloud 等远程服务中流式传输音轨。
音频从唱片机(jukebox)的位置播放,因此玩家在世界中移动时会自然地听到声音。服务器管理员可以控制播放范围、音量、曲目限制、唱片外观、可视化效果以及远程提供者的行为。开发者可以通过公共 API 和 Bukkit 事件集成播放功能。
特别感谢
CustomDiscs 建立在以下项目的想法和技术之上:
链接
特性
- 支持本地 MP3、WAV 和 FLAC 文件播放
- 支持从 YouTube 和 SoundCloud URL 进行远程播放
- 由 Simple Voice Chat 驱动的位置音频
- 每个唱片机的独立播放半径
- 本地和远程唱片的自定义模型数据
- 可配置的粒子效果和播放全息图
- 可配置的最大文件大小和曲目时长
- 英文和俄文翻译
- 兼容 Folia 的时间调度
- 公共 API、生命周期事件和音频数据包处理器
要求
CustomDiscs 需要以下服务器插件:
玩家还需要安装 Simple Voice Chat 客户端模组才能听到自定义唱片的音频。
安装
- 在服务器上安装 Simple Voice Chat 和 PacketEvents。
- 从 Modrinth 下载 CustomDiscs。
- 将所有三个插件文件放入服务器的
plugins 目录中。
- 启动或重启服务器。
- 查看生成的配置文件
plugins/CustomDiscs/config.yml。
- 在测试唱片之前,确保 Simple Voice Chat 已正确配置并正常工作。
创建唱片
自定义唱片是通过对玩家主手持有的普通 Minecraft 音乐唱片执行操作创建的。包含空格的参数必须用双引号括起来。
来自本地文件
将 MP3、WAV 或 FLAC 文件放置在 plugins/CustomDiscs/musicdata 中,或从直接 HTTP(S) URL 下载:
/cd download "https://example.com/music/track.mp3" track.mp3
手持一张音乐唱片并进行转换:
/cd create local track.mp3 "Track name"
来自远程服务
手持一张音乐唱片并提供支持的 URL:
/cd create remote "https://www.youtube.com/watch?v=..." "Track name"
将生成的唱片插入唱片机以开始位置音频播放。
[!WARNING]
远程服务通常需要进行额外配置才能可靠地播放。YouTube 可能需要 OAuth2、PO token、远程加密服务器或 HTTP(S) 代理。提供者的行为可能会独立于 CustomDiscs 发生变化。请使用辅助账户进行 OAuth2 授权,切勿发布提供者凭据或令牌。
仅流式传输或下载你有权使用的音频。服务器管理员有责任遵守源服务条款和适用的版权法。
命令
完整命令为 /customdiscs;/cd 可作为较短的别名使用。
| Command |
Description |
Permission |
/cd |
CustomDiscs 根命令 |
customdiscs |
/cd help |
显示发送者可用的命令。 |
customdiscs.help |
/cd reload |
重新加载配置文件和语言文件。 |
customdiscs.reload |
/cd download "<direct URL>" <filename> |
将 MP3、WAV 或 FLAC 文件下载到 musicdata。 |
customdiscs.download |
/cd create local <filename> "<disc name>" |
使用本地文件转换手持的音乐唱片。 |
customdiscs.create.local |
/cd create remote "<URL>" "<disc name>" |
使用支持的远程 URL 转换手持的音乐唱片。 |
customdiscs.create.remote |
/cd distance <radius> |
提示玩家选择一台唱片机并为其分配播放半径。 |
customdiscs.distance |
create local、create remote 和 distance 仅限玩家操作。
权限
| 权限 |
默认值 |
描述 |
customdiscs.* |
Operators |
授予所有 CustomDiscs 权限。 |
customdiscs.help |
Everyone |
允许访问命令帮助。 |
customdiscs.reload |
Operators |
允许重载配置和语言文件。 |
customdiscs.download |
Operators |
允许将音频文件下载到服务器。 |
customdiscs.create |
Everyone |
唱片创建的父级权限。 |
customdiscs.create.local |
Everyone |
允许从本地文件创建唱片。 |
customdiscs.create.remote |
Everyone |
允许从远程 URL 创建唱片。 |
customdiscs.create.remote.youtube |
Everyone |
允许从 YouTube URL 创建唱片。 |
customdiscs.create.remote.soundcloud |
Everyone |
允许从 SoundCloud URL 创建唱片。 |
customdiscs.distance |
Everyone |
允许改变唱片机播放半径。 |
配置
插件会创建并维护 plugins/CustomDiscs/config.yml 文件。该文件包含描述每个选项的注释,因此您可以直接进行配置,无需从此 README 复制完整的模板。重要设置包括:
- 语言、更新检查和调试日志;
- 最大下载大小和播放半径;
- 主音量和最大曲目长度;
- 本地、YouTube 和 SoundCloud 唱片的自定义模型数据;
- URL 建议和提供商匹配规则;
- 粒子、全息或组合形式的唱片机可视化效果;
- 全息渲染距离、名称长度、位置模式和偏移量;
- YouTube OAuth2、PO token、远程加密服务器以及 HTTP(S) 代理设置。
编辑配置后请运行 /cd reload。语言文件存储在 plugins/CustomDiscs/language 中,也可以进行自定义修改。
开发者 API
API 工件已从项目的 Maven 仓库发布。如果有更新的 API 版本可用,请替换下面的版本号。
Gradle (Kotlin DSL)
repositories {
maven("https://repo.subkek.space/maven-public/")
}
dependencies {
compileOnly("space.subkek:customdiscs-api:1.0.0-SNAPSHOT")
}
Maven
<repository>
<id>subkek</id>
<url>https://repo.subkek.space/maven-public/</url>
</repository>
<dependency>
<groupId>space.subkek</groupId>
<artifactId>customdiscs-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
在您的 Paper 插件描述符中将 CustomDiscs 和 Simple Voice Chat 声明为服务器依赖项。然后您可以获取已注册的 API 服务:
import space.subkek.customdiscs.api.CustomDiscsAPI;
CustomDiscsAPI api = CustomDiscsAPI.get();
if (api == null)
throw new IllegalStateException("CustomDiscs is not loaded");
boolean customDisc = api.isCustomDisc(itemStack);
api.getLavaPlayerManager().play(jukeboxBlock, audioIdentifier, null);
API 提供了以下功能:
CustomDiscsAPI 用于服务发现、唱片识别和播放管理器访问;
LavaPlayerManager 用于启动、停止和检查位置播放;
- 数据包处理器用于观察或过滤编码后的音频帧;
CustomDiscInsertEvent 和 CustomDiscEjectEvent 用于唱片机交互;
LavaPlayerStartPlayingEvent 和 LavaPlayerStopPlayingEvent 用于播放生命周期钩子。
LavaPlayer 生命周期事件可能在异步线程或区域线程上运行。请在适当的服务端或区域调度器上安排 Bukkit 世界操作。
从源码构建
该项目需要 JDK 21,并包含了 Gradle Wrapper:
./gradlew build
可分发的插件 JAR 文件生成于 build/libs 目录中。
CustomDiscs
CustomDiscs brings custom, positional music discs to Minecraft servers through
Simple Voice Chat. Turn a regular music disc into a custom one backed by
a local MP3, WAV, or FLAC file, or stream a track from a supported remote service such as YouTube or SoundCloud.
Audio is played from the jukebox position, so players hear it naturally as they move through the world. Server owners can
control playback range, volume, track limits, disc appearance, visualizations, and remote provider behavior. Developers can
integrate with playback through the public API and Bukkit events.
Special thanks
CustomDiscs builds on ideas and technology from these projects:
Links
Features
- Local playback from MP3, WAV, and FLAC files
- Remote playback from YouTube and SoundCloud URLs
- Positional audio powered by Simple Voice Chat
- Per-jukebox playback radius
- Custom model data for local and remote discs
- Configurable particles and playback holograms
- Configurable maximum file size and track duration
- English and Russian translations
- Folia-aware scheduling
- Public API, lifecycle events, and audio packet handlers
Requirements
CustomDiscs requires the following server plugins:
Players also need the Simple Voice Chat client mod to hear custom disc audio.
Installation
- Install Simple Voice Chat and PacketEvents on the server.
- Download CustomDiscs from Modrinth.
- Place all three plugin files in the server's
plugins directory.
- Start or restart the server.
- Review the generated configuration in
plugins/CustomDiscs/config.yml.
- Make sure Simple Voice Chat is configured and working before testing a disc.
Creating a disc
Custom discs are created from an ordinary Minecraft music disc held in the player's main hand. Arguments containing spaces
must be enclosed in double quotes.
From a local file
Place an MP3, WAV, or FLAC file in plugins/CustomDiscs/musicdata, or download one from a direct HTTP(S) URL:
/cd download "https://example.com/music/track.mp3" track.mp3
Hold a music disc and convert it:
/cd create local track.mp3 "Track name"
From a remote service
Hold a music disc and provide a supported URL:
/cd create remote "https://www.youtube.com/watch?v=..." "Track name"
Insert the resulting disc into a jukebox to start positional playback.
[!WARNING]
Remote services commonly require additional configuration before playback will work reliably. YouTube may require OAuth2,
a PO token, a remote cipher server, or an HTTP(S) proxy. Provider behavior can change independently of CustomDiscs. Use a
secondary account for OAuth2 authorization and never publish provider credentials or tokens.
Only stream or download audio that you are authorized to use. Server owners are responsible for complying with the terms of
the source service and applicable copyright law.
Commands
The full command is /customdiscs; /cd is available as a shorter alias.
| Command |
Description |
Permission |
/cd |
Root CustomdDiscs command |
customdiscs |
/cd help |
Shows the commands available to the sender. |
customdiscs.help |
/cd reload |
Reloads configuration and language files. |
customdiscs.reload |
/cd download "<direct URL>" <filename> |
Downloads an MP3, WAV, or FLAC file into musicdata. |
customdiscs.download |
/cd create local <filename> "<disc name>" |
Converts the held music disc using a local file. |
customdiscs.create.local |
/cd create remote "<URL>" "<disc name>" |
Converts the held music disc using a supported remote URL. |
customdiscs.create.remote |
/cd distance <radius> |
Prompts the player to select a jukebox and assigns its playback radius. |
customdiscs.distance |
create local, create remote, and distance are player-only operations.
Permissions
| Permission |
Default |
Description |
customdiscs.* |
Operators |
Grants every CustomDiscs permission. |
customdiscs.help |
Everyone |
Allows access to command help. |
customdiscs.reload |
Operators |
Allows configuration and language reloads. |
customdiscs.download |
Operators |
Allows downloading audio files to the server. |
customdiscs.create |
Everyone |
Parent permission for disc creation. |
customdiscs.create.local |
Everyone |
Allows creating discs from local files. |
customdiscs.create.remote |
Everyone |
Allows creating discs from remote URLs. |
customdiscs.create.remote.youtube |
Everyone |
Allows creating discs from YouTube URLs. |
customdiscs.create.remote.soundcloud |
Everyone |
Allows creating discs from SoundCloud URLs. |
customdiscs.distance |
Everyone |
Allows changing a jukebox's playback radius. |
Configuration
The plugin creates and maintains plugins/CustomDiscs/config.yml. The file includes comments describing each option, so it
can be configured directly without copying a complete template from this README. Important settings include:
- language, update checks, and debug logging;
- maximum download size and playback radius;
- master volume and maximum track length;
- custom model data for local, YouTube, and SoundCloud discs;
- URL suggestions and provider matching rules;
- particle, hologram, or combined jukebox visualizations;
- hologram render distance, name length, position mode, and offsets;
- YouTube OAuth2, PO token, remote cipher server, and HTTP(S) proxy settings.
Run /cd reload after editing the configuration. Language files are stored in plugins/CustomDiscs/language and can also be
customized.
Developer API
The API artifact is published from the project's Maven repository. Replace the version below if a newer API release is
available.
Gradle (Kotlin DSL)
repositories {
maven("https://repo.subkek.space/maven-public/")
}
dependencies {
compileOnly("space.subkek:customdiscs-api:1.0.0-SNAPSHOT")
}
Maven
<repository>
<id>subkek</id>
<url>https://repo.subkek.space/maven-public/</url>
</repository>
<dependency>
<groupId>space.subkek</groupId>
<artifactId>customdiscs-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Declare CustomDiscs and Simple Voice Chat as server dependencies in your Paper plugin descriptor. You can then obtain the
registered API service:
import space.subkek.customdiscs.api.CustomDiscsAPI;
CustomDiscsAPI api = CustomDiscsAPI.get();
if (api ==null)
throw new IllegalStateException("CustomDiscs is not loaded");
boolean customDisc = api.isCustomDisc(itemStack);
api.getLavaPlayerManager().play(jukeboxBlock, audioIdentifier, null);
The API exposes:
CustomDiscsAPI for service discovery, disc identification, and playback manager access;
LavaPlayerManager for starting, stopping, and inspecting positional playback;
- packet handlers for observing or filtering encoded audio frames;
CustomDiscInsertEvent and CustomDiscEjectEvent for jukebox interaction;
LavaPlayerStartPlayingEvent and LavaPlayerStopPlayingEvent for playback lifecycle hooks.
The LavaPlayer lifecycle events may run asynchronously or on a region thread. Schedule Bukkit world operations on the
appropriate server or region scheduler.
Building from source
The project requires JDK 21 and includes the Gradle Wrapper:
./gradlew build
The distributable plugin JAR is produced in build/libs.
评论 0
登录后参与评分
还没有评论,来抢沙发吧