From 9628ff8ac7a65d57c0bccc9382c67c1a9e0bf4e7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 22 Sep 2022 17:03:26 +0200 Subject: [PATCH] Update TeamCommand --- .../bungeecore/commands/TeamCommand.java | 322 ++++++++++-------- 1 file changed, 181 insertions(+), 141 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index b0f3df2..65436b7 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -91,7 +91,7 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_HELP_INFO", player); Message.send("TEAM_HELP_TP", player); - if(user.getTeam() == 0) { + if (user.getTeam() == 0) { Message.send("TEAM_HELP_CREATE", player); Message.send("TEAM_HELP_JOIN", player); } else { @@ -99,7 +99,7 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_HELP_EVENT", player); Message.send("TEAM_HELP_LEAVE", player); - if(user.isLeader()){ + if (user.isLeader()) { Message.send("TEAM_HELP_INVITE", player); Message.send("TEAM_HELP_REMOVE", player); Message.send("TEAM_HELP_KUERZEL", player); @@ -129,6 +129,20 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_JOIN_JOINED", player, toJoin.getTeamName()); } + @Register("stepback") + public void stepBack(@Validator("notLeader") ProxiedPlayer player) { + SteamwarUser user = SteamwarUser.get(player); + Team team = Team.get(user.getTeam()); + + if (team.size() > 1 && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)) { + Message.send("TEAM_OTHER_LEADER_REQUIRED", player); + return; + } + + user.setLeader(false); + Message.send("TEAM_STEP_BACK", player); + } + @Validator("noTeam") private TypeValidator noTeamValidator() { return (sender, value, messageSender) -> { @@ -141,10 +155,41 @@ public class TeamCommand extends SWCommand { }; } + @Validator("notInTeam") + private TypeValidator notInTeamValidator() { + return (sender, value, messageSender) -> { + if (SteamwarUser.get(value).getTeam() != 0) { + return true; + } else { + messageSender.send("TEAM_NOT_IN_TEAM"); + return false; + } + }; + } + + @Validator("notLeader") + private TypeValidator notLeaderValidator() { + TypeValidator notInTeam = notInTeamValidator(); + return (sender, value, messageSender) -> { + if (!notInTeam.validate(sender, value, messageSender)) return false; + SteamwarUser steamwarUser = SteamwarUser.get(value); + if (!steamwarUser.isLeader()) { + messageSender.send("TEAM_NOT_LEADER"); + return false; + } + return true; + }; + } + @Validator("notDuringEvent") private TypeValidator notDuringEventValidator() { return (sender, value, messageSender) -> { - return !notDuringEvent(value); + if (Event.get() == null) { + return true; + } else { + messageSender.send("TEAM_NOT_IN_EVENT"); + return false; + } }; } @@ -155,7 +200,7 @@ public class TeamCommand extends SWCommand { return (sender, value, messageSender) -> { if (!noTeam.validate(sender, value, messageSender)) return false; if (!notDuringEvent.validate(sender, value, messageSender)) return false; - if (!teamInvitations.containsKey(SteamwarUser.get(value).getId())){ + if (!teamInvitations.containsKey(SteamwarUser.get(value).getId())) { messageSender.send("TEAM_JOIN_NO_INVITATION"); return false; } @@ -201,37 +246,52 @@ public class TeamCommand extends SWCommand { @Validator("unusedKuerzel") private TypeValidator unusedTeamKuerzel() { return (sender, value, messageSender) -> { + if (value.length() < 2 || value.length() > 4) { + messageSender.send("TEAM_KUERZEL_LENGHT"); + return false; + } Team team = Team.get(SteamwarUser.get((ProxiedPlayer) sender).getTeam()); - return !checkTeamKuerzel((ProxiedPlayer) sender, team, value); + Team t = Team.get(value); + if (t != null && (team == null || t.getTeamId() != team.getTeamId())) { + messageSender.send("TEAM_KUERZEL_TAKEN"); + return false; + } + return true; }; } @Validator("unusedName") private TypeValidator unusedTeamName() { return (sender, value, messageSender) -> { + if (value.length() < 4 || value.length() > 15) { + messageSender.send("TEAM_NAME_LENGHT"); + return false; + } Team team = Team.get(SteamwarUser.get((ProxiedPlayer) sender).getTeam()); - return !checkTeamName((ProxiedPlayer) sender, team, value); + Team t = Team.get(value); + if (t != null && t.getTeamId() != team.getTeamId()) { + messageSender.send("TEAM_NAME_TAKEN"); + return false; + } + return true; }; } @Override - public void execute(CommandSender sender, String[] args){ - if(args.length < 1){ + public void execute(CommandSender sender, String[] args) { + if (args.length < 1) { help(sender); return; } - if(!(sender instanceof ProxiedPlayer)) + if (!(sender instanceof ProxiedPlayer)) return; ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - switch(args[0].toLowerCase()){ - case "stepback": - stepBack(player,user,team); - break; + switch (args[0].toLowerCase()) { case "leave": leave(player, user, team); break; @@ -273,32 +333,19 @@ public class TeamCommand extends SWCommand { } } - private void stepBack(ProxiedPlayer player, SteamwarUser user, Team team) { - if(notLeader(player, user, team)) - return; - - if(team.size() > 1 && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)){ - Message.send("TEAM_OTHER_LEADER_REQUIRED", player); - return; - } - - user.setLeader(false); - Message.send("TEAM_STEP_BACK", player); - } - - private void leave(ProxiedPlayer player, SteamwarUser user, Team team){ - if(notInTeam(player, user)) + private void leave(ProxiedPlayer player, SteamwarUser user, Team team) { + if (notInTeam(player, user)) return; int teamSize = team.size(); - if(teamSize > 1 && user.isLeader() && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)){ + if (teamSize > 1 && user.isLeader() && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)) { Message.send("TEAM_OTHER_LEADER_REQUIRED", player); return; } user.setTeam(0); - if(teamSize == 1){ + if (teamSize == 1) { team.disband(user); } @@ -306,31 +353,31 @@ public class TeamCommand extends SWCommand { } - private void invite(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void invite(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; - if(args.length != 2){ + if (args.length != 2) { Message.send("TEAM_INVITE_USAGE", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); - if(target == null){ + if (target == null) { Message.send("TEAM_INVITE_NO_PLAYER", player); return; - }else if(target.getTeam() != 0){ + } else if (target.getTeam() != 0) { Message.send("TEAM_INVITE_IN_TEAM", player); return; } - if(!teamInvitations.containsKey(target.getId())) + if (!teamInvitations.containsKey(target.getId())) teamInvitations.put(target.getId(), new LinkedList<>()); - if(teamInvitations.get(target.getId()).contains(team.getTeamId())){ + if (teamInvitations.get(target.getId()).contains(team.getTeamId())) { Message.send("TEAM_INVITE_ALREADY_INVITED", player); return; } @@ -339,21 +386,21 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_INVITE_INVITED", player, args[1]); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); - if(p != null) + if (p != null) Message.send("TEAM_INVITE_INVITED_TARGET", p, team.getTeamColor(), team.getTeamName()); } - private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; - if(args.length != 2){ + if (args.length != 2) { Message.send("TEAM_REMOVE_USAGE", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); - if(target == null){ + if (target == null) { Message.send("TEAM_REMOVE_NOT_PLAYER", player); return; } @@ -363,18 +410,18 @@ public class TeamCommand extends SWCommand { return; } - if(teamInvitations.containsKey(target.getId())){ - if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){ + if (teamInvitations.containsKey(target.getId())) { + if (teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())) { Message.send("TEAM_REMOVE_INVITE", player); - if(teamInvitations.get(target.getId()).isEmpty()) + if (teamInvitations.get(target.getId()).isEmpty()) teamInvitations.remove(target.getId()); - }else{ + } else { Message.send("TEAM_REMOVE_NO_INVITE", player); } return; } - if(target.getTeam() != user.getTeam()){ + if (target.getTeam() != user.getTeam()) { Message.send("TEAM_REMOVE_NOT_IN_TEAM", player); return; } @@ -383,67 +430,67 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_REMOVE_REMOVED", player); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); - if(p != null) + if (p != null) Message.send("TEAM_REMOVE_REMOVED_TARGET", player); } - private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; - if(args.length < 2){ + if (args.length < 2) { Message.send("TEAM_KUERZEL_USAGE", player); return; } - if(checkTeamKuerzel(player, team, args[1])) + if (checkTeamKuerzel(player, team, args[1])) return; team.setTeamKuerzel(args[1]); Message.send("TEAM_KUERZEL_CHANGED", player); } - private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; - if(args.length < 2){ + if (args.length < 2) { Message.send("TEAM_NAME_USAGE", player); return; } - if(checkTeamName(player, team, args[1])) + if (checkTeamName(player, team, args[1])) return; team.setTeamName(args[1]); Message.send("TEAM_NAME_CHANGED", player); } - private void promote(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void promote(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; - if(args.length < 2){ + if (args.length < 2) { Message.send("TEAM_LEADER_USAGE", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); - if(target == null){ + if (target == null) { Message.send("TEAM_LEADER_NOT_USER", player, args[1]); return; } - if(target.getTeam() != user.getTeam()){ + if (target.getTeam() != user.getTeam()) { Message.send("TEAM_LEADER_NOT_MEMBER", player); return; } @@ -452,19 +499,19 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_LEADER_PROMOTED", player, args[1]); } - private String playerName(SteamwarUser user){ + private String playerName(SteamwarUser user) { return ProxyServer.getInstance().getPlayer(user.getUuid()) != null ? "§a" + user.getUserName() : "§e" + user.getUserName(); } - private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(args.length == 1 && user.getTeam() == 0){ + private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (args.length == 1 && user.getTeam() == 0) { Message.send("TEAM_INFO_USAGE", player); return; - }else if(user.getTeam() == 0 || args.length == 2){ + } else if (user.getTeam() == 0 || args.length == 2) { team = Team.get(args[1]); } - if(team == null){ + if (team == null) { Message.send("UNKNOWN_TEAM", player); return; } @@ -477,51 +524,51 @@ public class TeamCommand extends SWCommand { String members = getMemberList(users, false); - if(members.length() > 0) { + if (members.length() > 0) { Message.sendPrefixless("TEAM_INFO_MEMBER", player, members); } Set events = TeamTeilnahme.getEvents(team.getTeamId()); - if(!events.isEmpty()){ + if (!events.isEmpty()) { Message.sendPrefixless("TEAM_INFO_EVENTS", player, events.stream().map(Event::getEventName).collect(Collectors.joining(", "))); } } private String getMemberList(List users, boolean leaders) { StringBuilder sb = new StringBuilder(); - for(SteamwarUser user : users) { - if(user.isLeader() == leaders) { + for (SteamwarUser user : users) { + if (user.isLeader() == leaders) { sb.append(playerName(user)).append(" "); } } return sb.toString(); } - private void list(ProxiedPlayer player, String[] args){ + private void list(ProxiedPlayer player, String[] args) { final int TEAMS_PER_PAGE = 10; int page; - if(args.length > 1){ - try{ + if (args.length > 1) { + try { page = Integer.parseInt(args[1]); - }catch(NumberFormatException e){ + } catch (NumberFormatException e) { Message.send("TEAM_LIST_NOT_PAGE", player); return; } - }else + } else page = 1; List all = Team.getAll(); final int lastPage = ((all.size() - 1) / 10) + 1; - if(page < 1 || page > lastPage){ + if (page < 1 || page > lastPage) { Message.send("TEAM_LIST_UNKNOWN_PAGE", player); return; } Message.sendPrefixless("TEAM_LIST_HEADER", player, page, lastPage); - for(int i = (page-1) * TEAMS_PER_PAGE; i < (page-1) * TEAMS_PER_PAGE + TEAMS_PER_PAGE && i < all.size(); i++){ + for (int i = (page - 1) * TEAMS_PER_PAGE; i < (page - 1) * TEAMS_PER_PAGE + TEAMS_PER_PAGE && i < all.size(); i++) { Team tm = all.get(i); Message.sendPrefixless("TEAM_LIST_TEAM", player, Message.parse("TEAM_LIST_TEAM_HOVER", player), @@ -529,77 +576,77 @@ public class TeamCommand extends SWCommand { } TextComponent beforePage = new TextComponent("««"); - if(page > 1){ + if (page > 1) { beforePage.setColor(ChatColor.YELLOW); beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("TEAM_LIST_PREV", player)).create())); beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team list " + (page - 1))); - }else + } else beforePage.setColor(ChatColor.DARK_GRAY); - TextComponent nextPage = new TextComponent(" " + Message.parse("TEAM_LIST_PAGE", player) +" »»"); - if(page < lastPage){ + TextComponent nextPage = new TextComponent(" " + Message.parse("TEAM_LIST_PAGE", player) + " »»"); + if (page < lastPage) { nextPage.setColor(ChatColor.YELLOW); nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("TEAM_LIST_NEXT", player)).create())); nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team list " + (page + 1))); - }else + } else nextPage.setColor(ChatColor.DARK_GRAY); beforePage.addExtra(nextPage); player.sendMessage(beforePage); } - private void event(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notInTeam(player, user)) + private void event(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notInTeam(player, user)) return; - if(args.length < 2){ + if (args.length < 2) { Message.send("TEAM_EVENT_USAGE", player); Set events = TeamTeilnahme.getEvents(team.getTeamId()); - if(!events.isEmpty()){ + if (!events.isEmpty()) { Message.send("TEAM_EVENT_HEADER", player); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); - for(Event e : events) + for (Event e : events) Message.sendPrefixless("TEAM_EVENT_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEventName()); } return; } - if(notLeader(player, user, team)) + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; Event event = Event.get(args[1]); - if(event == null){ + if (event == null) { Message.send("TEAM_EVENT_NO_EVENT", player); return; } - if(Instant.now().isAfter(event.getDeadline().toInstant())){ + if (Instant.now().isAfter(event.getDeadline().toInstant())) { Message.send("TEAM_EVENT_OVER", player); return; } - if(TeamTeilnahme.nimmtTeil(team.getTeamId(), event.getEventID())){ + if (TeamTeilnahme.nimmtTeil(team.getTeamId(), event.getEventID())) { TeamTeilnahme.notTeilnehmen(team.getTeamId(), event.getEventID()); Message.send("TEAM_EVENT_LEFT", player); - }else{ + } else { TeamTeilnahme.teilnehmen(team.getTeamId(), event.getEventID()); Message.send("TEAM_EVENT_JOINED", player, event.getEventName()); Message.sendPrefixless("TEAM_EVENT_HOW_TO_LEAVE", player); } } - private void tp(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(args.length == 1){ - if(notInTeam(player, user)) + private void tp(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (args.length == 1) { + if (notInTeam(player, user)) return; tp(player, team); return; } Team targetTeam = Team.get(args[1]); - if(targetTeam == null){ + if (targetTeam == null) { Message.send("TEAM_TP_NO_TEAM", player); return; } @@ -618,15 +665,15 @@ public class TeamCommand extends SWCommand { return info; }); player.connect(ServerConnectRequest.builder() - .target(serverInfo) - .connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout()) - .retry(false) - .reason(ServerConnectEvent.Reason.PLUGIN) - .callback((success, error) -> { - if (error != null) { - Message.send("TEAM_OFFLINE", player); - } - }) + .target(serverInfo) + .connectTimeout(BungeeCord.getInstance().getConfig().getServerConnectTimeout()) + .retry(false) + .reason(ServerConnectEvent.Reason.PLUGIN) + .callback((success, error) -> { + if (error != null) { + Message.send("TEAM_OFFLINE", player); + } + }) .build()); /* ((UserConnection) player).connect(serverInfo, (success, error) -> { @@ -637,8 +684,8 @@ public class TeamCommand extends SWCommand { */ } - private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ - if(notLeader(player, user, team)) + private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args) { + if (notLeader(player, user, team)) return; if (user.isPunishedWithMessage(ChatSender.of(player), Punishment.PunishmentType.NoTeamServer)) { return; @@ -690,10 +737,10 @@ public class TeamCommand extends SWCommand { } private void changeColor(ProxiedPlayer player, SteamwarUser user, Team team) { - if(notLeader(player, user, team)) + if (notLeader(player, user, team)) return; - if(notDuringEvent(player)) + if (notDuringEvent(player)) return; List> colors = new ArrayList<>(); @@ -703,7 +750,8 @@ public class TeamCommand extends SWCommand { colors.add(new SWListInv.SWListEntry<>(item, stringSWListEntry.getObject())); }); - SWListInv inv = new SWListInv<>(player, Message.parse("TEAM_COLOR_TITLE", player), colors, (click, element) -> {}); + SWListInv inv = new SWListInv<>(player, Message.parse("TEAM_COLOR_TITLE", player), colors, (click, element) -> { + }); inv.setCallback((click, element) -> { inv.close(); team.setTeamColor(element); @@ -711,62 +759,54 @@ public class TeamCommand extends SWCommand { inv.open(); } - private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){ - if(arg.length() < 4 || arg.length() > 15){ + private boolean checkTeamName(ProxiedPlayer player, Team team, String arg) { + if (arg.length() < 4 || arg.length() > 15) { Message.send("TEAM_NAME_LENGHT", player); return true; } Team t = Team.get(arg); - if(t != null && t.getTeamId() != team.getTeamId()){ + if (t != null && t.getTeamId() != team.getTeamId()) { Message.send("TEAM_NAME_TAKEN", player); return true; } return false; } - private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg){ - if(arg.length() < 2 || arg.length() > 4){ + private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg) { + if (arg.length() < 2 || arg.length() > 4) { Message.send("TEAM_KUERZEL_LENGHT", player); return true; } Team t = Team.get(arg); - if(t != null && (team == null || t.getTeamId() != team.getTeamId())){ + if (t != null && (team == null || t.getTeamId() != team.getTeamId())) { Message.send("TEAM_KUERZEL_TAKEN", player); return true; } return false; } - private boolean unwantedInTeam(ProxiedPlayer player, SteamwarUser user){ - if(user.getTeam() != 0){ - Message.send("TEAM_IN_TEAM", player); - return true; - } - return false; - } - - private boolean notInTeam(ProxiedPlayer player, SteamwarUser user){ - if(user.getTeam() == 0){ + private boolean notInTeam(ProxiedPlayer player, SteamwarUser user) { + if (user.getTeam() == 0) { Message.send("TEAM_NOT_IN_TEAM", player); return true; } return false; } - private boolean notLeader(ProxiedPlayer player, SteamwarUser user, Team team){ - if(notInTeam(player, user)) + private boolean notLeader(ProxiedPlayer player, SteamwarUser user, Team team) { + if (notInTeam(player, user)) return true; - if(!user.isLeader()){ + if (!user.isLeader()) { Message.send("TEAM_NOT_LEADER", player); return true; } return false; } - private boolean notDuringEvent(ProxiedPlayer player){ - if(Event.get() != null){ + private boolean notDuringEvent(ProxiedPlayer player) { + if (Event.get() != null) { Message.send("TEAM_NOT_IN_EVENT", player); return true; } @@ -774,9 +814,9 @@ public class TeamCommand extends SWCommand { } @Override - public Iterable onTabComplete(CommandSender commandSender, String[] args){ + public Iterable onTabComplete(CommandSender commandSender, String[] args) { List tab = new ArrayList<>(); - if(args.length == 1){ + if (args.length == 1) { tab.add("create"); tab.add("join"); tab.add("invite"); @@ -791,11 +831,11 @@ public class TeamCommand extends SWCommand { tab.add("changecolor"); tab.add("tp"); tab.add("server"); - }else if(args.length == 2){ - if(args[1].equalsIgnoreCase("event")){ + } else if (args.length == 2) { + if (args[1].equalsIgnoreCase("event")) { List coming = Event.getComing(); coming.forEach(event -> tab.add(event.getEventName())); - }else if(args[1].equalsIgnoreCase("join") || args[1].equalsIgnoreCase("info") || args[1].equalsIgnoreCase("tp")){ + } else if (args[1].equalsIgnoreCase("join") || args[1].equalsIgnoreCase("info") || args[1].equalsIgnoreCase("tp")) { List teams = Team.getAll(); teams.forEach(team -> { tab.add(team.getTeamName());