Skip to content

Commit

Permalink
Inline some variables
Browse files Browse the repository at this point in the history
Signed-off-by: BT (calcastor/mame) <[email protected]>
  • Loading branch information
calcastor committed May 20, 2024
1 parent d57226b commit 10c5e9f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ public final class DurationParser
public @NotNull ArgumentParseResult<Duration> parse(
final @NotNull CommandContext<CommandSender> context,
final @NotNull CommandInput inputQueue) {
final String input = inputQueue.peekString();
try {
Duration result = TextParser.parseDuration(input);
Duration result = TextParser.parseDuration(inputQueue.peekString());
inputQueue.readString();
return success(result);
} catch (TextException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ public final class MapPoolParser
@Override
public @NotNull List<@NotNull String> stringSuggestions(
final @NotNull CommandContext<CommandSender> context, final @NotNull CommandInput input) {
final String next = input.readString();
MapOrder mapOrder = PGM.get().getMapOrder();
if (!(mapOrder instanceof MapPoolManager)) return Collections.emptyList();

return getPools(context, (MapPoolManager) mapOrder)
.map(MapPool::getName)
.filter(name -> LiquidMetal.match(name, next))
.filter(name -> LiquidMetal.match(name, input.readString()))
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ public ArgumentParseResult<Party> parse(
@Override
public @NotNull List<@NotNull String> stringSuggestions(
@NotNull CommandContext<CommandSender> context, @NotNull CommandInput input) {
final String next = input.peekString();
List<String> teams = teamParser.stringSuggestions(context, input);
if (LiquidMetal.match("obs", next)) teams.add("obs");
if (LiquidMetal.match("obs", input.peekString())) teams.add("obs");
return teams;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ public final class PlayerParser
@Override
public @NotNull List<@NotNull String> stringSuggestions(
@NotNull CommandContext<CommandSender> context, @NotNull CommandInput input) {
final String next = input.readString();
CommandSender sender = context.sender();

return Players.getPlayerNames(sender, next);
return Players.getPlayerNames(sender, input.readString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public ArgumentParseResult<Collection<Team>> parse(
@Override
public @NotNull List<@NotNull String> stringSuggestions(
@NotNull CommandContext<CommandSender> context, @NotNull CommandInput input) {
final String next = input.peekString();
List<String> teams = teamParser.stringSuggestions(context, input);
if ("*".startsWith(next)) teams.add("*");
if ("*".startsWith(input.peekString())) teams.add("*");
return teams;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public final class VictoryConditionParser
@Override
public @NotNull List<@NotNull String> stringSuggestions(
@NotNull CommandContext<CommandSender> context, @NotNull CommandInput input) {
final String next = input.readString();
final Match match = CommandUtils.getMatch(context);
if (match == null) return BASE_SUGGESTIONS;

Expand All @@ -72,7 +71,7 @@ public final class VictoryConditionParser
tmm.getParticipatingTeams().stream()
.map(Team::getNameLegacy)
.map(name -> name.replace(" ", "")))
.filter(str -> LiquidMetal.match(str, next))
.filter(str -> LiquidMetal.match(str, input.readString()))
.collect(Collectors.toList());
}
}

0 comments on commit 10c5e9f

Please sign in to comment.