mirror of
https://github.com/SimplexDevelopment/FeelingLucky.git
synced 2024-11-25 03:15:01 +00:00
[Beta] SNAPSHOT {Bug Fix} Patch 0002
- Fixed command completions which still did not return correctly. They should now return correctly.
This commit is contained in:
parent
0488e1d6b1
commit
1bf2a818ec
@ -162,9 +162,7 @@ public class LuckCMD extends Command implements TabCompleter {
|
|||||||
List<String> completions = new ArrayList<>() {{
|
List<String> completions = new ArrayList<>() {{
|
||||||
add("info");
|
add("info");
|
||||||
}};
|
}};
|
||||||
List<String> playerNames = new ArrayList<>() {{
|
List<String> playerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).toList();
|
||||||
Bukkit.getOnlinePlayers().forEach(p -> add(p.getName()));
|
|
||||||
}};
|
|
||||||
List<String> adminCommands = List.of("set", "reset", "give", "take", "reload");
|
List<String> adminCommands = List.of("set", "reset", "give", "take", "reload");
|
||||||
|
|
||||||
if ((sender instanceof ConsoleCommandSender) || sender.hasPermission("luck.admin")) {
|
if ((sender instanceof ConsoleCommandSender) || sender.hasPermission("luck.admin")) {
|
||||||
@ -173,18 +171,24 @@ public class LuckCMD extends Command implements TabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (adminCommands.contains(args[0])
|
if (adminCommands.contains(args[0])
|
||||||
&& sender.hasPermission("luck.admin")
|
&& sender.hasPermission("luck.admin")) {
|
||||||
&& (args.length == 2)) {
|
if (args.length == 2) {
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "info":
|
case "info":
|
||||||
case "reset":
|
case "reset":
|
||||||
return playerNames.stream().filter(n -> n.startsWith(args[1])).toList();
|
return playerNames.stream().filter(n -> n.startsWith(args[1])).toList();
|
||||||
case "reload":
|
case "reload":
|
||||||
return List.of("-m", "-p");
|
return List.of("-m", "-p");
|
||||||
case "give":
|
}
|
||||||
case "take":
|
}
|
||||||
case "set":
|
|
||||||
return List.of("amount");
|
if (args.length == 3 && playerNames.contains(args[1])) {
|
||||||
|
switch (args[0]) {
|
||||||
|
case "give":
|
||||||
|
case "take":
|
||||||
|
case "set":
|
||||||
|
return List.of("amount");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user