diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-08-02 19:19:11 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-08-02 19:19:11 -0400 |
commit | 0243a46401f7654be2b61457880681fb027271bf (patch) | |
tree | 317f7383f1ca5c787216ab8b6f59ed2cb20675d2 /me/Danker/utils/CommandUtils.java | |
parent | 4655b12ae7cf1735bc951343fe2bc9679d7cb529 (diff) | |
download | SkyblockMod-0243a46401f7654be2b61457880681fb027271bf.tar.gz SkyblockMod-0243a46401f7654be2b61457880681fb027271bf.tar.bz2 SkyblockMod-0243a46401f7654be2b61457880681fb027271bf.zip |
Add tab complete to commands
Diffstat (limited to 'me/Danker/utils/CommandUtils.java')
-rw-r--r-- | me/Danker/utils/CommandUtils.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/me/Danker/utils/CommandUtils.java b/me/Danker/utils/CommandUtils.java new file mode 100644 index 0000000..7b10ad5 --- /dev/null +++ b/me/Danker/utils/CommandUtils.java @@ -0,0 +1,23 @@ +package me.Danker.utils; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; + +public class CommandUtils { + public static List<String> getMatchingPlayers(String arg) { + List<String> matchingPlayers = new ArrayList<>(); + List<EntityPlayer> players = Minecraft.getMinecraft().theWorld.playerEntities; + + for (EntityPlayer player : players) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(arg.toLowerCase())) { + matchingPlayers.add(playerName); + } + } + + return matchingPlayers; + } +} |