Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 17 additions & 49 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,27 @@
name: Build and Release
name: Build
on:
pull_request:
push:
tags: [ '*' ] # Запуск при создании тега

branches: [master]
tags: ['*']
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: build
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
java-version: '25'
distribution: temurin
- uses: gradle/actions/setup-gradle@v4
- name: Test and build
run: bash ./gradlew --no-daemon clean :plugin:test build
- uses: actions/upload-artifact@v4
with:
name: musicbox
path: |
build/libs/MusicBox*-all.jar

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: musicbox
path: build/libs/
- name: Get Artifact Filename
id: get_filename
run: echo "FILENAME=$(basename build/libs/MusicBox*-all.jar)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/${{ env.FILENAME }}
asset_name: ${{ env.FILENAME }}
asset_content_type: application/java-archive
build/libs/MusicBox-*.jar
!build/libs/*-thin.jar
if-no-files-found: error
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# MusicBox for Paper

MCCitiesNetwork's modernization of [MusicBox by Spliterash](https://github.com/Spliterash/MusicBox).
MusicBox plays NoteBlockAPI songs through discs, jukeboxes, signs, player
playlists, and its music GUI.

Requires **Java 25**, **Paper 26.3+**, and **NoteBlockAPI 1.6.3**. Commands use
Cloud's native Paper integration. Older Minecraft versions are no longer
supported. Vault is optional for configured economy features.

Build and run the regression suite:

```sh
./gradlew clean :plugin:test build
```

To verify Cloud's native bootstrap against an unpacked Paper 26.3 runtime,
create a text file containing one absolute runtime/library JAR path per line,
then run:

```sh
./gradlew :plugin:paperRuntimeTest -PpaperRuntimeClasspathFile=/path/to/runtime-classpath.txt
```

This optional check initializes the real Minecraft registries and Cloud mappings
without starting a server. Runtime JARs are supplied locally and are not bundled
in the plugin or test fixtures.

Install the shaded JAR from `build/libs` with NoteBlockAPI. The
[data compatibility reference](docs/data-compatibility.md) describes retained
identifiers, metadata, and storage formats.
New installations add their own `.nbs` files under `plugins/MusicBox/songs`.

## Attribution and licensing

This fork retains upstream history and attribution to Spliterash. Upstream does
not currently declare a repository-wide license; this fork does not assign a
new license to upstream code. File-specific copyright and license notices are
retained, including sk89q's notice in `SourcedBlockRedstoneEvent.java`.
The upstream example music is excluded from the built plugin.

## Original upstream README

# MusicBox
Этот плагин добавляет на сервер новые пластинки, таблички, и много чего другого. Полное описание можно посмотреть на spigot

Expand Down
72 changes: 12 additions & 60 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,72 +1,24 @@
plugins {
`java-library`
id("io.github.goooler.shadow") version "8.1.7"
id("io.freefair.lombok") version "8.6"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("io.papermc.paperweight.userdev") version "1.7.1" apply false
id("com.gradleup.shadow") version "9.4.0"
}

bukkit {
name = "MusicBox"
main = "ru.spliterash.musicbox.MusicBox"
apiVersion = "1.13"
authors = listOf("Spliterash")
depend = listOf("NoteBlockAPI")
softDepend = listOf("Vault")
commands {
register("musicbox")
}
}

group = "ru.spliterash"

group = "com.minecraftcitiesnetwork"
version = "3.0.0-SNAPSHOT"
allprojects {
apply(plugin = "java-library");
apply(plugin = "io.freefair.lombok")

version = "2.1.4"

group = "com.minecraftcitiesnetwork"
version = rootProject.version
repositories {
mavenCentral()
mavenLocal()

maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
maven("https://repo.codemc.org/repository/maven-public")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://repo.clojars.org/")
}

dependencies {
compileOnly("org.jetbrains:annotations:24.0.1")
}
}


val startPath = "ru.spliterash.musicbox.shadow."
dependencies { implementation(project(":plugin")) }
tasks.shadowJar {
relocate("com.cryptomorin.xseries", startPath + "xseries")
relocate("org.bstats", startPath + "bstats")
relocate("io.github.bananapuncher714.nbteditor", startPath + "nbteditor")
archiveClassifier.set("")
relocate("org.incendo", "com.minecraftcitiesnetwork.musicbox.internal.cloud")
relocate("org.bstats", "com.minecraftcitiesnetwork.musicbox.internal.bstats")
mergeServiceFiles()
}

tasks.jar { archiveClassifier.set("thin") }
tasks.assemble { dependsOn(tasks.shadowJar) }

dependencies {
api(project(":plugin"))
api(project(":nms"))
api(project(":nms:shared"))
api(project(":nms:versions:12"))
api(project(":nms:versions:13-16"))
api(project(":nms:versions:17"))
api(project(":nms:versions:18"))
api(project(":nms:versions:19_2", "reobf"))
api(project(":nms:versions:19_3", "reobf"))
api(project(":nms:versions:19_4", "reobf"))
api(project(":nms:versions:20_1", "reobf"))
api(project(":nms:versions:20_2", "reobf"))
api(project(":nms:versions:20_3", "reobf"))
api(project(":nms:versions:20_5", "reobf"))
api(project(":nms:versions:21", "reobf"))
api(project(":nms:versions:21_2", "reobf"))
}
36 changes: 36 additions & 0 deletions docs/data-compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Data compatibility

MusicBox retains its plugin name and `plugins/MusicBox` data directory. Moving
Java packages to `com.minecraftcitiesnetwork.musicbox` does not change the item
namespace `musicbox:song_hash`.

## Songs and identifiers

Song and folder IDs remain the signed Java `String.hashCode()` of
`File.getPath()`. Working-directory, plugins-directory argument, filename, and
folder changes can therefore invalidate existing references even when they
point to equivalent filesystem locations. Native Paper and Bukkit plugin loaders
construct the MusicBox data-folder path in the same way.

New installations supply their own `.nbs` files under `plugins/MusicBox/songs`.
The built plugin does not contain the upstream example music.

## Player playlists and signs

SQLite tables remain `playlists`, `playlist_song`, and `signs`. Numeric IDs,
ownership, signed song hashes, and ordering retain their existing representation.
Unavailable song references survive reads and saves. Saved sign locations remain
stored until restoration succeeds, including when the referenced world is absent.
Existing config keys and language files remain supported.

Music signs retain `MASTER`, `ID:<song-hash>`, `CHEST:<folder-hash>`, and
`LIST:<playlist-id>` references, flags `R`, `E`, `P`, and `I`, and saved locations
in `worldName|x|y|z` format.

## Disc metadata

New discs use the integer `musicbox:song_hash` persistent-data key, matching
existing MusicBox discs. Historical raw `song_hash` tags are also read without
rewriting the item, including tags migrated by Minecraft into
`minecraft:custom_data`. These formats remain readable by the corresponding
older MusicBox implementation; plugin and world state must remain consistent.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.jvmargs=-Dfile.encoding=UTF-8
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 0 additions & 10 deletions nms/build.gradle.kts

This file was deleted.

8 changes: 0 additions & 8 deletions nms/shared/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading