diff --git a/changelog.md b/changelog.md index d198f9b..e9f94e9 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ - Create placeholder: ``%zkoth_capture_progress_bar%`` - Create placeholder: ``%zkoth_progress_bar_score_points_%`` - Create placeholder: ``%zkoth_progress_bar_score%`` +- Change auto-completion for /koth stop # 3.0.2 diff --git a/src/fr/maxlego08/koth/KothManager.java b/src/fr/maxlego08/koth/KothManager.java index 211e6d5..3e3c875 100644 --- a/src/fr/maxlego08/koth/KothManager.java +++ b/src/fr/maxlego08/koth/KothManager.java @@ -320,4 +320,8 @@ public class KothManager extends ZUtils implements Savable { message(sender, Message.COMMAND_CREATE, "%command%", command); this.saveKoth(koth); } + + public List getActiveNameKoths() { + return this.getEnableKoths().stream().map(Koth::getFileName).collect(Collectors.toList()); + } } diff --git a/src/fr/maxlego08/koth/command/commands/CommandKothStop.java b/src/fr/maxlego08/koth/command/commands/CommandKothStop.java index 72002eb..4b7a99b 100644 --- a/src/fr/maxlego08/koth/command/commands/CommandKothStop.java +++ b/src/fr/maxlego08/koth/command/commands/CommandKothStop.java @@ -8,21 +8,21 @@ import fr.maxlego08.koth.zcore.utils.commands.CommandType; public class CommandKothStop extends VCommand { - public CommandKothStop(KothPlugin plugin) { - super(plugin); - this.setPermission(Permission.ZKOTH_STOP); - this.addSubCommand("stop"); - this.setDescription(Message.DESCRIPTION_SPAWN); - this.addRequireArg("name", (a,b) -> plugin.getKothManager().getNameKoths()); - } + public CommandKothStop(KothPlugin plugin) { + super(plugin); + this.setPermission(Permission.ZKOTH_STOP); + this.addSubCommand("stop"); + this.setDescription(Message.DESCRIPTION_SPAWN); + this.addRequireArg("name", (a, b) -> plugin.getKothManager().getActiveNameKoths()); + } - @Override - protected CommandType perform(KothPlugin plugin) { + @Override + protected CommandType perform(KothPlugin plugin) { - String name = argAsString(0); - this.manager.stopKoth(sender, name); - - return CommandType.SUCCESS; - } + String name = argAsString(0); + this.manager.stopKoth(sender, name); + + return CommandType.SUCCESS; + } }