Browse Source

Adding tab-completion stack '@teams'

RedstoneFuture 1 year ago
parent
commit
f19ac785d4

+ 16 - 0
missilewars-plugin/src/main/java/de/butzlabben/missilewars/commands/MWCommandCompletions.java

@@ -21,6 +21,7 @@ package de.butzlabben.missilewars.commands;
 import co.aikar.commands.BukkitCommandCompletionContext;
 import co.aikar.commands.CommandCompletions;
 import co.aikar.commands.PaperCommandManager;
+import com.google.common.collect.ImmutableList;
 import de.butzlabben.missilewars.game.Game;
 import de.butzlabben.missilewars.game.GameManager;
 import org.bukkit.command.CommandSender;
@@ -36,6 +37,7 @@ public class MWCommandCompletions {
         registerGamesResult();
         registerMissilesResult();
         registerArenasResult();
+        registerTeamsResult();
     }
 
     private void registerGamesResult() {
@@ -69,5 +71,19 @@ public class MWCommandCompletions {
             return game.getLobby().getPossibleArenas();
         });
     }
+    
+    private void registerTeamsResult() {
+        commandCompletions.registerCompletion("teams", c -> {
+            CommandSender sender = c.getSender();
+
+            if (!(sender instanceof Player)) return null;
+            Player player = (Player) sender;
+
+            Game game = GameManager.getInstance().getGame(player.getLocation());
+            if (game == null) return null;
+
+            return ImmutableList.of("1", "2", "spec");
+        });
+    }
 
 }