added teamlist command
This commit is contained in:
@ -0,0 +1,28 @@
|
|||||||
|
package eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.teams;
|
||||||
|
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class TeamListCommand extends ApplianceCommand<Teams> {
|
||||||
|
public TeamListCommand() {
|
||||||
|
super("teamList");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
String teams = this.getAppliance().getAllTeams().stream()
|
||||||
|
.map(team -> {
|
||||||
|
String members = team.members.stream()
|
||||||
|
.map(member -> String.format("%s(%s)", member.player.getName(), member.isDead ? "☠" : "♥"))
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
return String.format("%s: %s", team.name, members);
|
||||||
|
})
|
||||||
|
.collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
sender.sendMessage(teams);
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package eu.mhsl.craftattack.spawn.varo.appliances.metaGameplay.teams;
|
|||||||
|
|
||||||
import eu.mhsl.craftattack.spawn.core.Main;
|
import eu.mhsl.craftattack.spawn.core.Main;
|
||||||
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
import eu.mhsl.craftattack.spawn.core.appliance.Appliance;
|
||||||
|
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
||||||
import eu.mhsl.craftattack.spawn.core.util.text.DisconnectInfo;
|
import eu.mhsl.craftattack.spawn.core.util.text.DisconnectInfo;
|
||||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.displayName.DisplayName;
|
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.displayName.DisplayName;
|
||||||
import eu.mhsl.craftattack.spawn.varo.api.repositories.TeamRepository;
|
import eu.mhsl.craftattack.spawn.varo.api.repositories.TeamRepository;
|
||||||
@ -183,4 +184,9 @@ public class Teams extends Appliance implements DisplayName.Prefixed, DisplayNam
|
|||||||
protected @NotNull List<Listener> listeners() {
|
protected @NotNull List<Listener> listeners() {
|
||||||
return List.of(new ConnectivityChangeListener());
|
return List.of(new ConnectivityChangeListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull List<ApplianceCommand<?>> commands() {
|
||||||
|
return List.of(new TeamListCommand());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user