8000 Add a MapArgument to the CommandAPI by JorelAli · Pull Request #418 · CommandAPI/CommandAPI · GitHub
[go: up one dir, main page]

Skip to content

Add a MapArgument to the CommandAPI #418

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 48 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fe6f87b
Initial commit of the MapArgument
DerEchtePilz Jan 29, 2023
f12f055
Remove continue statements
DerEchtePilz Jan 29, 2023
b06ed20
Revert "Remove continue statements"
DerEchtePilz Jan 29, 2023
3274f0c
Limit the type of key values
DerEchtePilz Jan 30, 2023
43c25f6
Adds tests for float and integer keys
DerEchtePilz Jan 30, 2023
eefe64b
Fix JavaDocs of the MapArgument
DerEchtePilz Jan 30, 2023
a2a7658
Improve JavaDocs of the MapArgument
DerEchtePilz Jan 30, 2023
d10e29a
Prepare to implement suggestions
DerEchtePilz Jan 30, 2023
18adf8e
First commit of implementing suggestions (doesn't work correctly)
DerEchtePilz Feb 2, 2023
3e5023e
Fix suggestions (the suggestions, depite being correct, show up at th…
DerEchtePilz Feb 2, 2023
bbe69d9
Finish suggestions for the MapArgument
DerEchtePilz Feb 3, 2023
674d96a
Remove test command from CommandAPIMain.java
DerEchtePilz Feb 3, 2023
2fbe304
Fix MapArgument tests
DerEchtePilz Feb 3, 2023
d7b9bd5
Removes MapArgumentKeyType
DerEchtePilz Feb 3, 2023
12c9fb0
Finally make suggestions work correctly
DerEchtePilz Feb 3, 2023
483690c
Make the MapArgument return a LinkedHashMap
DerEchtePilz Feb 3, 2023
b6dedf7
Enable commandapi-bukkit-kotlin-test again
DerEchtePilz Feb 3, 2023
8cc72e0
Fix values actually being removed from the list of suggestions if all…
DerEchtePilz Feb 3, 2023
9e5869b
Refactor MapArgument#parseArgument and MapArgument#getSuggestionCode
DerEchtePilz Feb 3, 2023
574096c
More SonarCloud stuff
DerEchtePilz Feb 3, 2023
5e7fb47
Revert the latest refactoring commits and implement an enum to determ…
DerEchtePilz Feb 3, 2023
25a3c73
Throws a CommandSyntaxException if keys or values were provided which…
DerEchtePilz Feb 4, 2023
005b210
Implement tests for invalid keys and values
DerEchtePilz Feb 4, 2023
5134349
Adds tests while using withoutKeyList()/withoutValueList()
DerEchtePilz Feb 4, 2023
249d1ea
Create documentation page. Rename withKeyType() to withKeyMapper()
DerEchtePilz Feb 4, 2023
6a2f2dc
Adds documentation for the MapArgument
DerEchtePilz Feb 4, 2023
5871989
Adds a check to validate keys when building the MapArgument
DerEchtePilz Feb 4, 2023
0b826b7
Fix check that validates keys when building the MapArgument
DerEchtePilz Feb 4, 2023
aa1afed
Throw a CommandSyntaxException if duplicate values have been entered …
DerEchtePilz Feb 4, 2023
b58341b
Removes AMapArgument.java
DerEchtePilz Feb 4, 2023
081eb0b
Adds MapArgument entry to arguments.md
DerEchtePilz Feb 4, 2023
8d8dba7
Improve removing suggestions when duplicates are not allowed
DerEchtePilz Feb 5, 2023
3611281
Removes an unused field
DerEchtePilz Feb 5, 2023
01279b0
Fix documentation for the MapArgument
DerEchtePilz Feb 5, 2023
d490f2b
Fix some formatting in argument_map.md
DerEchtePilz Feb 6, 2023
037a21a
Fix MapArgument allowing incomplete maps
DerEchtePilz Feb 8, 2023
1ca3653
Does this fix a 'bug' SonarCloud is complaining about?
DerEchtePilz Feb 12, 2023
0c2205e
Use the same StringBuilder for both keyBuilder and valueBuilder
JorelAli Feb 12, 2023
1caabb6
Merge branch 'dev/dev' into dev/map-argument
DerEchtePilz Feb 17, 2023
129b2bc
Fix MapArgument#parseArgument to use the CommandArguments class
DerEchtePilz Feb 17, 2023
4f0dd4a
Adding some more tests
DerEchtePilz Feb 18, 2023
91aab9f
Implement suggestion tests for the MapArgument
DerEchtePilz Feb 24, 2023
4f75e95
Adds suggestion tests without values being removed
DerEchtePilz Feb 24, 2023
0ebb148
Catch exception that is thrown when the mapping function fails and th…
DerEchtePilz Mar 1, 2023
fb5e5b5
Adds a missing test when parsing arguments
DerEchtePilz Mar 2, 2023
03a256f
Wrap map argument syntax in a code block
JorelAli Mar 3, 2023
c8d67c8
Merge dev/dev into dev/map-argument
DerEchtePilz Mar 4, 2023
47d6c61
Merge JorelAli:dev/map-argument into dev/map-argument
DerEchtePilz Mar 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding some more tests
  • Loading branch information
DerEchtePilz committed Feb 18, 2023
commit 4f0dd4a0ff3f375bae959cd215d5cefcccf27d71
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ private boolean validateKey(StringBuilder visitedCharacters, Pattern keyPattern,
if (!keyPattern.matcher(keyValueBufferString).matches()) {
throw throwInvalidKeyCharacter(visitedCharacters);
}
return !keyList.contains(keyValueBufferString);
return !keyList.contains(keyValueBufferString) && !keyListEmpty;
}

private void validateValueStart(char currentChar, StringBuilder visitedCharacters) throws CommandSyntaxException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void tearDown() {
* Tests *
*********/

// TODO: Suggestion test!!!

@Test
public void executionTestWithMapArgument() {
Mut<LinkedHashMap<String, String>> results = Mut.of();
Expand Down Expand Up @@ -77,6 +79,21 @@ public void executionTestWithMapArgument() {
testMap.put("test", "Test value");
assertEquals(testMap, results.get());

// /test map:"cool map" map:"bar"
assertCommandFailsWith(player, "test map:\"cool map\" map:\"bar\"", "Could not parse command: Duplicate keys are not allowed at position 19: ...l map\" map<--[HERE]");

// /test map:
assertCommandFailsWith(player, "test map:", "Could not parse command: Quotation mark required after writing the delimiter at position 4: map:<--[HERE]");

// /test map
assertCommandFailsWith(player, "test map", "Could not parse command: Delimiter required after writing a key at position 3: map<--[HERE]");

// /test map:"
assertCommandFailsWith(player, "test map:\"", "Could not parse command: Value required after opening quotation mark at position 5: map:\"<--[HERE]");

// /test map:"this" otherMap:"this"
assertCommandFailsWith(player, "test map:\"this\" otherMap:\"this\"", "Could not parse command: Duplicate values are not allowed here at position 26: ...rMap:\"this<--[HERE]");

assertNoMoreResults(results);
}

Expand Down
0