Skip to content

Add mappings-latest function to Clojure sandbox#64

Open
SizableShrimp wants to merge 3 commits intotterrag1098:masterfrom
SizableShrimp:master
Open

Add mappings-latest function to Clojure sandbox#64
SizableShrimp wants to merge 3 commits intotterrag1098:masterfrom
SizableShrimp:master

Conversation

@SizableShrimp
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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