From b4a2da0ea8c3b207680122d59146c7e0f599bfaa Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 9 Jun 2017 22:17:37 +0100 Subject: [PATCH] Add some missing tab completions, remove /lp log export command --- .../common/commands/CommandManager.java | 8 +- .../commands/abstraction/SubCommand.java | 2 +- .../impl/generic/parent/ParentClearTrack.java | 7 + .../impl/generic/parent/ParentSetTrack.java | 8 +- .../generic/permission/PermissionUnset.java | 7 + .../permission/PermissionUnsetTemp.java | 7 + .../commands/impl/group/DeleteGroup.java | 14 +- .../commands/impl/log/LogMainCommand.java | 2 - .../impl/log/subcommands/LogExport.java | 135 ------------------ .../impl/log/subcommands/LogGroupHistory.java | 5 + .../impl/log/subcommands/LogTrackHistory.java | 5 + .../commands/impl/misc/CheckCommand.java | 16 +++ .../commands/impl/misc/SearchCommand.java | 6 + .../commands/impl/misc/VerboseCommand.java | 17 +++ .../commands/impl/track/DeleteTrack.java | 17 +-- .../common/constants/Permission.java | 1 - 16 files changed, 86 insertions(+), 171 deletions(-) delete mode 100644 common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogExport.java diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java index 409ebba34..0feb52461 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java @@ -197,9 +197,12 @@ public class CommandManager { @SuppressWarnings("unchecked") public List onTabComplete(Sender sender, List args) { List arguments = new ArrayList<>(args); + + // we rewrite tab completions too! handleRewrites(arguments); final List mains = mainCommands.stream() + .filter(Command::shouldDisplay) .filter(m -> m.isAuthorized(sender)) .collect(Collectors.toList()); @@ -239,12 +242,9 @@ public class CommandManager { private void sendCommandUsage(Sender sender, String label) { Util.sendPluginMessage(sender, "&2Running &bLuckPerms v" + plugin.getVersion() + "&2."); mainCommands.stream() + .filter(Command::shouldDisplay) .filter(c -> c.isAuthorized(sender)) .forEach(c -> { - if (!c.shouldDisplay()) { - return; - } - @SuppressWarnings("unchecked") String permission = (String) c.getPermission().map(p -> ((Permission) p).getExample()).orElse("None"); FancyMessage msg = new FancyMessage("> ").color(c('3')).then().text(String.format(c.getUsage(), label)).color(c('a')) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SubCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SubCommand.java index 66af8897e..897c590c5 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/abstraction/SubCommand.java @@ -159,7 +159,7 @@ public abstract class SubCommand extends Command { return Collections.emptyList(); } - private static List getTabComplete(List options, List args) { + public static List getTabComplete(List options, List args) { if (args.size() <= 1) { if (args.isEmpty() || args.get(0).equalsIgnoreCase("")) { return options; diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentClearTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentClearTrack.java index dd86c5117..8b8f76a4e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentClearTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentClearTrack.java @@ -46,6 +46,8 @@ import me.lucko.luckperms.common.utils.Predicates; import java.util.List; import java.util.stream.Collectors; +import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete; + public class ParentClearTrack extends SharedSubCommand { public ParentClearTrack() { super("cleartrack", "Clears all parents on a given track", Permission.USER_PARENT_CLEAR_TRACK, Permission.GROUP_PARENT_CLEAR_TRACK, Predicates.is(0), @@ -108,4 +110,9 @@ public class ParentClearTrack extends SharedSubCommand { save(holder, sender, plugin); return CommandResult.SUCCESS; } + + @Override + public List onTabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return getTrackTabComplete(args, plugin); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentSetTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentSetTrack.java index cfc1dfccb..c69f41a57 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentSetTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/parent/ParentSetTrack.java @@ -46,6 +46,7 @@ import me.lucko.luckperms.common.utils.Predicates; import java.util.List; import java.util.stream.Collectors; +import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getGroupTabComplete; import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getTrackTabComplete; public class ParentSetTrack extends SharedSubCommand { @@ -129,6 +130,11 @@ public class ParentSetTrack extends SharedSubCommand { @Override public List onTabComplete(LuckPermsPlugin plugin, Sender sender, List args) { - return getTrackTabComplete(args, plugin); + if (args.size() == 0 || args.size() == 1) { + return getTrackTabComplete(args, plugin); + } + + args.remove(0); + return getGroupTabComplete(args, plugin); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java index a23b2c4c7..1b918498c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnset.java @@ -45,6 +45,8 @@ import me.lucko.luckperms.common.utils.Predicates; import java.util.List; import java.util.stream.Collectors; +import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete; + public class PermissionUnset extends SharedSubCommand { public PermissionUnset() { super("unset", "Unsets a permission for the object", Permission.USER_PERM_UNSET, Permission.GROUP_PERM_UNSET, @@ -84,4 +86,9 @@ public class PermissionUnset extends SharedSubCommand { return CommandResult.STATE_ERROR; } } + + @Override + public List onTabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return getPermissionTabComplete(args, plugin.getPermissionVault()); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnsetTemp.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnsetTemp.java index 5dfde4d07..be052681d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnsetTemp.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/generic/permission/PermissionUnsetTemp.java @@ -45,6 +45,8 @@ import me.lucko.luckperms.common.utils.Predicates; import java.util.List; import java.util.stream.Collectors; +import static me.lucko.luckperms.common.commands.abstraction.SubCommand.getPermissionTabComplete; + public class PermissionUnsetTemp extends SharedSubCommand { public PermissionUnsetTemp() { super("unsettemp", "Unsets a temporary permission for the object", Permission.USER_PERM_UNSETTEMP, @@ -77,4 +79,9 @@ public class PermissionUnsetTemp extends SharedSubCommand { return CommandResult.STATE_ERROR; } } + + @Override + public List onTabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return getPermissionTabComplete(args, plugin.getPermissionVault()); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/group/DeleteGroup.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/group/DeleteGroup.java index 000440c15..a81299a13 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/group/DeleteGroup.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/group/DeleteGroup.java @@ -29,6 +29,7 @@ import me.lucko.luckperms.api.event.cause.DeletionCause; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SingleCommand; +import me.lucko.luckperms.common.commands.abstraction.SubCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.config.ConfigKeys; import me.lucko.luckperms.common.constants.Message; @@ -90,17 +91,6 @@ public class DeleteGroup extends SingleCommand { @Override public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { - final List groups = new ArrayList<>(plugin.getGroupManager().getAll().keySet()); - - if (args.size() <= 1) { - if (args.isEmpty() || args.get(0).equalsIgnoreCase("")) { - return groups; - } - - return groups.stream().filter(s -> s.toLowerCase().startsWith(args.get(0).toLowerCase())) - .collect(Collectors.toList()); - } - - return Collections.emptyList(); + return SubCommand.getGroupTabComplete(args, plugin); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/LogMainCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/LogMainCommand.java index 1f69d4170..b3b0f6927 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/LogMainCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/LogMainCommand.java @@ -29,7 +29,6 @@ import com.google.common.collect.ImmutableList; import me.lucko.luckperms.common.commands.abstraction.Command; import me.lucko.luckperms.common.commands.abstraction.MainCommand; -import me.lucko.luckperms.common.commands.impl.log.subcommands.LogExport; import me.lucko.luckperms.common.commands.impl.log.subcommands.LogGroupHistory; import me.lucko.luckperms.common.commands.impl.log.subcommands.LogNotify; import me.lucko.luckperms.common.commands.impl.log.subcommands.LogRecent; @@ -52,7 +51,6 @@ public class LogMainCommand extends MainCommand { .add(new LogRecent()) .add(new LogSearch()) .add(new LogNotify()) - .add(new LogExport()) .add(new LogUserHistory()) .add(new LogGroupHistory()) .add(new LogTrackHistory()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogExport.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogExport.java deleted file mode 100644 index df578da4e..000000000 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogExport.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This file is part of LuckPerms, licensed under the MIT License. - * - * Copyright (c) lucko (Luck) - * Copyright (c) contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.lucko.luckperms.common.commands.impl.log.subcommands; - -import me.lucko.luckperms.api.LogEntry; -import me.lucko.luckperms.common.commands.Arg; -import me.lucko.luckperms.common.commands.CommandException; -import me.lucko.luckperms.common.commands.CommandResult; -import me.lucko.luckperms.common.commands.abstraction.SubCommand; -import me.lucko.luckperms.common.commands.sender.Sender; -import me.lucko.luckperms.common.constants.Message; -import me.lucko.luckperms.common.constants.Permission; -import me.lucko.luckperms.common.data.Log; -import me.lucko.luckperms.common.plugin.LuckPermsPlugin; -import me.lucko.luckperms.common.utils.Predicates; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; - -public class LogExport extends SubCommand { - public LogExport() { - super("export", "Export the log to a file", Permission.LOG_EXPORT, Predicates.not(1), - Arg.list(Arg.create("file", true, "the name of the file")) - ); - } - - @Override - public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, List args, String label) throws CommandException { - File f = new File(plugin.getDataDirectory(), args.get(0)); - if (f.exists()) { - Message.LOG_EXPORT_ALREADY_EXISTS.send(sender, f.getAbsolutePath()); - return CommandResult.INVALID_ARGS; - } - - if (log.getContent().isEmpty()) { - Message.LOG_EXPORT_EMPTY.send(sender); - return CommandResult.STATE_ERROR; - } - - try { - f.createNewFile(); - } catch (IOException e) { - Message.LOG_EXPORT_FAILURE.send(sender); - e.printStackTrace(); - return CommandResult.FAILURE; - } - - if (!Files.isWritable(f.toPath())) { - Message.LOG_EXPORT_NOT_WRITABLE.send(sender, f.getAbsolutePath()); - return CommandResult.FAILURE; - } - - List data = new ArrayList<>(); - - StringBuilder b = new StringBuilder(); - for (LogEntry e : log.getContent()) { - b.setLength(0); - b.append("/luckperms "); - - if (e.getType() == 'U') { - b.append("user ").append(e.getActed().toString()).append(" ").append(e.getAction()); - } - - group: - if (e.getType() == 'G') { - if (e.getAction().equalsIgnoreCase("create")) { - b.append("creategroup ").append(e.getActedName()); - break group; - } - - if (e.getAction().equalsIgnoreCase("delete")) { - b.append("deletegroup ").append(e.getActedName()); - break group; - } - - b.append("group ").append(e.getActedName()).append(" ").append(e.getAction()); - } - - track: - if (e.getType() == 'T') { - if (e.getAction().equalsIgnoreCase("create")) { - b.append("createtrack ").append(e.getActedName()); - break track; - } - - if (e.getAction().equalsIgnoreCase("delete")) { - b.append("deletetrack ").append(e.getActedName()); - break track; - } - - b.append("track ").append(e.getActedName()).append(" ").append(e.getAction()); - } - - data.add(b.toString()); - } - - - try { - Files.write(f.toPath(), data, Charset.defaultCharset()); - Message.LOG_EXPORT_SUCCESS.send(sender, f.getAbsolutePath()); - return CommandResult.SUCCESS; - } catch (IOException e) { - e.printStackTrace(); - Message.LOG_EXPORT_FAILURE.send(sender); - return CommandResult.FAILURE; - } - } -} diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogGroupHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogGroupHistory.java index 52c145dc4..1447d0165 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogGroupHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogGroupHistory.java @@ -98,4 +98,9 @@ public class LogGroupHistory extends SubCommand { return CommandResult.SUCCESS; } + + @Override + public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return getGroupTabComplete(args, plugin); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogTrackHistory.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogTrackHistory.java index 1b5e2bb26..4b42e10a1 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogTrackHistory.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/log/subcommands/LogTrackHistory.java @@ -98,4 +98,9 @@ public class LogTrackHistory extends SubCommand { return CommandResult.SUCCESS; } + + @Override + public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return getTrackTabComplete(args, plugin); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java index 6bc2d71ce..2b06b79a2 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/CheckCommand.java @@ -30,6 +30,7 @@ import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SingleCommand; +import me.lucko.luckperms.common.commands.abstraction.SubCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.Util; import me.lucko.luckperms.common.constants.Message; @@ -40,6 +41,7 @@ import me.lucko.luckperms.common.utils.Predicates; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; public class CheckCommand extends SingleCommand { public CheckCommand() { @@ -74,4 +76,18 @@ public class CheckCommand extends SingleCommand { Message.CHECK_RESULT.send(sender, user.getFriendlyName(), permission, Util.formatTristate(tristate)); return CommandResult.SUCCESS; } + + @Override + public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + if (args.isEmpty()) { + return plugin.getPlayerList(); + } + + if (args.size() == 1) { + return plugin.getPlayerList().stream().filter(s -> s.toLowerCase().startsWith(args.get(0).toLowerCase())).collect(Collectors.toList()); + } + + args.remove(0); + return SubCommand.getPermissionTabComplete(args, plugin.getPermissionVault()); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/SearchCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/SearchCommand.java index 0b3c04392..cb7674d1c 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/SearchCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/SearchCommand.java @@ -33,6 +33,7 @@ import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandException; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SingleCommand; +import me.lucko.luckperms.common.commands.abstraction.SubCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.commands.utils.ArgumentUtils; import me.lucko.luckperms.common.commands.utils.Util; @@ -112,6 +113,11 @@ public class SearchCommand extends SingleCommand { return CommandResult.SUCCESS; } + @Override + public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + return SubCommand.getPermissionTabComplete(args, plugin.getPermissionVault()); + } + private static Map.Entry searchUserResultToMessage(List> results, Function uuidLookup, String label, int pageNumber) { if (results.isEmpty()) { return Maps.immutableEntry(new FancyMessage("None").color(ChatColor.getByChar('3')), null); diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/VerboseCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/VerboseCommand.java index 5191ac1da..72171b1d0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/VerboseCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/misc/VerboseCommand.java @@ -25,6 +25,8 @@ package me.lucko.luckperms.common.commands.impl.misc; +import com.google.common.collect.ImmutableList; + import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SingleCommand; @@ -39,8 +41,10 @@ import io.github.mkremins.fanciful.ChatColor; import io.github.mkremins.fanciful.FancyMessage; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; public class VerboseCommand extends SingleCommand { public VerboseCommand() { @@ -123,4 +127,17 @@ public class VerboseCommand extends SingleCommand { sendUsage(sender, label); return CommandResult.INVALID_ARGS; } + + @Override + public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { + if (args.isEmpty()) { + return ImmutableList.of("on", "record", "off", "paste"); + } + + if (args.size() == 1) { + return Stream.of("on", "record", "off", "paste").filter(s -> s.toLowerCase().startsWith(args.get(0).toLowerCase())).collect(Collectors.toList()); + } + + return Collections.emptyList(); + } } diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/impl/track/DeleteTrack.java b/common/src/main/java/me/lucko/luckperms/common/commands/impl/track/DeleteTrack.java index 40207bfe2..5373b0e3e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/impl/track/DeleteTrack.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/impl/track/DeleteTrack.java @@ -29,6 +29,7 @@ import me.lucko.luckperms.api.event.cause.DeletionCause; import me.lucko.luckperms.common.commands.Arg; import me.lucko.luckperms.common.commands.CommandResult; import me.lucko.luckperms.common.commands.abstraction.SingleCommand; +import me.lucko.luckperms.common.commands.abstraction.SubCommand; import me.lucko.luckperms.common.commands.sender.Sender; import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Permission; @@ -38,9 +39,7 @@ import me.lucko.luckperms.common.plugin.LuckPermsPlugin; import me.lucko.luckperms.common.utils.Predicates; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; public class DeleteTrack extends SingleCommand { public DeleteTrack() { @@ -83,18 +82,6 @@ public class DeleteTrack extends SingleCommand { @Override public List tabComplete(LuckPermsPlugin plugin, Sender sender, List args) { - final List tracks = new ArrayList<>(plugin.getTrackManager().getAll().keySet()); - - if (args.size() <= 1) { - if (args.isEmpty() || args.get(0).equalsIgnoreCase("")) { - return tracks; - } - - return tracks.stream() - .filter(s -> s.toLowerCase().startsWith(args.get(0).toLowerCase())) - .collect(Collectors.toList()); - } - - return Collections.emptyList(); + return SubCommand.getTrackTabComplete(args, plugin); } } diff --git a/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java b/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java index 56952cfbe..c81dcb57d 100644 --- a/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java +++ b/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java @@ -150,7 +150,6 @@ public enum Permission { LOG_TRACK_HISTORY(list("trackhistory"), Type.LOG), LOG_SEARCH(list("search"), Type.LOG), LOG_NOTIFY(list("notify"), Type.LOG), - LOG_EXPORT(list("export"), Type.LOG), SPONGE_PERMISSION_INFO(list("permission.info"), Type.SPONGE), SPONGE_PERMISSION_SET(list("permission.set"), Type.SPONGE),