-
-
Notifications
You must be signed in to change notification settings - Fork 21
GH-1213 Remove usage of panda-utilities and panda expressible. #1213
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f26916a
Remove usage of panda-utilities and panda expressible.
vLuckyyy 44c1e84
Simplify game mode parsing by removing Optional usage and directly ha…
vLuckyyy 69ef1e6
Refactor text capitalization method to use streams for improved reada…
vLuckyyy 33ac56e
revert
vLuckyyy 1b34900
Merge branch 'master' into remove-pandas
vLuckyyy 5f65256
Follow @noyzys review.
vLuckyyy 0ad7406
Fix.
vLuckyyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
eternalcore-core/src/main/java/com/eternalcode/core/litecommand/argument/ArgumentParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package com.eternalcode.core.litecommand.argument; | ||
|
|
||
| import dev.rollczi.litecommands.argument.parser.ParseResult; | ||
| import java.util.function.Function; | ||
| import java.util.function.Predicate; | ||
| import java.util.function.Supplier; | ||
|
|
||
| final class ArgumentParser<INPUT, OUTPUT> { | ||
|
|
||
| private final Function<INPUT, ParseResult<OUTPUT>> parser; | ||
|
|
||
| private ArgumentParser(Function<INPUT, ParseResult<OUTPUT>> parser) { | ||
| this.parser = parser; | ||
| } | ||
|
|
||
| public static <INPUT, OUTPUT> ArgumentParser<INPUT, OUTPUT> of() { | ||
| return new ArgumentParser<>(input -> ParseResult.failure(new Object())); | ||
| } | ||
|
|
||
| public ArgumentParser<INPUT, OUTPUT> thenTry(Function<INPUT, ParseResult<OUTPUT>> nextParser) { | ||
| return new ArgumentParser<>(input -> this.parser.apply(input) | ||
| .mapFailure(ignored -> nextParser.apply(input))); | ||
| } | ||
|
|
||
| public ArgumentParser<INPUT, OUTPUT> thenTryIf( | ||
| Predicate<INPUT> condition, | ||
| Function<INPUT, ParseResult<OUTPUT>> nextParser | ||
| ) { | ||
| return new ArgumentParser<>(input -> this.parser.apply(input) | ||
| .mapFailure(ignored -> { | ||
| if (condition.test(input)) { | ||
| return nextParser.apply(input); | ||
| } | ||
| return ParseResult.failure(new Object()); | ||
| })); | ||
| } | ||
|
|
||
| public Function<INPUT, ParseResult<OUTPUT>> build() { | ||
| return this.parser; | ||
| } | ||
|
|
||
| public Function<INPUT, ParseResult<OUTPUT>> buildWithFinalFailure(Function<INPUT, ParseResult<OUTPUT>> finalFailure) { | ||
| return input -> this.parser.apply(input) | ||
| .mapFailure(ignored -> finalFailure.apply(input)); | ||
| } | ||
|
|
||
| public Function<INPUT, ParseResult<OUTPUT>> buildWithFinalFailure(Supplier<ParseResult<OUTPUT>> finalFailure) { | ||
| return input -> this.parser.apply(input) | ||
| .mapFailure(ignored -> finalFailure.get()); | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.