SteamWar/BungeeCore
Archiviert
13
2

Teamserver #344

Zusammengeführt
Lixfel hat 15 Commits von Teamserver nach master 2022-04-23 12:17:05 +02:00 zusammengeführt
2 geänderte Dateien mit 78 neuen und 3 gelöschten Zeilen
Nur Änderungen aus Commit acb7aa1efb werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.sql.Event;
@ -33,11 +34,16 @@ import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.net.InetSocketAddress;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static de.steamwar.bungeecore.Storage.teamInvitations;
@ -77,6 +83,7 @@ public class TeamCommand extends BasicCommand {
Message.send("TEAM_HELP_HEADER", sender);
Message.send("TEAM_HELP_LIST", sender);
Message.send("TEAM_HELP_INFO", sender);
Message.send("TEAM_HELP_TP", sender);
if(!(sender instanceof ProxiedPlayer))
return;
@ -90,7 +97,6 @@ public class TeamCommand extends BasicCommand {
Message.send("TEAM_HELP_EVENT", sender);
Message.send("TEAM_HELP_LEAVE", sender);
Team team = Team.get(user.getTeam());
if(user.isLeader()){
Message.send("TEAM_HELP_INVITE", sender);
Message.send("TEAM_HELP_REMOVE", sender);
@ -99,6 +105,7 @@ public class TeamCommand extends BasicCommand {
Message.send("TEAM_HELP_COLOR", sender);
Message.send("TEAM_HELP_LEADER", sender);
Message.send("TEAM_HELP_STEP_BACK", sender);
Message.send("TEAM_HELP_SERVER", sender);
}
}
}
@ -157,6 +164,11 @@ public class TeamCommand extends BasicCommand {
case "event":
event(player, user, team, args);
break;
case "tp":
tp(player, user, team, args);
break;
case "server":
server(player, user, team, args);
default:
help(player);
}
@ -549,6 +561,59 @@ public class TeamCommand extends BasicCommand {
}
}
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){
Message.send("TEAM_TP_NO_TEAM", player);
return;
}
tp(player, targetTeam);
}
private void tp(ProxiedPlayer player, Team targetTeam) {
if (targetTeam.getAddress() == null) {
Message.send("TEAM_NO_ADDRESS", player);
return;
}
ServerInfo serverInfo = Storage.teamServers.computeIfAbsent(targetTeam.getTeamId(), integer -> {
InetSocketAddress address = new InetSocketAddress(targetTeam.getAddress(), targetTeam.getPort());
return ProxyServer.getInstance().constructServerInfo("Team " + targetTeam.getTeamKuerzel(), address, "SteamWar.de - Teamserver", false);
});
player.connect(serverInfo);
}
private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
if(notLeader(player, user, team))
return;
if (args.length < 2) {
Message.send("TEAM_SERVER_USAGE", player);
return;
}
String server = args[1];
int port = 25565;
if (args.length == 3) {
try {
port = Integer.parseInt(args[2]);
if (port < 1 || port > 65535) {
Message.send("TEAM_SERVER_PORT_INVALID", player);
return;
}
} catch (NumberFormatException e) {
Message.send("TEAM_SERVER_PORT_INVALID", player);
return;
}
}
team.setAddress(server);
team.setPort(port);
Message.send("TEAM_SERVER_SET", player);
}
private void changeColor(ProxiedPlayer player, SteamwarUser user, Team team) {
YoyoNow markierte diese Unterhaltung als gelöst Veraltet
Veraltet
Review

Du musst noch den Teamserver aus dem Storage werfen

Du musst noch den Teamserver aus dem Storage werfen
if(notLeader(player, user, team))
return;
@ -649,11 +714,13 @@ public class TeamCommand extends BasicCommand {
tab.add("changename");
tab.add("promote");
tab.add("changecolor");
tab.add("tp");
tab.add("server");
}else if(args.length == 2){
if(args[1].equalsIgnoreCase("event")){
List<Event> coming = Event.getComing();
coming.forEach(event -> tab.add(event.getEventName()));
}else if(args[1].equalsIgnoreCase("join") || args[1].equalsIgnoreCase("info")){
}else if(args[1].equalsIgnoreCase("join") || args[1].equalsIgnoreCase("info") || args[1].equalsIgnoreCase("tp")){
List<Team> teams = Team.getAll();
teams.forEach(team -> {
tab.add(team.getTeamName());

Datei anzeigen

@ -371,6 +371,7 @@ TEAM_NOT_IN_EVENT=§cDies ist während eines Events nicht möglich.
TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team.
TEAM_HELP_LIST=§8/§7team list §8- §7Liste alle Teams auf.
TEAM_HELP_INFO=§8/§7team info §8- §7Informiere dich über ein Team.
TEAM_HELP_TP=§8/§7team tp §8(§7Team§8) §8- §7Teleportiert zum Teamserver.
TEAM_HELP_CREATE=§8/§7team create §8- §7Erstelle dein eigenes Team.
TEAM_HELP_JOIN=§8/§7team join §8- §7Trete einem Team bei.
TEAM_HELP_CHAT=§8/§7teamchat §8- §7Sende Nachrichten an dein Team.
@ -383,6 +384,7 @@ TEAM_HELP_NAME=§8/§7team changename §8- §7Ändere deinen Teamnamen.
TEAM_HELP_COLOR=§8/§7team changecolor §8- §7Ändere deine Teamfarbe.
TEAM_HELP_LEADER=§8/§7team promote §8- §7Ernenne jemanden zum Teamleader.
TEAM_HELP_STEP_BACK=§8/§7team stepback §8- §7Tritt als Leader zurück.
TEAM_HELP_SERVER=§8/§7team server §8[§eIP/Address§8] §8(§7Port§8) §8- §7Setzt Addresse des Teamservers.
#Team Create
TEAM_CREATE_USAGE=§8/§7team create §8[§eTeamkürzel§8] §8[§eTeamname§8]
@ -468,6 +470,12 @@ TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl
#Team Color
TEAM_COLOR_TITLE=Farbe wählen
#Team Server
TEAM_SERVER_USAGE=§8/§7team server §8[§eIP/Address§8] §8(§7Port§8) §8- §7Setzt Addresse des Teamservers.
TEAM_SERVER_SET=§7Du hast die Teamserveradresse geändert§8!
TEAM_SERVER_PORT_INVALID=§cDer Port muss eine Zahl sein.
TEAM_NO_ADDRESS=§cTeamserveradresse nicht gesetzt.
#TpCommand
TP_USAGE=§8/§7tp §8[§eSpieler§8]
TP_USAGE_EVENT=§8/§7tp §8[§eSpieler §7oder §eTeam§8]