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 mappings-latest function to Clojure sandbox #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SizableShrimp
Copy link
Contributor

This is a simple PR that adds a new static method to MappingDownloader, which takes in a channel string and outputs the latest version for that string. A function is also added to the sandbox init clojure file to support this. This is useful for a trick that I am making. I confirmed it to work in nREPL.

@tterrag1098 tterrag1098 force-pushed the master branch 3 times, most recently from 29d7b5a to 02c4e91 Compare April 29, 2021 19:23


public static CommandMappings<?> getMappingsCommand(String channel) {
switch (channel.toLowerCase(Locale.ROOT)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I'd say use this as a fallback, I see no reason why "mcp", "moj", etc would not be valid. Also what about yarn?

final TypeBinding<MappingInfo> mappingBinding = new TypeBinding<MappingInfo>("MappingInfo")
.bind("channel", MappingInfo::getChannel)
.bind("stable", MappingInfo::isStable)
.bind("version", cmd -> cmd.getDownloader().getMappingsVersion(cmd.getMcVersion(), cmd.isStable()).block())
Copy link
Owner

Choose a reason for hiding this comment

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

Calling into the downloader is not a good idea, if this triggers a web request it will fail within trick context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How will it fail? I specifically tried to query stuff I did not have downloaded and it seemed to work fine

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.

2 participants