Skip to content

Commit

Permalink
Fixed offline home suggestions sending messages to the player when th…
Browse files Browse the repository at this point in the history
…e username was invalid.
  • Loading branch information
Sintinium committed Dec 21, 2021
1 parent cb76a86 commit 8caa6ae
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
.executes(context -> listHomesFor(context.getSource(), StringArgumentType.getString(context, "player")))
.then(Commands.argument("name", StringArgumentType.greedyString())
.requires(source -> source.hasPermission(2))
.suggests((context, builder) -> SharedSuggestionProvider.suggest(getOfflineHomeSuggestions(context.getSource().getPlayerOrException(), StringArgumentType.getString(context, "player")), builder))
.suggests((context, builder) -> SharedSuggestionProvider.suggest(getOfflineHomeSuggestions(StringArgumentType.getString(context, "player")), builder))
.executes(context -> homeFor(context.getSource().getPlayerOrException(), StringArgumentType.getString(context, "player"), StringArgumentType.getString(context, "name")))
)
)
Expand Down Expand Up @@ -219,10 +219,9 @@ private static int homeFor(ServerPlayer player, String offlineName, String homeN
return data.homeTeleporter.teleport(player, p -> pos).runCommand(player);
}

private static Set<String> getOfflineHomeSuggestions(ServerPlayer serverPlayer, String offlineName) {
private static Set<String> getOfflineHomeSuggestions(String offlineName) {
UUID uuid = getOfflineUUIDByName(offlineName);
if (uuid == null) {
serverPlayer.displayClientMessage(new TextComponent("No player with name " + offlineName + " found!"), false);
return Collections.emptySet();
}
FTBEPlayerData data = getOfflinePlayerData(uuid);
Expand Down

0 comments on commit 8caa6ae

Please sign in to comment.