A Spigot plugin which adds a Minstrel trait to Citizens NPCs
Go to file
2022-11-26 15:15:08 +01:00
src/main Removes the KnarLib.setPlugin call 2022-11-07 22:21:13 +01:00
.gitignore Initial commit 2022-10-30 04:33:51 +01:00
Jenkinsfile Improves Jenkinsfile 2022-11-26 15:15:08 +01:00
pom.xml Adds Jenkinsfile and distribution management 2022-11-26 04:14:38 +01:00
README.MD Fixes some minor issues 2022-11-14 02:49:48 +01:00

Minstrel

This plugin aims to add a Minstrel trait to Citizens NPCs which is able to play a set of songs from a custom resource pack. While there are plugins which use workarounds, this plugin aims to make the best npc-based "music box" add-on one can create within the Spigot API. While kind of hard to set up, this allows using any music, without compromise. Note: To make music hear-able only within the area of an NPC, you must make sure the track is Mono (1 channel). If you use a Stereo (2 channels) soundtrack, you'll hear the music everywhere, which is cool if you want to stream music globally.

Dependencies

  • Citizens

Important to note

There are limitations connected to directly playing media using playSound:

  • There is no way to really know what is playing for a player. The best one can do is track any time a song is played outside the global cycle.
  • When a new player joins there are only two ways to make the music play for the player: Either play immediately, and cut the song short once the playlist switches songs, or play nothing until the playlist switches songs. None of these are ideal.
  • Songs are really only identified by the category and the song id. Stopping the song for one minstrel will also stop the song if played by any other minstrels at the same time. As songs are only stopped if a song has been played for a player outside the global cycle, or if volume/pitch is changed and force update is set to true, it shouldn't be too much of a problem, but if several minstrels play the same song, there may be silent minstrels until the next song plays.

Commands

Command Arguments Description
/minstrel addsong <sound category> <sound identifier> <duration> Adds the specified song to the selected minstrel's playlist
/minstrel removesong <index (0-10000)> Removes the song at the given index from the selected minstrel's playlist
/minstrel listsongs none Lists all songs in the selected NPC's playlist in the format CATEGORY:identifier:duration
/minstrel volume <new volume (0.01 to 10000)> [force update (true/false)] Displays or sets the volume of the selected minstrel
/minstrel pitch <new pitch (0.01 to 10000)> [force update (true/false)] Displays or sets the pitch of the selected minstrel

/minstrel addsong

  • sound category - The category to use when playing the song. This is used when playing the sound to decide which volume slider can be used to alter the volume. RECORDS is recommended for minstrels. You may also specify "null" as the sound category. It will then be played without a specific category being specified.
  • sound identifier - The string used to identify the sound to play. Example: "minecraft:music_disc.cat" identifies the cat music disc. You can also specify music in a resource pack, though nothing can be heard for players without the resource pack.
  • duration - The duration of the track, in seconds. It's important that this is exact, and not too short, as it's used to decide when to start playing the next track in the playlist. If it's too short, several songs will end up playing at once! Setting it higher than the actual duration can be used to add a pause before the next song is played.

Example: /minstrel addsong RECORDS minecraft:music_disc.cat 185 would be used to add the CAT music disc to a playlist.

/minstrel removesong

  • index - The 0-based index of the song's position in the playlist. Use /minstrel listsongs to see the current playlist.

Example: /minstrel removesong 0 removes the first song in the playlist.

/minstrel volume

  • new volume - The new volume of the minstrel. Volume between 0 and 1 (0.1 = 10%) decides how loud the volume is. If volume is set above 1, it will still only play at full volume (100%), but can be heard further away.
  • force update - Whether to forcefully stop and start the minstrel's playlist to make the change happen instantly.

/minstrel pitch

  • new pitch - The new pitch used by the minstrel. Set to 1 for normal.
  • force update - Whether to forcefully stop and start the minstrel's playlist to make the change happen instantly.