Skip to content

Commit

Permalink
/is invite add playername devient /is invite playername
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya committed Jan 5, 2025
1 parent c81add5 commit 8da8abd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,7 @@ public boolean onCommand(@NotNull Plugin plugin, @NotNull CommandSender sender,
}
String type = args[0];
Main skyblock = Main.getPlugin(Main.class);
if (type.equalsIgnoreCase("add")) {
if (args.length < 2) {
LanguageToml.sendMessage(player, LanguageToml.messageInviteAddCommandNotEnoughArgs);
return true;
}
String playerOrOwner = args[1];
invitePlayer(skyblock, player, playerOrOwner);
} else if (type.equalsIgnoreCase("accept")) {
if (type.equalsIgnoreCase("accept")) {
if (args.length < 2) {
LanguageToml.sendMessage(player, LanguageToml.messageInviteAcceptCommandNotEnoughArgs);
return true;
Expand All @@ -74,14 +67,16 @@ public boolean onCommand(@NotNull Plugin plugin, @NotNull CommandSender sender,
}
String playerOrOwner = args[1];
deleteInvitePlayer(skyblock, player, playerOrOwner);
} else {
invitePlayer(skyblock, player, args[0]);
}
return true;
}

@Override
public @NotNull List<String> onTabComplete(@NotNull Plugin plugin, @NotNull CommandSender sender, @NotNull String[] args) {
if (args.length == 1) {
List<String> possible = List.of("accept", "decline", "add", "delete");
List<String> possible = List.of("accept", "decline", "delete");
String partial = args[0].trim().toLowerCase();
return possible.stream()
.filter(cmd -> cmd.toLowerCase().startsWith(partial))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class LanguageToml {
public static String messageInviteAcceptCommandNotEnoughArgs = "You must specify which island you want to join: /skyllia invite accept <island_owner>";
public static String messageInviteRemoveCommandNotEnoughArgs = "The command is incomplete: /skyllia invite remove <island_owner>";
public static String messageInviteDeclineCommandNotEnoughArgs = "You must specify which island you want to decline: /skyllia invite decline <island_owner>";
public static String messageInviteAddCommandNotEnoughArgs = "You must specify which island you want to decline: /skyllia invite add <player>";
public static String messageInviteAddCommandNotEnoughArgs = "You must specify which island you want to decline: /skyllia invite <player>";
public static String messageInvitePlayerInvited = "The player %s has been invited. Awaiting a response...";
public static String messageInviteDeletePlayerInvited = "You have deleted %s's invitation.";
public static String messageInvitePlayerNotification = "The player %player_invite% has invited you to their island. To accept: /skyllia invite accept %player_invite%. To decline: /skyllia invite decline %player_invite%";
Expand Down

0 comments on commit 8da8abd

Please sign in to comment.