diff --git a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
index 39442713..6a5b3ade 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
@@ -170,6 +170,7 @@ public class VelocityCore implements ReloadablePlugin {
teamCommand = new TeamCommand();
new ServerTeamchatCommand();
new DevCommand();
+ new SendCommand();
new EventCommand();
new EventreloadCommand();
new EventRescheduleCommand();
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java
new file mode 100644
index 00000000..660a4ec3
--- /dev/null
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/SendCommand.java
@@ -0,0 +1,93 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.velocitycore.commands;
+
+import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.proxy.server.RegisteredServer;
+import com.velocitypowered.api.proxy.server.ServerInfo;
+import de.steamwar.command.PreviousArguments;
+import de.steamwar.command.SWCommand;
+import de.steamwar.command.TypeMapper;
+import de.steamwar.messages.Chatter;
+import de.steamwar.persistent.Subserver;
+import de.steamwar.sql.SteamwarUser;
+import de.steamwar.sql.UserPerm;
+import de.steamwar.velocitycore.VelocityCore;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class SendCommand extends SWCommand {
+
+ public SendCommand() {
+ super("send", UserPerm.TEAM);
+ }
+
+ @Register
+ public void sendToServer(Chatter sender, Player send, RegisteredServer server) {
+ send.createConnectionRequest(server).fireAndForget();
+ }
+
+ @ClassMapper(value = RegisteredServer.class, local = true)
+ public TypeMapper subserverTypeMapper() {
+ return new TypeMapper<>() {
+ private boolean check(SteamwarUser user, RegisteredServer registeredServer) {
+ ServerInfo serverInfo = registeredServer.getServerInfo();
+ String name = serverInfo.getName();
+ if (name.contains(" ")) return false;
+
+ Subserver subserver = Subserver.getSubserver(serverInfo);
+ if (subserver == null) {
+ return true;
+ }
+
+ return switch (subserver.getType()) {
+ case ARENA -> true;
+ case BUILDER -> user.hasPerm(UserPerm.BUILD);
+ default -> false;
+ };
+ }
+
+ @Override
+ public RegisteredServer map(Chatter sender, PreviousArguments previousArguments, String s) {
+ SteamwarUser user = sender.user();
+ for (RegisteredServer registeredServer : VelocityCore.getProxy().getAllServers()) {
+ if (check(user, registeredServer)) {
+ return registeredServer;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Collection tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
+ SteamwarUser user = sender.user();
+ List tabCompletes = new ArrayList<>();
+ for (RegisteredServer registeredServer : VelocityCore.getProxy().getAllServers()) {
+ if (check(user, registeredServer)) {
+ tabCompletes.add(registeredServer.getServerInfo().getName());
+ }
+ }
+ return tabCompletes;
+ }
+ };
+ }
+}
diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
index 4fb3d0df..ec8d1726 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java
@@ -49,7 +49,7 @@ public class ConnectionListener extends BasicListener {
newPlayers.add(player);
}
- private static final Set TEAM_PERMISSIONS = Set.of("velocity.command.send", "velocity.command.glist");
+ private static final Set TEAM_PERMISSIONS = Set.of("velocity.command.glist");
@Subscribe
public void onPermissionSetup(PermissionsSetupEvent event) {