Filled SoundRegion

Discussion in 'Plugin Requests' started by Xp10d3, Jul 15, 2020.

  1. Offline

    Xp10d3

    Plugin category: Misc
    Version: 1.8.8
    Name: SoundRegion
    What I want:
    This is either super, SUPER simple or extremely difficult. Basically, I need a biome playlist. Now, this sounds weird, but it'll make sense. So in Wynncraft the resource pack makes sounds. You here a different song in each region. I need something like that except a bit more complex and plugin related. So, I need the plugin to play a certain type of sound **that is put into a folder**. So the pseudo code would look like this:
    Code:
    String sound = this.getConfig().getString("sound.some_sound_here");
    Sound.playSound("\music\" + sound);
    
    Obviously not that simple, but that's basically it. HOWEVER I need the sound to play in a specific area. There are different ways to accomplish this. An easier way is to hook into WorldEdit (which I have no idea is easy or not) or hook into WorldGuard (probably easier) and then use the command ~/soundset <world_guard_region> <music_file>~. How this works is that if a WorldGuard region is already created (keep in mind I'll be using the 1.8 -> 1.12 version of WorldGuard), the plugin should access whatever region there is and then play the sound file specified ON LOOP whenever a player is in that area. So for example, if I did ~/soundset test sad_lofi.mp3~, whenever a player is in the region test, it'll play the sound sad_lofi.mp3 ONLY to whichever players are in that region. Of course, if the region test or the music file sad_lofi.mp3 doesn't exist, a message will be sent to the player notifying them. I would honestly prefer this method, but if it's too complex, you can use something similar to WorldEdit. In one corner, the player can type ~/sregionset pos1~, and in another area ~/sregionset pos2~. Then to confirm the area, type ~/sregionset <name/id>~. That'll create a sound region. Then you can type ~/soundset <name/id> <music_file>~. It'll do the exact same thing as I specified with WorldGuard except it's hardcoded. Feel free to use either way or even both.
    Commands:
    ~Without WorldGuard~
    /sregionset pos1: Set's position one of a sound region.
    /sregionset pos2: Set's position two of a sound region.
    /sregionset <name/id>: Confirms area and creates a sound region based on the name.
    /sregions: Shows a list of all regions with their name, which sound is set for that region, and whether it's working (ex. if a music file is deleted, an error will be thrown and shown in the list).
    /sregion <name/id> delete: Deletes a sound region.
    /sregion <name/id> soundset <music_file>: If a sound region has a music file assigned, you can use this command to change it. Ex. if sound region test has sad_lofi.mp3 assigned to it, you can type ~/sregion test soundset unbalanced.mp3~ to assign unbalanced.mp3 to it.
    [OPTIONAL] /sregion <name/id> import <mysql/yml>: This is optional, but if you are feeling ambitious, go ahead and use this. If you don't want to do MySQL, feel free to just do YML and vice versa.
    ~Using MySQL:~
    Doing ~/sregion test import mysql~ will then import all data (data including sound region names, what sounds are imported, which worlds they are allowed in, and what pos1 + pos2 the sound region maps) into a MySQL database. Basically, the plugin will ask what host the database is in, the username of it, the password, and finally the database. It'll hook into it after typing the information in-game and then create a table called "SoundRegion" and import all the data.
    ~Using YML:~
    Doing ~/sregion test import yml~ will then import all data (everything that is used for MySQL) into a YML file, except instead of asking for the host, username, pass, etc. the plugin will ask what YML file NAME should be created. All data will then get imported into a YML file (after creating one of course) and then show a success message after.
    ~With WorldGuard~
    /soundset <world_guard_region> <music_file>: Set's a sound region for a WorldGuard region.
    /sregions: Shows a list of all regions with their name, which sound is set for that region, and whether it's working (ex. if a music file is deleted, an error will be thrown and shown in the list).
    /sregion <name/id> delete: Deletes a sound region.
    /sregion <name/id> soundset <music_file>: If a sound region has a music file assigned, you can use this command to change it. Ex. if sound region test has sad_lofi.mp3 assigned to it, you can type ~/sregion test soundset unbalanced.mp3~ to assign unbalanced.mp3 to it.
    [OPTIONAL] /sregion <name/id> import <mysql/yml>: This is optional, but if you are feeling ambitious, go ahead and use this. If you don't want to do MySQL, feel free to just do YML and vice versa.
    ~Using MySQL:~
    Doing ~/sregion test import mysql~ will then import all data (data including sound region names, what sounds are imported, which worlds they are allowed in, and what pos1 + pos2 the sound region maps) into a MySQL database. Basically, the plugin will ask what host the database is in, the username of it, the password, and finally the database. It'll hook into it after typing the information in-game and then create a table called "SoundRegion" and import all the data.
    ~Using YML:~
    Doing ~/sregion test import yml~ will then import all data (everything that is used for MySQL) into a YML file, except instead of asking for the host, username, pass, etc. the plugin will ask what YML file NAME should be created. All data will then get imported into a YML file (after creating one of course) and then show a success message after.

    Permissions:

    ALL DEFAULT TO OP
    ~Without WorldGuard~
    soundregion.pos: Allows use of ~/sregionset pos1~ and ~/sregionset pos2~.
    soundregion.confirm: Allows use of ~/sregionset <name/id>~.
    soundregion.regions: Allows use of ~/sregions~.
    soundregion.configure: Allows use of ~/sregion~ and all configurations (~/sregion <name/id> delete~, ~/sregion <name/id> soundset <music_file>~, etc.)
    soundregion.import: Allows use of ~/sregion <name/id> import <mysql/yml>~.
    ~With WorldGuard~
    soundregion.set: Allows use of ~/soundset~.
    soundregion.regions: Allows use of ~/sregions~.
    soundregion.configure: Allows use of ~/sregion~ and all configurations (~/sregion <name/id> delete~, ~/sregion <name/id> soundset <music_file>~, etc.)
    soundregion.import: Allows use of ~/sregion <name/id> import <mysql/yml>~.

    When I want this:
    A.S.A.P. of course.
    If you have any questions, feel free to reply to this thread. Also please let me know if this is possible 0-0

    EDIT: Feel free to use whatever API is needed. You may even use NoteBlockAPI if need be.
     
    Last edited: Sep 20, 2020
  2. Offline

    Xp10d3

  3. Offline

    rafoudiablol

    I could try to do this. What is exactly the version of your server, is it 1.8.8 or 1.8.9 ?
    And do you use Spigot ?

    w8 it already exists, https://www.spigotmc.org/resources/audioconnect.40339/ may be what you want

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 17, 2020
  4. Offline

    Xp10d3

    Hello! Yes, that's pretty similar to what I want however it requires a website to connect to my server IP, which I don't necessarily want. For testing purposes, I use a localhost server and thus can't use the plugin. I appreciate you sending me that link, however. :) I'd rather be able to import the audio via SFTP or in File Explorer. In the future, I might use AudioConnect, but I'd much rather use a custom plugin. Another useful feature that could be added is the ability to import all data from this plugin's YML file (like what regions have been created, what songs are played there, etc.) into a database. I'm currently coding a plugin that does just that for another plugin (all hardcoded of course). This will give me the ability to check whether a player is in that region based on this plugin's YML and then give them effects, change certain properties, etc. AudioConnect uses the website's database which I don't find ideal. So if it's alright, could you make this? Thanks :)
     
  5. Offline

    Xp10d3

    Bump
    EDIT 7/24/2020: Someone is doing this plugin. However if anyone wants to do a second take on this feel free to. Just let me know if you are :) Thanks.
     
    Last edited: Jul 24, 2020
  6. Offline

    Xp10d3

    Okay... doesn't seem like that's the case.
    Bump
     
  7. Offline

    Xp10d3

    Bamp
     
  8. Offline

    Xp10d3

    Bump
     
  9. Offline

    Xp10d3

  10. Offline

    Xp10d3

  11. Offline

    Xp10d3

  12. Offline

    Xp10d3

  13. Offline

    Gilan

    I know I'm late but in short, what you are asking for is impossible. Minecraft can only play sound files that are in the player's resource pack. So, either you are limited to the 15 seconds limit of Minecraft sounds, or you change the music disks, although that only gives you so many songs. AudioConnect is your best option unless you want to use noteblock music.

    Some other important stuff:

    Wynncraft uses noteblock music by using a plugin to play .noteblockstudio files

    If you just want ambient sounds you can use the 15 seconds limit, but it seems like you want music.

    The reason the AudioConnect plugin has to connect to your server is that's how it tells where a player is, also that plugin isn't playing music in-game it's playing it in the browser tab.
     
  14. Offline

    Xp10d3

    Ah, I see. Thanks for letting me know :) I'll look into AudioConnect. Marking as filled for now.
     

Share This Page