Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NoteblockAPI's PositionSongPlayer #422

Merged
merged 9 commits into from Mar 28, 2024

Conversation

BreadcrumbIsTaken
Copy link
Contributor

Play NBS songs from a certain location

Changes

  • Update NoteblockAPI version (can be reverted if necessary)
  • Add at:<location> argument to specify the location the song should play from
  • Add distance:<#> argument to control the hearing range (and volume if number < 16)
  • Make command use autoExecute
  • Edit syntax line so <file path> is <file_path> because it was causing a weird tab-completion issue:
    image

Notes

  • Not sure why the distance only increases the range when its greater than 16. When it's less than 16 the volume just lowers but you can still just barely hear it 16 blocks away, even when the distance is set to 5 or something like that

requested by Josh65

pom.xml Outdated
@@ -236,7 +236,7 @@
<dependency>
<groupId>com.github.koca2000</groupId>
<artifactId>NoteBlockAPI</artifactId>
<version>1.2.2.1</version>
<version>1.6.2</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this change from the PR so it can be applied separately

return;
}
String directory = URLDecoder.decode(System.getProperty("user.dir"));
Song s = NBSDecoder.parse(new File(directory + "/plugins/Denizen/" + file + ".nbs"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an issue with the original code not this PR, but this file handling is wrong - it should look more like

File file = new File(Denizen.getInstance().getDataFolder(), fName + ".nbs");
if (!Utilities.canReadFile(file)) {
    Debug.echoError("Cannot read from that file path due to security settings in Denizen/config.yml.");
    return;
}

@BreadcrumbIsTaken
Copy link
Contributor Author

Done

@BreadcrumbIsTaken
Copy link
Contributor Author

Removed scriptEntry 👍

}
else {
throw new InvalidArgumentsException("Must specify players to add, remove or spectate!");
throw new InvalidArgumentsRuntimeException("Must specify players to add or remove!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message still isn't really clear, probably players to play/stop a song for or something?

@BreadcrumbIsTaken
Copy link
Contributor Author

Done 👍

}

// <--[command]
// @Name nbs
// @Syntax nbs [play/stop] (file:<file path>) (targets:<entity>|...)
// @Syntax nbs [play/stop] (file:<file_path>) (targets:<entity>|...) (at:<location>) (distance:<#>{16})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<#>/{16}

@BreadcrumbIsTaken
Copy link
Contributor Author

Done

@tal5 tal5 merged commit cdcca3e into DenizenScript:master Mar 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants