📝 Change auto completion

This commit is contained in:
Maxlego08 2024-03-04 16:42:02 +01:00
parent 1e5720b526
commit 628e4135cf
3 changed files with 19 additions and 14 deletions

View File

@ -5,6 +5,7 @@
- Create placeholder: ``%zkoth_capture_progress_bar%``
- Create placeholder: ``%zkoth_progress_bar_score_points_<position>%``
- Create placeholder: ``%zkoth_progress_bar_score%``
- Change auto-completion for /koth stop
# 3.0.2

View File

@ -320,4 +320,8 @@ public class KothManager extends ZUtils implements Savable {
message(sender, Message.COMMAND_CREATE, "%command%", command);
this.saveKoth(koth);
}
public List<String> getActiveNameKoths() {
return this.getEnableKoths().stream().map(Koth::getFileName).collect(Collectors.toList());
}
}

View File

@ -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;
}
}